I'm working on Xtext project and I want to have a grammar that would allow me to: 1. String quotes from strings, ex: "string" -> string 2. Allow to consider a string chunks separated with spaces as one string.
I would like to have a following concrete syntax:
fieldSet setname[
question what do you prefer to drink? [
cola,
coda water,
apple juice
]
]
As you can see 'what do you prefer to drink' has to be considered as one string without quotes. At the moment I made a custom terminal as well as converter. But it does not work as I want.
terminal QSTRING returns ecore::EString: //custom terminal SurveyString
('a'..'z'|'A'..'Z')('a'..'z' | 'A'..'Z' | '_' | '?' | '!'| '@'| '#' | '%' | '^' | '&' | '('|')'| '0'..'9'|' ')*;
FieldSet returns FieldSet:
'fieldSet' name=QSTRING
'['
question+=Question (',' question+=Question)*
']';
Question returns Question:
'question'
name=QSTRING
'[' has+=AnswerOption (',' has+=AnswerOption)*
(other?=('other'))?
']';
AnswerOption returns AnswerOption:
name=QSTRING;