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

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:Provide Quick-fix for unrelated object while validation
Next Topic:XText 2.17 + eclipse 2019-03 + maven build problem
Goto Forum:

Current Time: Fri Sep 18 19:50:01 GMT 2020

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

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

Back to the top