"文字不在预期列"。 Pyparsing bug?

时间:2014-12-03 06:46:47

标签: python pyparsing

我在这里摸不着头脑:

当我这样做时,我没有遇到任何问题:

>>> import pyparsing as pp
>>> line1 = pp.Word(pp.nums) + pp.GoToColumn(5)
>>> line1.parseString('1    ')  # four spaces after 1
(['1', ''], {})

但是,当我在其间添加pp.Empty()时,解析失败:

>>> line1 = pp.Word(pp.nums) + pp.Empty() + pp.GoToColumn(5)
>>> line1.parseString('1    ')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\pyparsing.py", line 1111, in parseString
    raise exc
pyparsing.ParseException: Text not in expected column (at char 5), (line:1, col:6)

为什么会这样?这是一个Pyparsing bug吗? 感谢。

0 个答案:

没有答案