Closed andremm closed 7 years ago
Really great work!! Line 16 should be changed to
Thanks for applying my PR and fixing my mistake. I haven't gone through tests, sorry, and going back and forth between C and Lua sometimes makes my eyes not see this kind of silly mistake. :)
@vsbenas In fact, I believe changing
elseif exp[1] then
to only
else
should also work.
Not so much a mistake, as a special case for when we have a partial AST due to errors in the input, thanks for the contribution.
2017-09-19 10:56 GMT-04:00 Andre Murbach Maidl notifications@github.com:
Really great work!! Line 16 should be changed to
Thanks for applying my PR and fixing my mistake. I haven't gone through tests, sorry, and going back and forth between C and Lua sometimes makes my eyes not see this kind of silly mistake. :)
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/vsbenas/parser-gen/pull/3#issuecomment-330566858, or mute the thread https://github.com/notifications/unsubscribe-auth/AZe9q-_G5vZVJn-nRM9Kz1MeM5iyX24Wks5sj9YqgaJpZM4Pcb0e .
@vsbenas In fact, I believe changing
elseif exp[1] then to only
else should also work.
@andremm
it was else
in your code, and that threw the runtime error, because the next line accesses exp[1].rule
but exp[1]
could be nil.
@andremm it was else in your code, and that threw the runtime error, because the next line accesses exp[1].rule but exp[1] could be nil.
Yeah, I realize now. :) Thanks!
This pull request makes two things: reduces a bit the size of expressions AST and fixes some small issues with operators associativity in the
lua-parser.lua
example.For instance,
return 2^3+1
was generating the following AST:After faking a
fold
with repetition and removing extra nodes I got the following AST:Regarding operators associativity, you were using repetition for some rules that should associate to the right:
So I just changed them to only use right recursion.