Fix expression grammar to work with boolean functions#1144
Fix expression grammar to work with boolean functions#1144SteveL-MSFT merged 1 commit intoPowerShell:mainfrom
Conversation
andyleejordan
left a comment
There was a problem hiding this comment.
I think this LGTM though I'm not a tree-sitter expert and can't explain exactly how this automatically resolves true() and false() to true and false. Per the tests, it does. My guess is that it's a recursive evaluation of the $._booleanLiteral when it's the functionName.
The main change in the grammar to fix this is to ensure that |
498df6d to
0f02a4e
Compare
PR Summary
The grammar didn't allow for functions
true()andfalse()and only expected boolean argumentstrueandfalseso this resulted in a parsing error. Fix is to update the grammar with precedence for functions and booleans (in that order) so thattrue()andfalse()will be accepted as function names and not treated as booleans and thus invalidating the rest of the expression.Some of the invalid tests needed to be updated, but all still result in an error as expected.
PR Context
Fix #1136