Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
String Xtext从字符串中带引号,但单词之间仍有空格_String_Grammar_Xtext_Xtend - Fatal编程技术网

String Xtext从字符串中带引号,但单词之间仍有空格

String Xtext从字符串中带引号,但单词之间仍有空格,string,grammar,xtext,xtend,String,Grammar,Xtext,Xtend,我正在从事Xtext项目,我希望有一个语法,使我能够: 1.字符串中的字符串引号,例如:“字符串”->String 2.允许考虑以空间分隔为一个字符串的字符串块。 我希望有以下具体语法: fieldSet setname[ question what do you prefer to drink? [ cola, coda water, apple juice ] ] 正如您所见,“您喜欢喝什么”必须被视为一个字符串,不带引号。 目前,我做了一个自定义终端以及转换器。但它并没

我正在从事Xtext项目,我希望有一个语法,使我能够: 1.字符串中的字符串引号,例如:“字符串”->String 2.允许考虑以空间分隔为一个字符串的字符串块。

我希望有以下具体语法:

fieldSet setname[

question what do you prefer to drink? [
  cola,
  coda water,
  apple juice
  ]
]
正如您所见,“您喜欢喝什么”必须被视为一个字符串,不带引号。 目前,我做了一个自定义终端以及转换器。但它并没有像我想要的那样工作

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;

我猜你的语法是从普通语法继承来的,是吗?默认情况下,该语法隐藏空白

您可以将
hidden()
放在终端规则名称后面,以确保不会忽略其中的空白