Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext double hash comment(Xtext double hash comment)
Xtext double hash comment [message #1744240] Fri, 23 September 2016 14:45
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
Hi,

I have concatenation operator '##' and also # comment which can just starts with double hash '##'.

For that I have written grammar,

Model:
greetings+=(Statements)*;

Statements : Greeting|HASH_COMMENT;

Greeting:
'Hello' exp=Expression '!';

Expression:
Concatenation
;
Concatenation returns Expression:
Primary ({Concatenation.left=current} '##' right=Primary)*
;
Primary returns Expression: {Expression}
name=STRING | name=ID
;

terminal HASH_COMMENT : ('#'('\r'? '\n')?) | ('#' !('#'|'\n'|'\r')+ ('\r'? '\n')?) | (('#''#''#') !('\n'|'\r')* ('\r'? '\n')?);

But I am getting this error if I use '##',

index.php/fa/27189/0/

How to solve this? Always Concatenation gets consumed but I want to consume terminal rule if the '##' comes starting or end of a line not middle of any string or ID or etc..

[Updated on: Fri, 23 September 2016 14:48]

Report message to a moderator

Previous Topic:Register EPackage probelm "Couldn't find an interface"
Next Topic:Unable to use a declaration in assignments and if conditions
Goto Forum:
  


Current Time: Sat Apr 17 00:33:59 GMT 2021

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

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

Back to the top