TOML, Dart, Zig, Nix: Add error state for unterminated string#315
Closed
techee wants to merge 4 commits intoScintillaOrg:masterfrom
Closed
TOML, Dart, Zig, Nix: Add error state for unterminated string#315techee wants to merge 4 commits intoScintillaOrg:masterfrom
techee wants to merge 4 commits intoScintillaOrg:masterfrom
Conversation
Member
|
It should be fairly easy to avoid the Something like switching state near the top of the loop from |
Contributor
Author
You are right, it works this way. I actually tried that before and then got some strange error messages from the unit test runner regarding I've repushed the commits with the updated version. |
nyamatongwe
pushed a commit
that referenced
this pull request
May 13, 2025
nyamatongwe
pushed a commit
that referenced
this pull request
May 13, 2025
nyamatongwe
pushed a commit
that referenced
this pull request
May 13, 2025
nyamatongwe
pushed a commit
that referenced
this pull request
May 13, 2025
Member
|
Committed with mentions in history and pull-number tags. |
Contributor
Author
|
Great, thanks! |
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.
For single-line strings it's easy to forget the termination character for these languages. This PR tries to address that by adding the
SCE_..._STRINGEOLstate marking unterminated strings similarly to other languages.I tried to follow the implementation of other lexers - typically the implementation looks like
However, the
sc.ForwardSetState()at line end isn't quite correct - many lexers containat the end of the main loop where they set line state and update various state variables and
sc.ForwardSetState()when handling unterminated string may cause this code to be skipped.I only ran into this problem with the TOML lexer and the provided unit test so I implemented "correctly" only this lexer; I left the "incorrect" implementation (which is used by many existing lexers too) with the remaining lexers. It probably doesn't matter much as unterminated strings are supposed to be fixed by users soon and not to remain in the code for a long time.