mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-16 04:47:18 +08:00
Allow negative numbers in ddl2cpp
This commit is contained in:
parent
e25ae64909
commit
f16643a1a0
@ -30,7 +30,7 @@ import sys
|
|||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from pyparsing import CaselessLiteral, SkipTo, restOfLine, oneOf, ZeroOrMore, Optional, \
|
from pyparsing import CaselessLiteral, Literal, SkipTo, restOfLine, oneOf, ZeroOrMore, Optional, Combine, \
|
||||||
WordStart, WordEnd, Word, alphas, alphanums, nums, QuotedString, nestedExpr, MatchFirst, OneOrMore, delimitedList, Or, Group
|
WordStart, WordEnd, Word, alphas, alphanums, nums, QuotedString, nestedExpr, MatchFirst, OneOrMore, delimitedList, Or, Group
|
||||||
|
|
||||||
INCLUDE = 'sqlpp11'
|
INCLUDE = 'sqlpp11'
|
||||||
@ -59,7 +59,8 @@ def ddlWord(string):
|
|||||||
return WordStart(alphanums + "_") + CaselessLiteral(string) + WordEnd(alphanums + "_")
|
return WordStart(alphanums + "_") + CaselessLiteral(string) + WordEnd(alphanums + "_")
|
||||||
|
|
||||||
ddlString = Or([QuotedString("'"), QuotedString("\"", escQuote='""'), QuotedString("`")])
|
ddlString = Or([QuotedString("'"), QuotedString("\"", escQuote='""'), QuotedString("`")])
|
||||||
ddlNum = Word(nums + ".")
|
negativeSign = Literal('-')
|
||||||
|
ddlNum = Combine(Optional(negativeSign) + Word(nums + "."))
|
||||||
ddlTerm = Word(alphas, alphanums + "_$")
|
ddlTerm = Word(alphas, alphanums + "_$")
|
||||||
ddlArguments = "(" + delimitedList(Or([ddlString, ddlTerm, ddlNum])) + ")"
|
ddlArguments = "(" + delimitedList(Or([ddlString, ddlTerm, ddlNum])) + ")"
|
||||||
ddlNotNull = Group(ddlWord("NOT") + ddlWord("NULL")).setResultsName("notNull")
|
ddlNotNull = Group(ddlWord("NOT") + ddlWord("NULL")).setResultsName("notNull")
|
||||||
|
Loading…
Reference in New Issue
Block a user