diff options
author | ptmcg <ptmcg@austin.rr.com> | 2019-01-30 20:41:33 -0600 |
---|---|---|
committer | ptmcg <ptmcg@austin.rr.com> | 2019-01-30 20:41:33 -0600 |
commit | 3157a77c9584a69839db0f8274c87438b912e99b (patch) | |
tree | 5e93a6e21715f9afcbc55eba56f4a5f962b67a46 /examples/simpleSQL.py | |
parent | f10a02039a6039f8a42b0cc99bea51623676cf01 (diff) | |
download | pyparsing-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/simpleSQL.py')
-rw-r--r-- | examples/simpleSQL.py | 10 |
1 files changed, 5 insertions, 5 deletions
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(
|