diff --git a/CHANGELOG.md b/CHANGELOG.md index e5cb40d..80f1f1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ ## [Unreleased] +### Fixed + +- Fixed ternary expressions + ## [0.3.1] - 2023-12-16 ### Added diff --git a/src/main/grammars/SlintParser.bnf b/src/main/grammars/SlintParser.bnf index 17dde1e..5bd3e86 100644 --- a/src/main/grammars/SlintParser.bnf +++ b/src/main/grammars/SlintParser.bnf @@ -378,9 +378,9 @@ private ArrayAnonymousStruct ::= '[' AnonymousStructDeclaration? (',' (Anonymous ///////////////////////////////////////////////////////////////////////////////////////////////////// Expression ::= AssignmentExpression + | TernaryExpression | BinaryExpression | UnaryExpression - | TernaryExpression | CallBuiltinExpression | CallExpression | PropertyExpression @@ -431,10 +431,10 @@ UnaryOperators ::= AssignmentExpression ::= PropertyExpression EQ Expression { pin=3 } BinaryExpression ::= Expression Operators Expression { pin=3 } UnaryExpression ::= UnaryOperators Expression { pin=1 } -TernaryExpression ::= Expression '?' Expression ':' Expression { pin=3 } +TernaryExpression ::= Expression '?' Expression ':' Expression { pin=4 } CallExpression ::= PropertyExpression CallArgumentList { pin=1 } CallBuiltinExpression ::= BuiltinFunctions -ParenthesizedExpression ::= '(' Expression ')' { pin=1 } +ParenthesizedExpression ::= '(' Expression ')' { pin=3 } ArrayExpression ::= PropertyExpression '[' Expression ']' ArrayAnonymousStructExpression ::= ArrayAnonymousStruct AnonymousStructExpression ::= AnonymousStructDeclaration