Skip to content

[blocked] Add a dedicated cst::Node::Invalid for incomplete/invalid CST nodes#969

Closed
Xanewok wants to merge 2 commits intoNomicFoundation:mainfrom
Xanewok:cst-incomplete-variants
Closed

[blocked] Add a dedicated cst::Node::Invalid for incomplete/invalid CST nodes#969
Xanewok wants to merge 2 commits intoNomicFoundation:mainfrom
Xanewok:cst-incomplete-variants

Conversation

@Xanewok
Copy link
Copy Markdown
Contributor

@Xanewok Xanewok commented May 20, 2024

Closes #835
Closes #507
Closes #700 (although we still should explore not having to recursively match validity of a node when we have perf)

This also renames TokenKind::SKIPPED to TokenKind::INVALID; it's only possible to emit by the lexer in case there's an error matching any token but will not end up in the tree as the parser will skip over it and embed it in the newly introduced variants here.

Xanewok added 2 commits May 20, 2024 13:25
This subsumes the Token node with TokenKind::SKIPPED and also renames
this builtin kind to INVALID to better highlight that it's only related
to lexer emitting invalid/unrecognized tokens, which do not end up in
the tree.
@Xanewok Xanewok requested a review from a team as a code owner May 20, 2024 11:30
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented May 20, 2024

🦋 Changeset detected

Latest commit: 65dce14

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@nomicfoundation/slang Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Xanewok Xanewok marked this pull request as draft June 4, 2024 10:37
@Xanewok
Copy link
Copy Markdown
Contributor Author

Xanewok commented Jun 4, 2024

Converting to draft until we reach a design consensus in #835. If anyone wants to tackle this at any point, feel free to take it over!

@Xanewok Xanewok changed the title Add a dedicated cst::Node::Invalid for incomplete/invalid CST nodes [blocked] Add a dedicated cst::Node::Invalid for incomplete/invalid CST nodes Jun 4, 2024
@Xanewok
Copy link
Copy Markdown
Contributor Author

Xanewok commented Jun 16, 2024

Closing since the consensus in #835 is to not introduce a third CST node variant and use terminal kinds to mark invalid or missing syntax.

@Xanewok Xanewok closed this Jun 16, 2024
github-merge-queue bot pushed a commit that referenced this pull request Jun 20, 2024
Alternative to #969

Closes #835
Closes #507
Closes #700

This implements the idea from #835:
- introduces a new `TerminalKind::MISSING`
- renames `TerminalKind::SKIPPED` to `TerminalKind::UNRECOGNIZED`
- emits `TerminalKind::MISSING` instead of `TerminalKind::UNRECOGNIZED`
when the tree is empty

When writing this, I came to a conclusion that actually using two
distinc terminal kinds might do more harm than good here, see
#835 (comment).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant