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

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

For that I have written grammar,


Statements : Greeting|HASH_COMMENT;

'Hello' exp=Expression '!';

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 '##',


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: Sun May 28 23:39:50 GMT 2023

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

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

Back to the top