-
-
Notifications
You must be signed in to change notification settings - Fork 84
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
Incorrect parsing of complex ++ expressions #79
Comments
I've started playing with this on the |
Can you walk through what is supposed to happen in 1? I don't understand it, sorry. |
gawk, original-awk, and mawk all print Whereas GoAWK parses it differently, so executes the inner So it's a parsing/precedence issue. Hope that helps! |
That helps a lot, thanks! |
Was this solved by the newest release? Specifically #172 |
@vegarsti No, unfortunately not -- this is a different issue. |
Okay! |
This also produces wrong results:
|
Fix incorrect parsing and compiling of complex ++ expressions. Needed to add a new Rote opcode to make this happen. In addition, fix similar evaluation issues with += and sub/gsub. Add new regression tests for all of the above.
Two cases:
echo 2 3 4 | goawk '{ $$0++; print $0 }'
prints2 4 4
instead of3
. I think this is happening because we parse this as($($0))++
rather than($($0++))
.BEGIN { $0="3 4 5 6 7 8 9"; a=3; print $$a++++; print }
gives a parsing error instead of printing7\n3 4 6 6 8 8 9
.There are two commented-out (TODO) tests in
interp/interp_test.go
for this, as well as a commented-out Gawk test (parse1
).The text was updated successfully, but these errors were encountered: