Repository navigation
parser: read length without parentheses as length($0) - #144
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.
| #[test] | ||
| fn length_without_parentheses_is_length_of_record() { | ||
| ucmd() | ||
| .arg("length > 2 { print length, length / 2 } BEGIN { print length }") |
There was a problem hiding this comment.
could you please also cover length(/b/) and length $1 here?
the lexer change makes sure these keep working
There was a problem hiding this comment.
Added in f78f1fb: { print length(/b/), length $1 } on abc def and xyz gives 1 7abc and 1 3xyz, the same as gawk 5.3.2 (length $1 is length followed by $1, concatenated).
|
sorry, needs to be rebased! |
260c280 to
e4c7625
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.
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.
f78f1fb to
ba9cba5
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.
Alonely0
left a comment
There was a problem hiding this comment.
Good catch! Address the trivial conflicts on the test file whenever you have a moment, and we can merge this right away.
ba9cba5 to
4c3e241
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.
POSIX allows
lengthwithout an argument list, meaninglength($0). main only acceptslength(...), so the common one-liner fails:{ n += length },print length,length { ... }andx = lengthfail the same way.parse_atom_or_callnow buildslengthwith no arguments when no(follows; the interpreter already treats that aslength($0). The lexer giveslengthaccept_operator, solength / 2divides;length(/re/)is unchanged because(resets the context.New test
length_without_parentheses_is_length_of_recordfails without the change.cargo test --workspace: 211 passed (210 on main plus the new one), clippy and fmt clean. 18 forms (length > 3,length "x",length $1,length / 2,length - 1,length ~ /1/,length ($1),length(/a/),lengthat the end of a line, ...) print the same as gawk.