-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #703 I think this branch has reached a critical mass where the core functionality is there and this needs tweaks/polishes that could probably be done in subsequent PRs. The gist of the change is that now the RuleNode has children of `type NamedNode = (String, Node)`. The parsers now thread the expected node/field names into the PG, which adds a `with_name` transformation, that assigns the relevant names for significant nodes in the intermediate parse results, which is folded to the CST using the existing mechanism. Trivia scanners are unnamed. The cursor still internally uses an unnamed node not to incur cost when it's not used but a new `CursorWithNames` wrapper is introduced, that wraps the underlying cursor and returns `(String, Node)` items. Quite a few things have been fixed since the PoC, mostly around delimited, flattened fields and now the recovered nodes also have names. Dummy names were removed and only the desired "auto-generated" ones remain, i.e. `item`, `separator`, `variant`. There's still an open issue how best to name/propagate the names to the unreduced, recovered from precedence parse results (e.g. `2 * new` - the `MultiplicativeExpression` is not yet named) but since it's only related to the recovery and in the precedence case, we can punt it for now (especially since recovery isn't ideal yet around the precedence parser). Other than that, the next thing will be collecting the field names into an enum to cut down the memory footprint of the CST.
- Loading branch information
Showing
340 changed files
with
11,738 additions
and
9,304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@nomicfoundation/slang": minor | ||
--- | ||
|
||
CST children nodes are now named |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.