From 3157a77c9584a69839db0f8274c87438b912e99b Mon Sep 17 00:00:00 2001 From: ptmcg Date: Wed, 30 Jan 2019 20:41:33 -0600 Subject: Update examples and unit tests to more preferred coding styles, imports for pyparsing_common as ppc and pyparsing_unicode as ppu --- examples/simpleSQL.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'examples/simpleSQL.py') diff --git a/examples/simpleSQL.py b/examples/simpleSQL.py index c64a022..57cb251 100644 --- a/examples/simpleSQL.py +++ b/examples/simpleSQL.py @@ -7,7 +7,7 @@ # from pyparsing import Word, delimitedList, Optional, \ Group, alphas, alphanums, Forward, oneOf, quotedString, \ - ZeroOrMore, restOfLine, CaselessKeyword, pyparsing_common + ZeroOrMore, restOfLine, CaselessKeyword, pyparsing_common as ppc # define SQL tokens selectStmt = Forward() @@ -15,18 +15,18 @@ SELECT, FROM, WHERE = map(CaselessKeyword, "select from where".split()) ident = Word( alphas, alphanums + "_$" ).setName("identifier") columnName = delimitedList(ident, ".", combine=True).setName("column name") -columnName.addParseAction(pyparsing_common.upcaseTokens) +columnName.addParseAction(ppc.upcaseTokens) columnNameList = Group( delimitedList(columnName)) tableName = delimitedList(ident, ".", combine=True).setName("table name") -tableName.addParseAction(pyparsing_common.upcaseTokens) +tableName.addParseAction(ppc.upcaseTokens) tableNameList = Group(delimitedList(tableName)) whereExpression = Forward() and_, or_, in_ = map(CaselessKeyword, "and or in".split()) binop = oneOf("= != < > >= <= eq ne lt le gt ge", caseless=True) -realNum = pyparsing_common.real() -intNum = pyparsing_common.signed_integer() +realNum = ppc.real() +intNum = ppc.signed_integer() columnRval = realNum | intNum | quotedString | columnName # need to add support for alg expressions whereCondition = Group( -- cgit v1.2.1