Xtext内容辅助配置

时间:2017-01-20 13:38:09

标签: java dsl xtext xtend

我希望内容辅助建议已在脚本中声明的变量名称。这是语法:

jetty-ant

Script: includes+=(Include)* assignments+=(Assignment)* g=GetLog? clock=Clock? tests+=Test* ; Include: 'INCLUDE' includedScript=[Script|STRING] ; Test: 'RUN' "(" name=STRING "," com=STRING "," association=STRING ")" '{' instructions+=Instruction* '}' ; Instruction: Set | Get | Verify | Execute | Wait | Print | Time | SetTime | PowerDown | PowerUp | GetIp | GetLog Set: 'SET' '(' attribute=AttributeRef ',' value=(AttributeValue ) ')' ; Get : 'GET' '(' attribute=AttributeRef ')' ; AttributeRef: cosem=IDValue "." attributeRef =IDValue ; 部分中的cosem必须已经在之前宣布过。

例如,在此脚本中,当点击“关税”时,内容辅助会显示“TarifficationScriptTable”

AttributeRef

1 个答案:

答案 0 :(得分:2)

这是交叉引用的目的。你已经将它们用于脚本了。他们看起来像

nameOfTheReference=[TypeYouWantToReference]

实际上是

的缩写
nameOfTheReference=[TypeYouWantToReference|ID]

表示“引用TypeYouWantToReference并解析ID”

如果您有另一个应该解析的规则,您可以使用

nameOfTheReference=[TypeYouWantToReference|OtherRULE]