|
Re: Parser wants spaces [message #1857920 is a reply to message #1857917] |
Mon, 06 March 2023 19:02 |
|
i assume you inherit from the terminals grammar. that one has an ID rule that matches aaaaaxxxa
=>
grammar org.xtext.example.mydsl1.MyDsl hidden(WS, ML_COMMENT, SL_COMMENT)
generate myDsl "http://www.xtext.org/example/mydsl1/MyDsl"
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
SWSyntax:
MultirowSyntaxitem = MultiSyntax;
MultiSyntax:
Syntaxitem (Syntaxitem)*;
Syntaxitem:
ALPHACHARACTERSET;
terminal ALPHACHARACTERSET: "a" | "x";
//terminal ID: '^'?('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*;
terminal INT returns ecore::EInt: ('0'..'9')+;
terminal STRING:
'"' ( '\\' . /* 'b'|'t'|'n'|'f'|'r'|'u'|'"'|"'"|'\\' */ | !('\\'|'"') )* '"' |
"'" ( '\\' . /* 'b'|'t'|'n'|'f'|'r'|'u'|'"'|"'"|'\\' */ | !('\\'|"'") )* "'"
;
terminal ML_COMMENT : '/*' -> '*/';
terminal SL_COMMENT : '//' !('\n'|'\r')* ('\r'? '\n')?;
terminal WS : (' '|'\t'|'\r'|'\n')+;
terminal ANY_OTHER: .;
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
|
|
|
|
Powered by
FUDForum. Page generated in 0.03401 seconds