Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Parsing *some* comments
Parsing *some* comments [message #1752953] Tue, 31 January 2017 09:32
Chris Bryan is currently offline Chris BryanFriend
Messages: 3
Registered: April 2016
Junior Member
I'm trying to parse a language where some (but not all) single-line comments are semantically important.

MyRule:
	comments+=SL_COMMENT*
	info=Revision
	comments+=SL_COMMENT*;

Revision:
	'--' 'Revision' INT;

terminal INT returns ecore::EInt:
	'-'? ('0'..'9' | '_')+;
terminal SL_COMMENT:
	'--' !('\n' | '\r')* NL?;
terminal NL:
	('\r'? '\n') (WS | '\r' | '\n')*;


SL_COMMENT is *not* hidden.

I was hoping that the '--' keyword in Revision would override the SL_COMMENT terminal at lexing, but this doesn't seem to be the case. Can anyone explain why?
Previous Topic:emfcompare and 'outline view' for DSL's defined using xtext
Next Topic:Xtext via Equinox without a UI component
Goto Forum:
  


Current Time: Wed Aug 23 21:56:20 GMT 2017

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

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