help with pyparsing

Neal Becker ndbecker2 at gmail.com
Wed Oct 31 07:59:32 EDT 2007


I'm just trying out pyparsing.  I get stack overflow on my first try.  Any
help?

#/usr/bin/python

from pyparsing import Word, alphas, QuotedString, OneOrMore, delimitedList

first_line = '[' + delimitedList (QuotedString) + ']'

def main():
    string = '''[ 'a', 'b', 'cdef']'''
    greeting = first_line.parseString (string)
    print greeting

if __name__ == "__main__":
    main()

/usr/lib/python2.5/site-packages/pyparsing.py:2727: SyntaxWarning: Cannot
add element of type <type 'type'> to ParserElement
  return ( expr + ZeroOrMore( Suppress( delim ) + expr ) ).setName(dlName)
/usr/lib/python2.5/site-packages/pyparsing.py:1008: SyntaxWarning: Cannot
add element of type <type 'type'> to ParserElement
  return other + self
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/tmp/python-k3AVeY.py", line 5, in <module>
    first_line = '[' + delimitedList (QuotedString) + ']'
  File "/usr/lib/python2.5/site-packages/pyparsing.py", line 2727, in
delimitedList
    return ( expr + ZeroOrMore( Suppress( delim ) + expr ) ).setName(dlName)
  File "/usr/lib/python2.5/site-packages/pyparsing.py", line 1008, in
__radd__
    return other + self
  File "/usr/lib/python2.5/site-packages/pyparsing.py", line 1008, in
__radd__
    return other + self





More information about the Python-list mailing list