Skip to content

Commit 43f9011

Browse files
committed
Split import syntax parser
1 parent 6eb40a2 commit 43f9011

22 files changed

Lines changed: 1567 additions & 1280 deletions

compose/imports.mbt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,12 @@ using @resolver {
5252
using @ast {type WgslDirective, type WgslDirectiveKind}
5353

5454
///|
55-
using @parser {
56-
type WgslParseError,
55+
using @parser {type WgslParseError, parse_wgsl_translation_unit_strict}
56+
57+
///|
58+
using @import_syntax {
5759
parse_wgsl_import_spec_is_empty_or_final_semicolon,
5860
parse_wgsl_import_targets,
59-
parse_wgsl_translation_unit_strict,
6061
}
6162

6263
///|

compose/moon.pkg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
"Milky2018/moon_wgsl/ast",
88
"Milky2018/moon_wgsl/directive",
99
"Milky2018/moon_wgsl/directive_syntax",
10+
"Milky2018/moon_wgsl/import_syntax",
1011
"Milky2018/moon_wgsl/parser",
1112
"Milky2018/moon_wgsl/lex",
1213
"moonbitlang/core/hashmap",

docs/moon_wgsl-issue-tracker.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Last updated: 2026-05-06
1313

1414
| ID | Source | Problem | Status | Notes |
1515
| --- | --- | --- | --- | --- |
16+
| `WGSL-188` | Architecture review | `parser` still publicly owned `#import` payload parsing and `ParseImportsError`, so preprocessor/import syntax errors were attached to the WGSL translation-unit parser boundary. | `DONE` | Split import target parsing into `import_syntax` with its own moonyacc grammar, rewired compose/resolver/transform to depend on it, and removed import payload parsing from parser. Verified with the full local gate on 2026-05-06. |
1617
| `WGSL-187` | Architecture review | After moving one-line directive parsing out of `parser`, `parser` still depended on the broad `directive` package, pulling source scanning and shader-def semantics into the parser dependency surface. | `DONE` | Split low-level directive line / GLSL version parsing into `directive_syntax`, rewired parser and directive to depend on that narrow package, and kept source scanning plus shader-def/reference semantics in `directive`. Verified with the full local gate on 2026-05-06. |
1718
| `WGSL-186` | Architecture review | `directive` still depended on `parser` solely for one-line directive parsing, which forced `parser` to keep a public preprocessing directive entry point and retained a generated yacc start symbol for non-WGSL source-scanner work. | `DONE` | Moved one-line directive parsing into `directive`, removed the parser-to-directive generated start rule and tokens, rewired parser internals to consume the directive package, and dropped the reverse `directive -> parser` dependency. Verified with the full local gate on 2026-05-06. |
1819
| `WGSL-185` | Architecture review | AST still exposed zero-production-use type spelling/span convenience methods (`WgslTypeAtom::text`, `WgslTypeRef::start`), leaving raw type text and unused span access on the public surface after type atoms became structured. | `DONE` | Demoted `WgslTypeAtom::text` to package-private, removed unused public `WgslTypeRef::start`, regenerated interfaces, and verified `moon ide analyze` no longer reports public functions with zero usage. Verified with the full local gate on 2026-05-06. |

0 commit comments

Comments
 (0)