Repository navigation
parser: read the rest of a print list after a parenthesized first expression - #147
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
Alonely0
left a comment
There was a problem hiding this comment.
This is one of the greatest pain points in AWK's grammar. Thanks for the fix!
Solve the review comment whenever you have a moment and we can merge this.
…ression 'print ($1) "-", $2' failed: after folding the first expression the comma before the next argument was left unparsed.
ce04776 to
3c0bcba
Compare
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
|
Thanks for the PR! |
printwhose first argument starts with a parenthesized expression and goes on ((x) + 1,(x) "str",(x) ? a : b) fails when more arguments follow:gawk 5.3.2 prints
x- yand2 2. Without the comma (print (1) + 1) it already works.parse_commandfolds the rest of the first expression withfold_rhsand then callsparse_command_args, which only starts at an expression, so the comma before the next argument was left over and ended the statement. The comma is now consumed first, like theprint (a, b) in arr, ...branch does, with the same "Expected next argument!" error for a trailing comma.print (1,2), 3is still rejected (CommandDoubleCall), as in gawk.Test
print_list_after_a_parenthesized_first_expression(fails on main).cargo test --workspace: 219 pass (218 on main), clippy clean. Thirteen print forms around this (ternary, concatenation, arithmetic,in, trailing comma,(a,b), c) give gawk's output or, where gawk errors, an error.