-
Notifications
You must be signed in to change notification settings - Fork 0
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
Not able to parse some real awk scripts #58
Comments
Hi, sorry we didn't notice the issue you registered. Let us look into this! |
Hi @xonixx We've just released version 3.1.00 of Jawk which fixes the operator precedence of the parser. It now strictly follows gawk. gron.awk now kind of works... except we're still encountering issues when parsing JSON objects (arrays seem to be fine). Could you please pinpoint what is going on and what is actually failing? echo [1, 2, 3] | java -jar target/jawk-3.1.00-standalone.jar -f src/test/resources/xonixx/gron.awk
json=[]
json[0]=1
json[1]=2
json[2]=3 But... echo {"a": 1} | java -jar target/jawk-3.1.00-standalone.jar -f src/test/res
ources/xonixx/gron.awk
Can't parse JSON at pos 2: a: 1} makesure.awk still doesn't work because we're missing a few gawk-specific funtions (non-POSIX), like java -jar target/jawk-3.1.00-standalone.jar -f src/test/resources/xonixx/makesure.awk
SemanticException: function org.sentrysoftware.jawk.frontend.AwkParser$FunctionProxy@593634ad (gettimeofday) not defined (src/test/resources/xonixx/makesure.awk:717) |
Thank you @bertysentry, excellent work! Sure, I’ll check when I have time. |
Regarding the missing function |
So here is one bug I've triaged so far:
|
One other bug please:
|
One more bug with the latest version:
|
Thanks @xonixx! That's a tough one... Let's see how we can fix this. It pertains to the order of execution of string concatenation. Probably... |
I believe it's a problem with the order of evaluation of sub-expressions. The actual bug in gron.awk is in form:
|
Nice! Couple more bugs with the fresh version: Bug 1
Bug 2
|
Thank you for spotting these issues, @xonixx! Bug 2 is actually related to #110. In AWK, whether strings should be converted to numbers isn't quite intuitive. Uninitialized variables are considered equal to zero (number), and Bug 1 is currently a limitation, where the parser doesn't now if we're printing to a file (using the |
I'm not sure how compatible this project aims to be. Out of curiosity I tried it on a couple of my projects: makesure and gron.awk:
Both of the scripts are compatible with gawk, bwk, mawk, busybox awk & goawk.
The text was updated successfully, but these errors were encountered: