Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Terminal rules vs parser rules priority
Terminal rules vs parser rules priority [message #1805722] Mon, 22 April 2019 14:16
Eclipse UserFriend
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:Provide Quick-fix for unrelated object while validation
Next Topic:XText 2.17 + eclipse 2019-03 + maven build problem
Goto Forum:
  


Current Time: Fri Mar 21 02:55:00 EDT 2025

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

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

Back to the top