To indicate that a particular parse expression may be empty, pyparsing
includes the Optional element.
Change:
pp.delimitedList(withquotes | withoutquotes) + \
to:
pp.Optional( pp.delimitedList(withquotes | withoutquotes) ) + \
and I think this will have the desired effect.
-- Paul
wrote in m
[python 2.3.3, pyparsing 1.3]
I have:
def unpack_sql_array(s):
# unpack a postgres "array", e.g. "{'w1','w2','w3'}" into a
list(str)
import pyparsing as pp
withquotes = pp.dblQuotedString.setParseAction(pp.removeQuotes)
withoutquotes = pp.CharsNotIn('",{}')
parser = pp.StringS