Port tests from upstream parser_test.zig:
- "allow empty line before comment at start of block"
- "comptime struct field"
- "break from block"
- "grouped expressions (parentheses)"
- "array types last token"
Fix bugs in parser.c:
- parseBreakLabel: use null_token instead of null_node
- test decl: use null_token for unnamed tests
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Port tests from upstream parser_test.zig:
- "container declaration, one item, multi line trailing comma"
- "container declaration, no trailing comma on separate line"
- "container declaration, line break, no trailing comma"
- "container declaration, transform trailing comma"
- "container declaration, comment, add trailing comma"
- "container declaration, multiline string, add trailing comma"
- "container declaration, doc comment on member, add trailing comma"
- "remove empty lines at start/end of container decl"
Implement in parser.c:
- Test declarations in parseContainerMembers
- Comptime block/var statements in expectStatement
- Variable declaration with initializer in expectVarDeclExprStatement
- Regular assignment expressions
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Port tests from upstream parser_test.zig:
- "multiline string mixed with comments"
- "empty file"
- "file ends in comment"
- "file ends in multi line comment"
- "file ends in comment after var decl"
- "top-level fields"
- "container declaration, single line"
Implement in parser.c:
- parseSuffixOp: array access, field access, deref, unwrap optional
- Slice/array type parsing in parseTypeExpr
- Multiline string literal parsing
Fix zigData mapping in parser_test.zig:
- optional_type uses .node (not .opt_node)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Port tests from upstream parser_test.zig:
- "respect line breaks before functions"
- "simple top level comptime block"
- "two spaced line comments before decl"
- "respect line breaks after var declarations"
Implement in parser.c:
- parseSuffixOp: array access (a[i]), field access (a.b),
deref (a.*), unwrap optional (a.?)
- Multiline string literal parsing
- Slice types ([]T, [:s]T) and array types ([N]T, [N:s]T)
- Fix comptime block main_token in parseContainerMembers
Fix zigData mapping in parser_test.zig:
- field_access, unwrap_optional use node_and_token (not node_and_node)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Port "zig fmt: respect line breaks in struct field value declaration"
test from upstream parser_test.zig.
Implement in parser.c:
- Slice types ([]T, [:s]T) in parseTypeExpr
- Array types ([N]T, [N:s]T) in parseTypeExpr
- Multiline string literals in parsePrimaryTypeExpr
- Add comments explaining why const/volatile/allowzero pointer
modifiers are consumed (not stored in AST; renderer re-derives
them from token positions)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>