这是我要解析的文档:
Tha Dhi Thom Num ThaKaThaRiKiTaThaKa
ThaKaThaRiKiTaThaKa = Ta Tha Chap Tha Ki Ta Tha Ka
我已经将语法定义如下:
@start = expr;
expr = singleExpr+ phraseDictionary*;
singleExpr = aksharaGroup;
phraseDictionary = phrase '='! aksharaGroup;
phrase = Word;
aksharaGroup = akshara+ ('/'! noteDuration)?;
akshara = tha | dhi | thom | num | ki | ta | ka | chap | phrase;
noteDuration = Number;
tha = 'Tha';
dhi = 'Dhi';
thom = 'Thom';
num = 'Num';
ki = 'Ki';
ta = 'Ta';
ka = 'Ka';
chap = 'Chap';
我遇到问题的部分是短语字典 - 第二个 ThaKaThaRiKiTaThaKa 被解析为短语,akshara 和 aksharaGroup,正如预期的那样,但是我得到了我希望它匹配它的异常短语字典
Expected : /
Line : 2
Near : = Ta
Found : =
Expected : Uppercase Word
Line : 2
Near : = Ta
Found : =
Expected : «EOF»
Line : 2
Near : = Ta
Found : =
使用 ParseKit 的无限前瞻,它不应该继续并匹配短语字典语法吗?
我错过了什么?
谢谢, 斯里达尔