2
我正在使用http://pyparsing.wikispaces.com/file/view/ebnf.py来转换我的ebnf定义。用ebnf和空格进行pyparsing
EBNF高清看起来是这样的:
TEST = A, SPACE, A;
A = "AA" | "BB";
SPACE = " ";
如果我加载文件,并尝试解析像一个字符串:
e = ebnf.parse(ebnf_file)
e['TEST'].leaveWhitespace().parseString('AA BB') # same without leaveWhitespace()
我得到:
ParseException: Expected " " (at char 3), (line:1, col:4)
有谁知道一个想法/解决方案?
看来工作,非常感谢。 – kelvan