Repository navigation
zigsyn 0.2.0 improves Zig syntax coverage, reduces memory use during scanning and parsing, and adds more precise diagnostics.
Parser and scanner
- Build the correct AST for array initializers, double-pointer types, and typed initializers nested inside type expressions.
- Accept ordinary line comments between tokens and retain documentation on nested containers. Preserve declaration modifiers and the attributes of later destructuring bindings.
- Validate statement terminators, commas, payloads, and documentation placement against the bundled grammar.
- Bound recursive parsing and handle long
else ifexpressions iteratively. Share token storage between AST nodes and remove duplicate initializer values and declaration types. - Accept a leading UTF-8 BOM and non-ASCII control characters in literals. Use
ScanOptionswithParser::from_scannerto enable strict whitespace checks.
Diagnostics and file parsing
- Parse functions return
zigsyn::Error. Syntax and unexpected-token errors include byte offsets, and file I/O errors include the affected path. - Use
parse_dir_entriesto collect successful ASTs and individual errors from the same directory. Parsed ASTs implementSendandSync.
Upgrading from 0.1.0
Use VarDecl::ty() and AnonInit::fields() in place of the removed fields. Token lists are now immutable TokenSpan values.
Update consumers of serialized ASTs for the removed fields and the new grouped and comptime expression shapes. Regenerate saved ASTs from Zig source when possible. Migration guide
Thanks to moznion for removing duplicate AST subtrees. PR #1