0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-16 04:47:18 +08:00
This commit is contained in:
strangeqargo 2016-05-05 02:40:44 +03:00
parent 42dfa6cddc
commit ffc2dd0f3c

View File

@ -81,15 +81,16 @@ if len(sys.argv) < (4):
firstPositional = 1
timestampWarning = True
failOnParse = True
failOnParse = False
warnOnParse = True
parseError = "parsing error, possible reason: can't parse default value for a field"
optionalArgs = {
# if -some-key is present, it will set variable someKey to True
# if -no-some-key is present, it will set variable someKey to False
'timestamp-warning', # timeStampWarning = True
# '-no-time-stamp-warning' # timeStampWarning = False
'fail-on-parse' # failOnParse = True
# 'no-fail-on-parse' # failOnParse = False
'warn-on-parse' # warnOnParse = True
}
@ -97,18 +98,27 @@ if len(sys.argv) >= 4:
for arg in sys.argv:
noArg = arg.replace('-no-', '')
print (noArg)
if arg in optionalArgs:
print ("AAAA")
print (noArg)
setArgumentBool(arg, True)
firstPositional += 1
elif noArg in optionalArgs:
print ("BBBB")
setArgumentBool(noArg, False)
firstPositional += 1
else:
print ("abcd")
print(arg)
#sys.exit(0)
pathToDdl = sys.argv[firstPositional]
pathToHeader = sys.argv[firstPositional + 1] + '.h'
namespace = sys.argv[firstPositional + 2]
print (pathToDdl)
sys.exit(0)
INCLUDE = 'sqlpp11'
NAMESPACE = 'sqlpp'
@ -173,17 +183,20 @@ if failOnParse:
try:
tableCreations = ddl.parseFile(pathToDdl)
except ParseException as e:
print("parsing error, possible reason: can't parse default value for a field")
print(parseError)
sys.exit()
else:
ddl = ZeroOrMore(Suppress(SkipTo(createTable, False)) + createTable)
ddl.ignore(ddlComment)
tableCreations = ddl.parseFile(pathToDdl)
if warnOnParse:
print(parseError)
# PROCESS DDL
header = open(pathToHeader, 'w')
print('// generated by ' + ' '.join(sys.argv), file=header)
print('#ifndef '+get_include_guard_name(namespace, pathToHeader), file=header)