summaryrefslogtreecommitdiff
path: root/examples/decaf_parser.py
diff options
context:
space:
mode:
authorptmcg <ptmcg@austin.rr.com>2019-01-30 20:41:33 -0600
committerptmcg <ptmcg@austin.rr.com>2019-01-30 20:41:33 -0600
commit3157a77c9584a69839db0f8274c87438b912e99b (patch)
tree5e93a6e21715f9afcbc55eba56f4a5f962b67a46 /examples/decaf_parser.py
parentf10a02039a6039f8a42b0cc99bea51623676cf01 (diff)
downloadpyparsing-git-3157a77c9584a69839db0f8274c87438b912e99b.tar.gz
Update examples and unit tests to more preferred coding styles, imports for pyparsing_common as ppc and pyparsing_unicode as ppu
Diffstat (limited to 'examples/decaf_parser.py')
-rw-r--r--examples/decaf_parser.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/decaf_parser.py b/examples/decaf_parser.py
index c3574b3..e6b1abb 100644
--- a/examples/decaf_parser.py
+++ b/examples/decaf_parser.py
@@ -41,6 +41,7 @@
Constant ::= intConstant | doubleConstant | boolConstant | stringConstant | null
"""
import pyparsing as pp
+from pyparsing import pyparsing_common as ppc
pp.ParserElement.enablePackrat()
# keywords
@@ -52,8 +53,8 @@ keywords = pp.MatchFirst(list(keywords))
LPAR, RPAR, LBRACE, RBRACE, LBRACK, RBRACK, DOT, EQ, COMMA, SEMI = map(pp.Suppress, "(){}[].=,;")
hexConstant = pp.Regex(r"0[xX][0-9a-fA-F]+").addParseAction(lambda t: int(t[0][2:], 16))
-intConstant = hexConstant | pp.pyparsing_common.integer
-doubleConstant = pp.pyparsing_common.real
+intConstant = hexConstant | ppc.integer
+doubleConstant = ppc.real
boolConstant = TRUE | FALSE
stringConstant = pp.dblQuotedString
null = NULL