frawk
frawk copied to clipboard
Mininal awk code with omitted {} or ; does not work
Mininal awk code with omitted {} or ; does not work:
❯ frawk 'BEGIN { if (1 == 1) print "yes" }'
Unrecognized token `}` found at line 1, column 33:line 1, column 34
Expected one of "\n" or ";"
❯ frawk 'BEGIN { if (1 == 1) { print "yes" } }'
yes
❯ frawk 'BEGIN { if (1 == 1) print "yes"; }'
yes
Personally I always use the second way, but a lot of awk code omits braces.
Thanks for filing this issue; I've run into this too when running other scripts. I tried to fix this once but never really got anywhere; It's been a while though so I'll try this again. There's nothing here that's super complicated, the parsing code is just a bit harder to modify than it ought to be.