From 7495b8f797419780718394a8597d493e9e839f06 Mon Sep 17 00:00:00 2001 From: ptmcg Date: Thu, 15 Sep 2016 06:01:28 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/pyparsing/code/trunk@441 9bf210a0-9d2d-494c-87cf-cfb32e7dff7b --- src/examples/simpleSQL.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/examples/simpleSQL.py b/src/examples/simpleSQL.py index 7bbd4cd..09c028e 100644 --- a/src/examples/simpleSQL.py +++ b/src/examples/simpleSQL.py @@ -7,7 +7,7 @@ # from pyparsing import Literal, CaselessLiteral, Word, delimitedList, Optional, \ Combine, Group, alphas, nums, alphanums, ParseException, Forward, oneOf, quotedString, \ - ZeroOrMore, restOfLine, Keyword, upcaseTokens + ZeroOrMore, restOfLine, Keyword, upcaseTokens, pyparsing_common # define SQL tokens selectStmt = Forward() @@ -26,14 +26,9 @@ and_ = Keyword("and", caseless=True) or_ = Keyword("or", caseless=True) in_ = Keyword("in", caseless=True) -E = CaselessLiteral("E") binop = oneOf("= != < > >= <= eq ne lt le gt ge", caseless=True) -arithSign = Word("+-",exact=1) -realNum = Combine( Optional(arithSign) + ( Word( nums ) + "." + Optional( Word(nums) ) | - ( "." + Word(nums) ) ) + - Optional( E + Optional(arithSign) + Word(nums) ) ) -intNum = Combine( Optional(arithSign) + Word( nums ) + - Optional( E + Optional("+") + Word(nums) ) ) +realNum = pyparsing_common.real() +intNum = pyparsing_common.signed_integer() columnRval = realNum | intNum | quotedString | columnName # need to add support for alg expressions whereCondition = Group( -- cgit v1.2.1