Merged
Conversation
Specifically, don't overwrite the field names for the operator expressions and also don't name the trivia items (insignificant).
OmarTawfik
reviewed
Dec 15, 2023
OmarTawfik
reviewed
Dec 15, 2023
OmarTawfik
reviewed
Dec 15, 2023
OmarTawfik
reviewed
Dec 15, 2023
This cuts down on the tuple arguments and provides more meaningful names like `name` or `node`.
OmarTawfik
reviewed
Dec 19, 2023
OmarTawfik
reviewed
Dec 19, 2023
OmarTawfik
reviewed
Dec 19, 2023
.../snapshots/cst_output/ContractDefinition/member_using_directive/generated/0.4.11-success.yml
Show resolved
Hide resolved
OmarTawfik
approved these changes
Dec 19, 2023
Contributor
OmarTawfik
left a comment
There was a problem hiding this comment.
Thank you. Left a few suggestions, but nothing blocking.
Merged
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jan 11, 2024
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @nomicfoundation/slang@0.13.0 ### Minor Changes - [#710](#710) [`2025b6cb`](2025b6c) Thanks [@Xanewok](https://github.com/Xanewok)! - CST children nodes are now named - [#723](#723) [`b3dc6bcd`](b3dc6bc) Thanks [@Xanewok](https://github.com/Xanewok)! - Properly parse unreserved keywords in an identifier position, i.e. `from`, `emit`, `global` etc. - [#728](#728) [`662a672c`](662a672) Thanks [@Xanewok](https://github.com/Xanewok)! - Remove Language#scan API; use the parser API instead - [#719](#719) [`1ad6bb37`](1ad6bb3) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - introduce strong types for all Solidity non terminals in the TypeScript API. ### Patch Changes - [#719](#719) [`1ad6bb37`](1ad6bb3) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - unify Rust/TypeScript node helpers: `*_with_kind()`, `*_with_kinds()`, `*_is_kind()`), ... - [#731](#731) [`3deaea2e`](3deaea2) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - add `RuleNode.unparse()` to the TypeScript API Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
rollup-smithbm0p
added a commit
to rollup-smithbm0p/slang
that referenced
this pull request
Dec 26, 2025
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @nomicfoundation/slang@0.13.0 ### Minor Changes - [#710](NomicFoundation/slang#710) [`2025b6cb`](NomicFoundation/slang@2025b6c) Thanks [@Xanewok](https://github.com/Xanewok)! - CST children nodes are now named - [#723](NomicFoundation/slang#723) [`b3dc6bcd`](NomicFoundation/slang@b3dc6bc) Thanks [@Xanewok](https://github.com/Xanewok)! - Properly parse unreserved keywords in an identifier position, i.e. `from`, `emit`, `global` etc. - [#728](NomicFoundation/slang#728) [`662a672c`](NomicFoundation/slang@662a672) Thanks [@Xanewok](https://github.com/Xanewok)! - Remove Language#scan API; use the parser API instead - [#719](NomicFoundation/slang#719) [`1ad6bb37`](NomicFoundation/slang@1ad6bb3) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - introduce strong types for all Solidity non terminals in the TypeScript API. ### Patch Changes - [#719](NomicFoundation/slang#719) [`1ad6bb37`](NomicFoundation/slang@1ad6bb3) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - unify Rust/TypeScript node helpers: `*_with_kind()`, `*_with_kinds()`, `*_is_kind()`), ... - [#731](NomicFoundation/slang#731) [`3deaea2e`](NomicFoundation/slang@3deaea2) Thanks [@OmarTawfik](https://github.com/OmarTawfik)! - add `RuleNode.unparse()` to the TypeScript API Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 awith_nametransformation, 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
CursorWithNameswrapper 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- theMultiplicativeExpressionis 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.