我正在尝试定义一个允许
[Foo]-[Bar]-[Baz][X]-[Y][Z]
我想将其解析为一组。
我目前有
语法样本;
items : (item association? item?)*;
item : LBRACK ID RBRACK;
association : ASSOCIATION;
RBRACK : ']';
LBRACK : '[';
ASSOCIATION : '-';
ID : ('a'..'z' | 'A'..'Z' | '_')*;
但这给出了一个错误
warning(200): Sample.g:3:30: Decision can match input such as
"LBRACK ID RBRACK" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
作为一个图表,我得到
我得到了这张铁路图
我怎样才能解决这个问题?