Andreas Matthias
2014-08-28 21:56:38 UTC
The following example works as expected. But if I uncomment the
line ``p.setParseAction(foo)'' I get the error:
pyparsing.ParseException: Expected start of line (at char 1), (line:1, col:1)
I do not understand what's going on here. Any help?
Ciao
Andreas
import pyparsing as pypa
p = \
pypa.LineStart() + \
pypa.OneOrMore( pypa.Literal('a').setWhitespaceChars(' ') ) + \
pypa.LineEnd()
def foo (t):
print(t)
#p.setParseAction(foo)
g = pypa.Literal('b') + p
res = g.parseString('''b
a a
a
''')
print(res)
line ``p.setParseAction(foo)'' I get the error:
pyparsing.ParseException: Expected start of line (at char 1), (line:1, col:1)
I do not understand what's going on here. Any help?
Ciao
Andreas
import pyparsing as pypa
p = \
pypa.LineStart() + \
pypa.OneOrMore( pypa.Literal('a').setWhitespaceChars(' ') ) + \
pypa.LineEnd()
def foo (t):
print(t)
#p.setParseAction(foo)
g = pypa.Literal('b') + p
res = g.parseString('''b
a a
a
''')
print(res)