Hello,
I'm a complete newbie when it comes to Xtext and I have been trying to write my first grammar.
A valid input should look like:
param1="value1" param2="value2"
However I'm struggling to get it to work with the quotes around the values.
The grammar below works:
grammar com.abmyers.mydsl.MyDsl with org.eclipse.xtext.common.Terminals
generate myDsl "http://www.abmyers.com/mydsl/MyDsl"
Model:
attributes+=AttributePair*;
AttributePair:
name=ID '=' val=STRING;
But I wanted to capture the actual content of the string, without the quote marks and this is what I'm struggling with.
An example of what I've tried to do, but is failing is:
grammar com.abmyers.mydsl.MyDsl with org.eclipse.xtext.common.Terminals
generate myDsl "http://www.abmyers.com/mydsl/MyDsl"
Model:
attributes+=AttributePair*;
AttributePair:
name=ID '=' value=AttributeValue;
AttributeValue:
QUOTE VAL QUOTE
;
terminal QUOTE:
('"' | "'")
;
terminal VAL:
('a'..'z'|'0'..'1')*
;
If anyone could point me in the right direction I'd be extremely grateful.