From de8326d00dffdb500c02839a98330b869c2457f3 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sat, 22 Dec 2018 09:28:48 -0800 Subject: 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. --- examples/pythonGrammarParser.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'examples/pythonGrammarParser.py') 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: -- cgit v1.2.1