Changed packager image to karthik one added debug and reverted manual change added build action packager - proto defination added A Roslyn-based command-line tool to parse C# and Razor source files and serialize their Abstract Syntax Trees (AST) to Protocol Buffer binary format.
sssssfn
- C# Parsing: Parse
.csfiles and serialize to Protobuf binary format - Razor Support: Parse
.cshtmland.razorfilesf - Batch Processing: Process entire directories recursively
- AST Viewer: GUI tree view for visualizing AST structure
- Console Output: Detailed recursive AST display with line numbers and span information d
This project includes a Git submodule for Protocol Buffer definitions. When cloning, use the --recurse-submodules flag:
git clone --recurse-submodules <repository-url>If you've already cloned the repository without submodules, initialize them:
git submodule update --init --recursiveTo update the submodule to the latest version:
git submodule update --remoteParse a single file:
dotnet-ast-parse parse MyFile.cs -o output.binParse a directory:
dotnet-ast-parse parse ./src -o ./ast-outputDisplay AST in GUI:
dotnet-ast-view deserialize output.bin --guiDisplay AST in console:
dotnet-ast-view deserialize output.binParse C# and Razor source files and serialize to Protobuf binary format.
Arguments:
file- Path to the source file(s) to parse (file or directory)
Options:
-o, --output- Output file path for the serialized Protobuf binary AST. If not specified, defaults to input filename(s) with.binextension.
Deserialize a Protobuf binary AST file and display all data.
Arguments:
file- Path to the Protobuf binary AST file to deserialize
Options:
-g, --gui- Display the AST in a graphical tree view window
AST data is serialized using Protocol Buffers with the following schema:
- Location: Span information including line number, span start, span length, and line length
- SyntaxElement: Node/Token with kind, type, location, and trivia
- Trivia: Leading and trailing trivia (comments, whitespace, etc.)
- SyntaxTree: Root element with total node count
dotnet buildThis project uses the Roslyn compiler platform (Apache 2.0 license).