|
|
|
|
|
|
Re: xtext add cross reference in expression [message #1742506 is a reply to message #1742504] |
Fri, 02 September 2016 13:25 |
Sachin Samaram Messages: 271 Registered: April 2016 |
Senior Member |
|
|
Call: 'call' procRef=[Proc] callExp=CompleteExpression?;
Proc: ('string'|'double')? 'proc' name=ID procExp=CompleteExpression?;
OpenAssignment: args+=Assignment ','?;
Assignment: name=('math')? (precision=Precision)? (assignExp+=Expression) (=>'=' assignExp+=Expression);
Precision: (width=NUMBER)|((width=NUMBER)?'.'(decimal_places=NUMBER));
ArrayDecl : {ArrayDecl} ('[' ']') | ('[' size=CompleteExpression ']');
Parenthesis : {Parenthesis} ('(' ')') | ('(' size=CompleteExpression ')');
Initialize : {Initialize} ('{' '}')|('{' args=CompleteExpression '}');
Expression:
LogicalOr
;
LogicalOr returns Expression:
BitwiseOr ({LogicalOr.left=current} '||' right=BitwiseOr)*
;
BitwiseOr returns Expression:
LogicalAnd ({BitwiseOr.left=current} '|' right=LogicalAnd)*
;
LogicalAnd returns Expression:
BitwiseAnd ({LogicalAnd.left=current} '&&' right=BitwiseAnd)*
;
BitwiseAnd returns Expression:
Equivalency ({BitwiseAnd.left=current} '&' right=Equivalency)*
;
Equivalency returns Expression:
Relational ({Equivalency.left=current} ('=='|'!=') right=Relational)*
;
Relational returns Expression:
PlusMinus ({Relational.left=current} ('>='|'<='|'>'|'<') right=PlusMinus)*
;
PlusMinus returns Expression:
DivMult ({PlusMinus.left=current} ('+'|'-') right=DivMult)*
//DivMult | ({PlusMinus} ('+'|'-') expr=DivMult)
;
DivMult returns Expression:
LogicalNot ({DivMult.left=current} ('/'|'*') right=LogicalNot)*
;
LogicalNot returns Expression:
//OnesComplement ({LogicalNot.left=current} ('!') right=LogicalNot)*
OnesComplement | ({LogicalNot} ('!') expr=OnesComplement)
;
OnesComplement returns Expression:
Exponentiation ({OnesComplement.left=current} ('~') right=Exponentiation)*
;
Exponentiation returns Expression:
ColonOperator ({Exponentialtion.left=current} '^' right=ColonOperator)*
;
ColonOperator returns Expression:
PercentOperator | ({ColonOperator} (':'('+')?) expr=PercentOperator)
;
PercentOperator returns Expression:
ArrowExpression | ({PercentOperator} ('%'|'%t'|'%.'|'%:') expr=ArrowExpression)
;
ArrowExpression returns Expression:
Concatenation ({ArrowExpression.left=current} '->' right=Concatenation)*
;
Concatenation returns Expression:
Primary ({Concatenation.left=current} '##' right=Primary)*
;
Primary returns Expression: {Expression}
('+'|'-')? name=NUMBER | name=STRING | name=ID (ArrayDecl=ArrayDecl? & Parenthesis=Parenthesis?) |
ArrayDecl=ArrayDecl | Parenthesis=Parenthesis | Initialize=Initialize | LibraryFunc=LibraryFunc
;
GSD returns Expression: name=ID {GSD.left=current} ('[' occurence=(NUMBER|STRING) ']')?('(' m=NUMBER (',' (n=NUMBER))? ')')? '->' right=ID;
CompleteExpression:
CompleteExpression+=Expression (','? CompleteExpression+=Expression)*
;
terminal DBMS: ('DBMS'|'Dbms'|'dbms') (('\\'((' '|'\t')* '\r'? '\n')) | !('\n' | '\r'))*;
terminal ID : ((':'('+')?)?|('+'|'-')?)('a'..'z'|'A'..'Z'|'$'|'.'|'@'|'_')('a'..'z'|'A'..'Z'|'$'|'.'|'0'..'9'|'@'|'*'|'_'|'!')*;
terminal STRING : '"' ( '\\'('"'|('\r'? '\n')) | !('\n'|'"') )* '"' |
"'" ( '\\'("'"|('\r'? '\n')) | !('\n'|"'") )* "'";
terminal SL_COMMENT: '//' !('\n' | '\r')*;
terminal HASH_COMMENT : ('#'('\r'? '\n')?) | ('#' !('#'|'\n'|'\r')+ ('\r'? '\n')?) | (('#''#''#') !('\n'|'\r')* ('\r'? '\n')?);
terminal WS : (' '|'\t'| ('\\'((' '|'\t')* '\r'? '\n')))+;
terminal NL : ('\r'? '\n')+;
terminal NUMBER: (OCTAL|FLOAT|INT|BINARY|HEX);
terminal OCTAL returns ecore::EInt: ('0') ('0'..'7')+;
terminal FLOAT returns ecore::EFloat: ('0'..'9' ('0'..'9')*) '.' ('0'..'9')*;
terminal INT returns ecore::EInt: '0'..'9' ('0'..'9')*;
terminal RANGE: '0'..'9' '..' ('0'..'9')*;
terminal BINARY returns ecore::EInt: ('0b'|'0B') ('0'|'1')+;
terminal HEX returns ecore::EInt:('0x'|'0X')('0'..'9'|'a'..'f'|'A'..'F')+;
[Updated on: Fri, 02 September 2016 13:26] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.53854 seconds