diff options
author | Paul McGuire <ptmcg@austin.rr.com> | 2015-12-31 00:55:47 +0000 |
---|---|---|
committer | Paul McGuire <ptmcg@austin.rr.com> | 2015-12-31 00:55:47 +0000 |
commit | 401ba4a945b88f12e26495a82d4059d4adbaec92 (patch) | |
tree | 9570287813d7358750ddd1ffe50ba60c0a999972 /src/examples/jsonParser.py | |
parent | c8e8c6592d625d24bc7c0ca34bcc527ec380c2d5 (diff) | |
download | pyparsing-git-401ba4a945b88f12e26495a82d4059d4adbaec92.tar.gz |
Added new example parseTabularData.py
Updated several examples to more current Python and pyparsing practices (and better Py2/Py3 cross-compatibility)
Diffstat (limited to 'src/examples/jsonParser.py')
-rw-r--r-- | src/examples/jsonParser.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/examples/jsonParser.py b/src/examples/jsonParser.py index 5149b22..45cdef3 100644 --- a/src/examples/jsonParser.py +++ b/src/examples/jsonParser.py @@ -45,7 +45,7 @@ jsonNumber = Combine( Optional('-') + ( '0' | Word('123456789',nums) ) + jsonObject = Forward()
jsonValue = Forward()
jsonElements = delimitedList( jsonValue )
-jsonArray = Group(Suppress('[') + Optional(jsonElements) + Suppress(']') )
+jsonArray = Group(Suppress('[') + Optional(jsonElements, []) + Suppress(']') )
jsonValue << ( jsonString | jsonNumber | Group(jsonObject) | jsonArray | TRUE | FALSE | NULL )
memberDef = Group( jsonString + Suppress(':') + jsonValue )
jsonMembers = delimitedList( memberDef )
|