xtext nested {} Decision 可以使用多个替代项来匹配输入,例如“'}'”
xtext nested {} Decision can match input such as "'}'" using multiple alternatives
我是 xtext (antlr) 的新手,不明白为什么 IconType '}' 和 WindowType '}' 之间有歧义。
我得到
warning(200): ../org.simsulla.tools.ui.gui/src-gen/org/simsulla/tools/ui/gui/parser/antlr/internal/InternalGui.g:137:1: Decision can match input such as "'windowType'" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
warning(200): ../org.simsulla.tools.ui.gui.ui/src-gen/org/simsulla/tools/ui/gui/ui/contentassist/antlr/internal/InternalGui.g:117:38: Decision can match input such as "'windowType' '=' '{' 'name' '=' RULE_ID 'iconType' '=' '{' 'name' '=' RULE_ID 'spriteType' '=' RULE_STRING 'Orientation' '=' RULE_STRING '}' '}'" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
这是我的语法
Ui:
guiTypes+=GuiTypes+;
GuiTypes:
windowType+=WindowType+
;
WindowType:
'windowType' '=' '{'
'name' '=' name=STRING
iconType+=IconType*
'}'
;
IconType:
'iconType' '=' '{'
'name' '=' name=STRING
'spriteType' '=' spriteType=STRING
'Orientation' '=' Orientation=STRING
'}'
;
语法片段有多种重复方式WindowType
:
- 从
Ui
派生到 GuiTypes
到多个 WindowType
实例,或
- 从
Ui
派生到多个 GuiTypes
实例,其中每个实例派生到 WindowType
,或
- 以上任意组合。
所以一个给定的输入对应于多个不同的解析树。因此语法有歧义。
我是 xtext (antlr) 的新手,不明白为什么 IconType '}' 和 WindowType '}' 之间有歧义。
我得到
warning(200): ../org.simsulla.tools.ui.gui/src-gen/org/simsulla/tools/ui/gui/parser/antlr/internal/InternalGui.g:137:1: Decision can match input such as "'windowType'" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
warning(200): ../org.simsulla.tools.ui.gui.ui/src-gen/org/simsulla/tools/ui/gui/ui/contentassist/antlr/internal/InternalGui.g:117:38: Decision can match input such as "'windowType' '=' '{' 'name' '=' RULE_ID 'iconType' '=' '{' 'name' '=' RULE_ID 'spriteType' '=' RULE_STRING 'Orientation' '=' RULE_STRING '}' '}'" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
这是我的语法
Ui:
guiTypes+=GuiTypes+;
GuiTypes:
windowType+=WindowType+
;
WindowType:
'windowType' '=' '{'
'name' '=' name=STRING
iconType+=IconType*
'}'
;
IconType:
'iconType' '=' '{'
'name' '=' name=STRING
'spriteType' '=' spriteType=STRING
'Orientation' '=' Orientation=STRING
'}'
;
语法片段有多种重复方式WindowType
:
- 从
Ui
派生到GuiTypes
到多个WindowType
实例,或 - 从
Ui
派生到多个GuiTypes
实例,其中每个实例派生到WindowType
,或 - 以上任意组合。
所以一个给定的输入对应于多个不同的解析树。因此语法有歧义。