diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2018-12-22 09:28:48 -0800 |
---|---|---|
committer | Jon Dufresne <jon.dufresne@gmail.com> | 2018-12-22 13:46:56 -0800 |
commit | de8326d00dffdb500c02839a98330b869c2457f3 (patch) | |
tree | 6c5fdae41cf8b335ff1c64f37856786523e4fd0d /examples/pythonGrammarParser.py | |
parent | 59dfd314c23fd653271bdad37631f0497e8ad748 (diff) | |
download | pyparsing-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/pythonGrammarParser.py')
-rw-r--r-- | examples/pythonGrammarParser.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/examples/pythonGrammarParser.py b/examples/pythonGrammarParser.py index 706f758..aed6bbe 100644 --- a/examples/pythonGrammarParser.py +++ b/examples/pythonGrammarParser.py @@ -5,7 +5,7 @@ from pyparsing import *
-# should probably read this from the Grammar file provided with the Python source, but
+# should probably read this from the Grammar file provided with the Python source, but
# this just skips that step and inlines the bnf text directly - this grammar was taken from
# Python 2.4.1
#
@@ -135,15 +135,15 @@ class SemanticGroup(object): self.contents = contents
while self.contents[-1].__class__ == self.__class__:
self.contents = self.contents[:-1] + self.contents[-1].contents
-
+
def __str__(self):
- return "{}({})".format(self.label,
+ return "{}({})".format(self.label,
" ".join([isinstance(c,str) and c or str(c) for c in self.contents]) )
-
+
class OrList(SemanticGroup):
label = "OR"
pass
-
+
class AndList(SemanticGroup):
label = "AND"
pass
@@ -151,7 +151,7 @@ class AndList(SemanticGroup): class OptionalGroup(SemanticGroup):
label = "OPT"
pass
-
+
class Atom(SemanticGroup):
def __init__(self,contents):
if len(contents) > 1:
@@ -162,10 +162,10 @@ class Atom(SemanticGroup): self.contents = contents
else:
self.contents = contents[0]
-
+
def __str__(self):
return "{}{}".format(self.rep, self.contents)
-
+
def makeGroupObject(cls):
def groupAction(s,l,t):
try:
|