summaryrefslogtreecommitdiff
path: root/examples/pythonGrammarParser.py
diff options
context:
space:
mode:
authorptmcg <ptmcg@austin.rr.com>2019-01-09 17:18:22 -0600
committerptmcg <ptmcg@austin.rr.com>2019-01-09 17:18:22 -0600
commitd626c99b6288afc4708d72f668b45a29d3263d22 (patch)
tree4cbeca134437387022e59b71631246e178393aca /examples/pythonGrammarParser.py
parente9ef507bf1fd41d4bd3ffb0c193e5889254ba340 (diff)
downloadpyparsing-git-d626c99b6288afc4708d72f668b45a29d3263d22.tar.gz
Add enumerated place holders for strings that invoke str.format(), for Py2 compatibility
Diffstat (limited to 'examples/pythonGrammarParser.py')
-rw-r--r--examples/pythonGrammarParser.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/pythonGrammarParser.py b/examples/pythonGrammarParser.py
index ed6a484..4a8adce 100644
--- a/examples/pythonGrammarParser.py
+++ b/examples/pythonGrammarParser.py
@@ -137,7 +137,7 @@ class SemanticGroup(object):
self.contents = self.contents[:-1] + self.contents[-1].contents
def __str__(self):
- return "{}({})".format(self.label,
+ return "{0}({1})".format(self.label,
" ".join([isinstance(c,str) and c or str(c) for c in self.contents]) )
class OrList(SemanticGroup):
@@ -164,7 +164,7 @@ class Atom(SemanticGroup):
self.contents = contents[0]
def __str__(self):
- return "{}{}".format(self.rep, self.contents)
+ return "{0}{1}".format(self.rep, self.contents)
def makeGroupObject(cls):
def groupAction(s,l,t):