Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Terminal rules vs parser rules priority
Terminal rules vs parser rules priority [message #1805722] Mon, 22 April 2019 18:16
Martin Rud is currently offline Martin RudFriend
Messages: 7
Registered: February 2019
Junior Member
Hi!

My language needs to support this kind of constructs:
apply()    // apply statement
$apply()   // comment
$apply ""  // apply statement (not a comment) 
$$apply "" // comment


I created the following grammar:
ApplyStmtA: name='apply' '('  ')';

ApplyStmtB: name=ApplyPRE ApplyPOST;

terminal ApplyPRE: '$apply';
terminal ApplyPOST: '"' '"'

terminal SL_COMMENT : ('// ' | '$')  !('\n'|'\r')* ('\r'? '\n')?;


When I write the third example from the first code snippet, that line is highlighted as a comment.
How can I handle this situation in Xtext?
Previous Topic:1001 tips and tricks for Xtext
Next Topic:XText 2.17 + eclipse 2019-03 + maven build problem
Goto Forum:
  


Current Time: Tue Oct 15 03:32:59 GMT 2019

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

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

Back to the top