Menu

#33 Complex `Combine` nodes not processed properly

closed-fixed
nobody
None
5
2010-06-25
2009-06-02
No

A `Combine` node with a complex subtree of nodes does not react properly to surrounding whitespace. Specifically, consider the following example:

{{{
from pyparsing import Literal, Combine

pair0 = (Literal('left') + Literal(':') +
(Combine(
(Literal('ri') + Literal('ght')) |
Literal('other'))))
pair1 = (Literal('left') + Literal(':') +
(Combine(
(Literal('ri') + Literal('ght'))) |
Combine(Literal('other'))))

print pair1.parseString('left :right')
print pair0.parseString('left :right')
print pair1.parseString('left : right')
print pair0.parseString('left : right')
}}}

The first three parse attempts work fine, but the last throws an exception; apparently the `Combine` node, when used in this type of situation, causes the parser to no longer skip whitespace between the colon and the following token.

Discussion

  • Paul McGuire

    Paul McGuire - 2010-06-24
    • status: open --> open-fixed
     
  • Paul McGuire

    Paul McGuire - 2010-06-24

    Fixed in 1.5.3

     
  • Paul McGuire

    Paul McGuire - 2010-06-25
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.