frawk icon indicating copy to clipboard operation
frawk copied to clipboard

Mininal awk code with omitted {} or ; does not work

Open ghuls opened this issue 4 years ago • 1 comments

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.

ghuls avatar Feb 05 '21 13:02 ghuls

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.

ezrosent avatar Feb 06 '21 04:02 ezrosent