tree-sitter-blazor
Tree-sitter grammar for Blazor/Razor syntax (.razor and .cshtml files).
Overview
This crate provides a tree-sitter grammar for parsing Blazor and Razor template syntax, enabling code analysis, syntax highlighting, and tooling support for ASP.NET Blazor applications.
Features
- Parse
.razorand.cshtmlfiles - Support for Blazor component syntax
- HTML and C# code mixing
- Directive parsing (
@page,@code,@inject, etc.) - Component parameters and events
Usage
Add this to your Cargo.toml:
[]
= "0.1"
= "0.20"
Example
use ;
extern "C"
Development
This grammar is part of the Coraline code graph indexer project.
Building
Testing
Grammar Definition
The grammar is defined in grammar.js and follows the tree-sitter grammar format. See the
tree-sitter documentation
for more information on creating and modifying grammars.
License
MIT - See LICENSE file for details.
Contributing
Contributions are welcome! Please open an issue or pull request on GitHub.