Parsing *some* comments [message #1752953] |
Tue, 31 January 2017 04:32 |
Eclipse User |
|
|
|
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?
|
|
|
Powered by
FUDForum. Page generated in 0.02755 seconds