Xtext 内容辅助配置

Xtext Content assist configuration

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

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 是之前必须声明的部分。

例如,在此脚本中,当点击 Tariffication 时,内容辅助显示 TarifficationScriptTable

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



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

GET(Tariffi

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

nameOfTheReference=[TypeYouWantToReference]

实际上是 for

的缩写
nameOfTheReference=[TypeYouWantToReference|ID]

表示"reference a TypeYouWantToReferenceand parse an ID"

如果您有其他规则需要解析,您可以使用

nameOfTheReference=[TypeYouWantToReference|OtherRULE]