You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "vieiro (via GitHub)" <gi...@apache.org> on 2023/04/20 15:45:12 UTC

[GitHub] [netbeans] vieiro commented on a diff in pull request #5854: HCL fix compound expression grammar

vieiro commented on code in PR #5854:
URL: https://github.com/apache/netbeans/pull/5854#discussion_r1172782152


##########
ide/languages.hcl/src/org/netbeans/modules/languages/hcl/grammar/g4/HCLExpressionParser.g4:
##########
@@ -21,8 +21,9 @@ options { tokenVocab = HCLLexer; }
 
 expression
     : exprTerm
-    | operation
-    | <assoc=right> expression QUESTION expression COLON expression
+    | <assoc=right> unaryOperator expression
+    | expression binaryOperator expression

Review Comment:
   As far as I recall the order of entries here is what decides operator precedence. You may want to change:
   
   ```
   | expression binaryOperator expression
   ```
   
   Into
   
   ```
   | expression orOperator expression
   | expression andOperator expression
   | expression eqOp expression
   | expression compOp expression
   (etc)
   ```
   
   Following the operator precedence table at https://github.com/hashicorp/hcl/issues/553 
   
   Otherwise the expression "1 + 2 / 3" may have different results.
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists