[blocked] Add a dedicated cst::Node::Invalid for incomplete/invalid CST nodes#969
Closed
Xanewok wants to merge 2 commits intoNomicFoundation:mainfrom
Closed
[blocked] Add a dedicated cst::Node::Invalid for incomplete/invalid CST nodes#969Xanewok wants to merge 2 commits intoNomicFoundation:mainfrom
cst::Node::Invalid for incomplete/invalid CST nodes#969Xanewok wants to merge 2 commits intoNomicFoundation:mainfrom
Conversation
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.
🦋 Changeset detectedLatest commit: 65dce14 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Contributor
Author
|
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! |
cst::Node::Invalid for incomplete/invalid CST nodescst::Node::Invalid for incomplete/invalid CST nodes
Contributor
Author
|
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. |
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).
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 #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::SKIPPEDtoTokenKind::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.