{"id":16203750,"url":"https://github.com/mayuki/qulaly","last_synced_at":"2025-03-19T07:30:58.650Z","repository":{"id":66705407,"uuid":"287909823","full_name":"mayuki/Qulaly","owner":"mayuki","description":"A library that queries Roslyn's C# syntax tree with CSS selector-like syntax.","archived":false,"fork":false,"pushed_at":"2020-08-24T11:18:37.000Z","size":32294,"stargazers_count":30,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-28T16:23:12.107Z","etag":null,"topics":["csharp","dotnet-core","roslyn"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mayuki.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-16T09:09:14.000Z","updated_at":"2024-07-11T08:33:28.000Z","dependencies_parsed_at":"2023-04-19T20:18:58.608Z","dependency_job_id":null,"html_url":"https://github.com/mayuki/Qulaly","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mayuki%2FQulaly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mayuki%2FQulaly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mayuki%2FQulaly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mayuki%2FQulaly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mayuki","download_url":"https://codeload.github.com/mayuki/Qulaly/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243976644,"owners_count":20377695,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","dotnet-core","roslyn"],"created_at":"2024-10-10T09:55:00.642Z","updated_at":"2025-03-19T07:30:58.644Z","avatar_url":"https://github.com/mayuki.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Qulaly\n**Qu**ery **la**nguage for Ros**ly**n. Qulaly is a library that queries Roslyn's C# syntax tree with CSS selector-like syntax. Inspired by [esquery](https://github.com/estools/esquery) in ECMAScript ecosystem.\n\n[![NuGet version](https://badge.fury.io/nu/Qulaly.svg)](https://www.nuget.org/packages/Qulaly)\n[![Build-Development](https://github.com/mayuki/Qulaly/workflows/Build-Development/badge.svg)](https://github.com/mayuki/Qulaly/actions?query=workflow%3ABuild-Development)\n\n⚡Live Demo: https://mayuki.github.io/Qulaly/\n\n## Example\nThe following code shows how to query the `async` method.\n\n```csharp\nusing Qulaly;\n\nvar syntaxTree = CSharpSyntaxTree.ParseText(@\"\nusing System;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\n\npublic class Class1\n{\n    public static async ValueTask\u003cT\u003e FooAsync\u003cT\u003e(int a, string b, T c) =\u003e throw new NotImplementedException();\n    public async Task BarAsync\u003cT\u003e() =\u003e throw new NotImplementedException();\n    public object MethodA(int arg1) =\u003e throw new NotImplementedException();\n    public object MethodB(int arg1, string arg2) =\u003e throw new NotImplementedException();\n}\n\");\n\n// Enumerate SyntaxNodes by calling `QuerySelectorAll` extension method for SyntaxNode/SyntaxTree.\nforeach (var methodNode in syntaxTree.QuerySelectorAll(\":method[Modifiers ~= 'async']\"))\n{\n    Console.WriteLine(((MethodDeclarationSyntax)methodNode).Identifier.ToFullString());\n}\n```\n### Output\n```\nFooAsync\nBarAsync\n```\n\n## Methods\n- `QuerySelectorAll`\n- `QuerySelector`\n\n## Install\nInstall NuGet package from NuGet.org\n\n```bash\n$ dotnet add package Qulaly\n```\n\n```powershell\nPS\u003e Install-Package Qulaly\n```\n\n## Supported Selectors\nQulaly supports a subset of [CSS selector level 4](https://www.w3.org/TR/selectors-4/). The selector engine also supports Qulaly-specific extensions to the selector.\n\n- SyntaxNode Type: `MethodDeclaration`, `ClassDeclaration` ... \n    - See also [SyntaxKind enum](https://docs.microsoft.com/en-us/dotnet/api/microsoft.codeanalysis.csharp.syntaxkind?view=roslyn-dotnet)\n- SyntaxNode Univarsal: `*`\n- SyntaxNode pseudo-classes (for short-hand)\n    - `:method`\n    - `:class`\n    - `:interface`\n    - `:lambda`\n- Combinators\n    - [Descendant](https://www.w3.org/TR/selectors-4/#descendant-combinators): `node descendant`\n    - [Child](https://www.w3.org/TR/selectors-4/#child-combinators): `node \u003e child`\n    - [Next-sibling](https://www.w3.org/TR/selectors-4/#adjacent-sibling-combinators): `node + next`\n    - [Subsequent-sibling](https://www.w3.org/TR/selectors-4/#general-sibling-combinators): `node ~ sibling`\n- Pseudo-class\n    - [Negation](https://www.w3.org/TR/selectors-4/#negation): `:not(...)`\n    - [Matches-any](https://www.w3.org/TR/selectors-4/#matches): `:is(...)`\n    - [Relational](https://www.w3.org/TR/selectors-4/#relational): `:has(...)`\n    - [`:first-child`](https://www.w3.org/TR/selectors-4/#the-first-child-pseudo)\n    - [`:last-child`](https://www.w3.org/TR/selectors-4/#the-last-child-pseudo)\n- Attributes (Properties)\n    - `[PropName]` (existance)\n    - `[PropName = 'Exact']`\n    - `[PropName ^= 'StartsWith']`\n    - `[PropName $= 'EndsWith']`\n    - `[PropName *= 'Contains']`\n    - `[PropName ~= 'Item']` (ex. `[Modifiers ~= 'async']`)\n- Qulaly Extensions\n    - `[Name = 'MethodName']`: Name special property\n        - `Name` is a special property for convenience that can be used in `MethodDeclaration`, `ClassDeclaration` ... etc\n    - `[TypeParameters.Count \u003e 0]`: Conditions\n        - `Parameters.Count`\n        - `TypeParameters.Count`\n\n## License\nMIT License\n```\nCopyright © 2020-present Mayuki Sawatari \u003cmayuki@misuzilla.org\u003e\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmayuki%2Fqulaly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmayuki%2Fqulaly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmayuki%2Fqulaly/lists"}