Java Xtext内容辅助配置

Java Xtext内容辅助配置,java,dsl,xtext,xtend,Java,Dsl,Xtext,Xtend,我希望内容辅助提示脚本中已经声明的变量的名称。这是语法: Script: includes+=(Include)* assignments+=(Assignment)* g=GetLog? clock=Clock? tests+=Test* ; Include: 'INCLUDE' includedScript=[Script|STRING] ; Test: 'RUN' "(" name=STRING "," com=STR

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

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

;
AttributeRef
部分中的
cosem
是必须在之前声明的

例如,在该脚本中,当录制Tarification时,内容辅助显示TarificationScriptTable

TarifficationScriptTable = COSEM(9,0,"0.0.10.0.100.255")



RUN("CheckConnectivity", "HDLC", "LOCAL_MANAGEMENT") {  

GET(Tariffi

这就是交叉引用的目的。您已经在脚本中使用它们了。他们看起来像

nameOfTheReference=[TypeYouWantToReference]
这实际上是

nameOfTheReference=[TypeYouWantToReference|ID]
这意味着“引用您想要引用的类型并解析ID”

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

nameOfTheReference=[TypeYouWantToReference|OtherRULE]

你的属性ref看起来怎么样?如果您正确地使用交叉引用并相应地实施范围界定(取决于您的用例),那么这将完全可行。我已将其添加到代码中为什么不使用交叉引用?因为我不知道我建议您如何熟悉交叉引用