summaryrefslogtreecommitdiff
path: root/examples/jsonParser.py
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2018-12-22 09:28:48 -0800
committerJon Dufresne <jon.dufresne@gmail.com>2018-12-22 13:46:56 -0800
commitde8326d00dffdb500c02839a98330b869c2457f3 (patch)
tree6c5fdae41cf8b335ff1c64f37856786523e4fd0d /examples/jsonParser.py
parent59dfd314c23fd653271bdad37631f0497e8ad748 (diff)
downloadpyparsing-git-de8326d00dffdb500c02839a98330b869c2457f3.tar.gz
Trim trailing white space throughout the project
Many editors clean up trailing white space on save. By removing it all in one go, it helps keep future diffs cleaner by avoiding spurious white space changes on unrelated lines.
Diffstat (limited to 'examples/jsonParser.py')
-rw-r--r--examples/jsonParser.py32
1 files changed, 15 insertions, 17 deletions
diff --git a/examples/jsonParser.py b/examples/jsonParser.py
index f080c6c..6319c36 100644
--- a/examples/jsonParser.py
+++ b/examples/jsonParser.py
@@ -11,19 +11,19 @@
# Updated 9 Aug 2016 - use more current pyparsing constructs/idioms
#
json_bnf = """
-object
- { members }
- {}
-members
- string : value
- members , string : value
-array
+object
+ { members }
+ {}
+members
+ string : value
+ members , string : value
+array
[ elements ]
- []
-elements
- value
- elements , value
-value
+ []
+elements
+ value
+ elements , value
+value
string
number
object
@@ -55,10 +55,10 @@ memberDef = Group(jsonString + COLON + jsonValue)
jsonMembers = delimitedList(memberDef)
jsonObject << Dict(LBRACE + Optional(jsonMembers) + RBRACE)
-jsonComment = cppStyleComment
+jsonComment = cppStyleComment
jsonObject.ignore(jsonComment)
-
+
if __name__ == "__main__":
testdata = """
{
@@ -66,7 +66,7 @@ if __name__ == "__main__":
"title": "example glossary",
"GlossDiv": {
"title": "S",
- "GlossList":
+ "GlossList":
{
"ID": "SGML",
"SortAs": "SGML",
@@ -103,5 +103,3 @@ if __name__ == "__main__":
testPrint( results.glossary.GlossDiv.GlossList.Acronym )
testPrint( results.glossary.GlossDiv.GlossList.EvenPrimesGreaterThan2 )
testPrint( results.glossary.GlossDiv.GlossList.PrimesLessThan10 )
-
-