Repository navigation
Align Lua parser diagnostics and validate missing closers - #351
Merged
Merged
Conversation
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.
Malformed Lua diagnostics exposed enum names in the public AST parser, and the execution compiler narrowed reserved token IDs to char, producing messages such as
ą expected. Both now use Lua keyword/punctuation spelling and token categories. For example,if true print() endreports'then' expected near 'print', andlocal = 1reports<name> expected near '='.The public
LuaSyntaxTree.Parseparser now reports the opening construct and its line when a closing token is missing on a later line:'end' expected (to close 'do' at line 1) near <eof>. It rejects missing block/table closers that it previously accepted and handles valid multiline grouped expressions and table keys. EOF diagnostics use the lexer end position, including trailing newlines and comments, rather than the retained previous token.The execution compiler already tracked opening constructs. Preserve its full int token IDs, quote expected punctuation, and use categories for expected names/numbers/strings. This fixes its diagnostics without changing valid execution behavior.
Follow the official Lua 5.2 lexer token2str/txtToken conventions and parser check_match behavior. The fixed syntax/category distinction also applies in 5.3 and 5.4. Public signatures remain compatible. AST string context still uses existing token display text, so this does not promise byte-for-byte diagnostic parity for original quote styles or long-bracket delimiter levels.
Fixes #113.
Validation: