Using Boolean expressions as arguments on Xtext -
i'm trying create grammar on xtext allows pass boolean expression argument special function gets only boolean parameters (implicitly, without declaring it's boolean type).
for example:
somefunction(...){ foo(4>3, a==b) } foo(arg1,arg2) { //do arg1 , arg2 }
do have simple example demonstrates how it?
thank you.
from question not quite clear actual problem is.
if building grammar expression: use starting point
expression: orexpression ; orexpression returns expression: andexpression ({orexpression.left=current} "||" right=andexpression)* ; andexpression returns expression: comparisonexpression ({andexpression.left=current} "&&" right=comparisonexpression)* ; comparisonexpression returns expression: primaryexpression ({comparisonexpression.left=current} operator=("<"|"<="|"=="|">="|">") right=primaryexpression)* ; primaryexpression returns expression: "(" expression ")" | literal ; literal returns expression: {literal} value="true" | "false" | int ;
see insights https://typefox.io/parsing-expressions-with-xtext
if building typesystem have @ http://xsemantics.sourceforge.net/
Comments
Post a Comment