|
@@ -535,8 +535,8 @@ cdef class ParserEngine:
|
|
|
tmp = []
|
|
tmp = []
|
|
|
for line in lexLines:
|
|
for line in lexLines:
|
|
|
tmp.append(line.strip())
|
|
tmp.append(line.strip())
|
|
|
- f = open(buildDirectory + parser.flexFile, "w")
|
|
|
|
|
- f.write("\n".join(tmp) + "\n")
|
|
|
|
|
|
|
+ f = open(buildDirectory + parser.flexFile, 'w')
|
|
|
|
|
+ f.write('\n'.join(tmp) + '\n')
|
|
|
f.close()
|
|
f.close()
|
|
|
|
|
|
|
|
# create and set up a compiler object
|
|
# create and set up a compiler object
|
|
@@ -545,7 +545,7 @@ cdef class ParserEngine:
|
|
|
|
|
|
|
|
# -----------------------------------------
|
|
# -----------------------------------------
|
|
|
# Now run bison on the grammar file
|
|
# Now run bison on the grammar file
|
|
|
- #os.system("bison -d tmp.y")
|
|
|
|
|
|
|
+ #os.system('bison -d tmp.y')
|
|
|
bisonCmd = parser.bisonCmd + [buildDirectory + parser.bisonFile]
|
|
bisonCmd = parser.bisonCmd + [buildDirectory + parser.bisonFile]
|
|
|
|
|
|
|
|
if parser.verbose:
|
|
if parser.verbose:
|
|
@@ -554,7 +554,7 @@ cdef class ParserEngine:
|
|
|
env.spawn(bisonCmd)
|
|
env.spawn(bisonCmd)
|
|
|
|
|
|
|
|
if parser.verbose:
|
|
if parser.verbose:
|
|
|
- print "renaming bison output files"
|
|
|
|
|
|
|
+ print 'renaming bison output files'
|
|
|
print '%s => %s%s' % (parser.bisonCFile, buildDirectory,
|
|
print '%s => %s%s' % (parser.bisonCFile, buildDirectory,
|
|
|
parser.bisonCFile1)
|
|
parser.bisonCFile1)
|
|
|
print '%s => %s%s' % (parser.bisonHFile, buildDirectory,
|
|
print '%s => %s%s' % (parser.bisonHFile, buildDirectory,
|
|
@@ -572,7 +572,7 @@ cdef class ParserEngine:
|
|
|
|
|
|
|
|
# -----------------------------------------
|
|
# -----------------------------------------
|
|
|
# Now run lex on the lex file
|
|
# Now run lex on the lex file
|
|
|
- #os.system("lex tmp.l")
|
|
|
|
|
|
|
+ #os.system('lex tmp.l')
|
|
|
flexCmd = parser.flexCmd + [buildDirectory + parser.flexFile]
|
|
flexCmd = parser.flexCmd + [buildDirectory + parser.flexFile]
|
|
|
|
|
|
|
|
if parser.verbose:
|
|
if parser.verbose:
|
|
@@ -648,6 +648,15 @@ cdef class ParserEngine:
|
|
|
except:
|
|
except:
|
|
|
print "Warning: failed to delete temporary file %s" % f
|
|
print "Warning: failed to delete temporary file %s" % f
|
|
|
|
|
|
|
|
|
|
+ if parser.verbose:
|
|
|
|
|
+ print 'deleting temporary bison output files:'
|
|
|
|
|
+
|
|
|
|
|
+ for f in [parser.bisonCFile, parser.bisonHFile]:
|
|
|
|
|
+ if parser.verbose:
|
|
|
|
|
+ print 'rm %s' % f
|
|
|
|
|
+
|
|
|
|
|
+ os.unlink(f)
|
|
|
|
|
+
|
|
|
def closeLib(self):
|
|
def closeLib(self):
|
|
|
"""
|
|
"""
|
|
|
Does the necessary cleanups and closes the parser library
|
|
Does the necessary cleanups and closes the parser library
|