Next / Previous / Contents / Shipman's homepage

5.9. Empty: Match empty content

pp.Empty()

The constructor returns a parser that always matches, and consumes no input. It can be used as a placeholder where a parser is required but you don't want it to match anything.

>>> e=pp.Empty()
>>> print e.parseString('')
[]
>>> print e.parseString('shrubber')
[]
>>> print e.parseString('shrubber', parseAll=True)
pyparsing.ParseException: Expected end of text (at char 0), (line:1, col:1)