我刚开始玩 PEG.js 并且遇到了语法问题(大大简化了调试):
start
= presingle single
/ preplural plural
presingle
= "a"
/ "b"
preplural
= "b"
/ "c"
single
= "d"
/ "e"
plural
= "dd"
/ "ee"
此语法无法解析bdd
。
Line 1, column 3: Expected "a" but "d" found.
这是 PEG 无法做到的事情,还是我可以将我的语法转换成可以解析它的东西?
PS如果我尝试解析(错误地建议?)bda
我得到无意义的错误:
Line 1, column 3: Expected "a" but "a" found.