dotnet / csharp-tmLanguage

Syntax grammar used for C# colorization
MIT License
67 stars 34 forks source link

Generate csharp.tmLanguage.yml using Roslyn #168

Open am11 opened 4 years ago

am11 commented 4 years ago

A tool was introduced to write Antlr grammar: https://github.com/dotnet/roslyn/tree/5cae62a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator.

The result is: https://github.com/dotnet/roslyn/blob/5cae62a/src/Compilers/CSharp/Portable/Generated/CSharp.Generated.g4.

I think it would save some effort to support future versions of language, if the textmate grammar generation is also done by tool like CSharpSyntaxGenerator.

CyrusNajmabadi commented 4 years ago

if the textmate grammar generation is also done by tool like CSharpSyntaxGenerator.

I don't think Roslyn needs to be in the business of doing this. TextMate (or some interested party) can use the same information that Roslyn uses to generate the appropriate files it needs.