-
Notifications
You must be signed in to change notification settings - Fork 0
feat(parser): lua 5.5 global const #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -837,6 +837,35 @@ statements["local"] = function(state) | |
| return new_inner_node(start_range, rhs and rhs[#rhs] or lhs[#lhs], "Local", {lhs, rhs}) | ||
| end | ||
|
|
||
| statements["global"] = function(state) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2 | Confidence: High Speculative: The implementation creates a "Global" AST node but ignores attributes entirely ( Code Suggestion: |
||
| local start_range = copy_range(state) | ||
| -- Skip "global". | ||
| skip_token(state) | ||
|
Comment on lines
+840
to
+843
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2 | Confidence: High The new Code Suggestion: |
||
|
|
||
| -- Global definition, potentially with assignment. | ||
| local lhs = {} | ||
| local rhs | ||
|
|
||
| repeat | ||
| lhs[#lhs + 1] = parse_id(state) | ||
|
|
||
| -- Check if a Lua 5.4/5.5 attribute is present | ||
| if state.token == "<" then | ||
| -- Consume and ignore attribute for now | ||
| skip_token(state) | ||
| check_name(state) | ||
| skip_token(state) | ||
| check_and_skip_token(state, ">") | ||
| end | ||
|
Comment on lines
+852
to
+859
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2 | Confidence: High
Code Suggestion: |
||
| until not test_and_skip_token(state, ",") | ||
|
|
||
| if test_and_skip_token(state, "=") then | ||
| rhs = parse_expression_list(state) | ||
| end | ||
|
|
||
| return new_inner_node(start_range, rhs and rhs[#rhs] or lhs[#lhs], "Global", {lhs, rhs}) | ||
| end | ||
|
|
||
| statements["::"] = function(state) | ||
| local start_range = copy_range(state) | ||
| -- Skip "::". | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2 | Confidence: High
The test suite validates that the parser produces a
Globalnode but does not verify the presence or structure of attribute data. This creates a false sense of correctness. The tests pass because attributes are ignored, but they do not test the semantic requirement that attributes be captured. The test suite should be updated to expect an attribute field in the AST node (once the parser is fixed) to prevent future regressions.Code Suggestion: