Boolean expressions grammar [message #653739] |
Thu, 10 February 2011 17:26  |
Eclipse User |
|
|
|
Hello!
I have a problem with defining boolean expressions grammar.
Here it is (was made based on 'Simple arithmetics' example):
Model:
boolexprs+=BoolExpr*;
BoolExpr:
OrExpr;
OrExpr returns BoolExpr:
AndExpr ({Or.left=current} '||' right=AndExpr)*;
AndExpr returns BoolExpr:
PrimaryExpr ({And.left=current} '&&' right=PrimaryExpr)*;
PrimaryExpr returns BoolExpr:
'(' BoolExpr ')' | (name=ID);
Say, I have a code example like this:
a && (b || c)
When I work with BoolExprs during generation I can get their names (a, b, and c) but I don't have access to the types of logical relationships between them.
Please help me with modifying the grammar or Xpand hints so I can recover the information of boolean operations between the operands at the generation stage.
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.35274 seconds