Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » xtext keyword problem(xtext keyword problem)
xtext keyword problem [message #1743419] Thu, 15 September 2016 09:58 Go to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
Hi,

I have call statement which accepts "RETURN" statement in it. But when I am using return inside it showing error:

index.php/fa/27078/0/

Can anyone help me how to get rid the error if I use return in call?

Minimal grammar to reproduce the problem:

Model: {Model} NL* statements+=Statement*;

Statement: (NonRecursingStatement) ';'? NL+ | HASH_COMMENT NL*;

NonRecursingStatement returns Statement:
( Call|Return
)
;

Call: 'call' procRef=ID callExp=CompleteExpression?;

Return: name=('return'|'retvar') (returnExp+=Expression (','? returnExp+=Expression)*)?;

ArrayDecl : {ArrayDecl} ('[' size=CompleteExpression? ']');

Parenthesis : {Parenthesis} ('(' size=CompleteExpression? ')');

Initialize : {Initialize} ('{' args=CompleteExpression? '}');

Expression:
Primary
;
Primary returns Expression: {Expression}
('+'|'-')? name=NUMBER | name=STRING | name=ID (ArrayDecl=ArrayDecl? & Parenthesis=Parenthesis?) | ArrayDecl=ArrayDecl | Parenthesis=Parenthesis | Initialize=Initialize
;

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: Thu, 15 September 2016 13:19]

Report message to a moderator

Re: xtext keyword problem [message #1743430 is a reply to message #1743419] Thu, 15 September 2016 12:03 Go to previous message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 250
Registered: June 2013
Senior Member
you may find some hints at:
https://blogs.itemis.com/en/xtext-hint-identifiers-conflicting-with-keywords
Previous Topic:Maven plug-in for generate code in xText 2.10.0
Next Topic:How to use @Flaky annotation
Goto Forum:
  


Current Time: Thu Apr 22 11:58:39 GMT 2021

Powered by FUDForum. Page generated in 0.01562 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top