Also silence yacc and stuff.

This commit is contained in:
Jon Michael Aanes 2017-11-13 18:14:53 +01:00
parent 6c38906a51
commit 2086af34d9
3 changed files with 9 additions and 8 deletions

View File

@ -32,7 +32,7 @@ def main():
global llvm_parser global llvm_parser
llvm_parser = parser.LLVMParser() llvm_parser = parser.LLVMParser()
llvm_parser.build() llvm_parser.build( parse_res['print_level'] <= 1 )
if parse_res['auto_path'] is not None: if parse_res['auto_path'] is not None:
step_behavior = { step_behavior = {
@ -47,9 +47,11 @@ def main():
def go_auto(path_to_file, step_behavior): def go_auto(path_to_file, step_behavior):
with open(path_to_file, 'r') as f: with open(path_to_file, 'r') as f:
file_contents = f.read() file_contents = f.read()
if step_behavior['step_print_level'] > 1:
print('Parsing {}' print('Parsing {}'
.format(path_to_file)) .format(path_to_file))
ast = llvm_parser.parse(file_contents) ast = llvm_parser.parse(file_contents)
if step_behavior['step_print_level'] > 1:
print('Beginning execution of {}' print('Beginning execution of {}'
.format(path_to_file)) .format(path_to_file))
stepper.auto_step(ast, step_behavior = step_behavior) stepper.auto_step(ast, step_behavior = step_behavior)

View File

@ -474,7 +474,7 @@ class LLVMParser(object):
def __init__(self): def __init__(self):
self.tokens += self.reserved.values() self.tokens += self.reserved.values()
def build(self): def build(self, silence_yacc=False):
""" """
Build the parser. Build the parser.
@ -484,7 +484,7 @@ class LLVMParser(object):
""" """
self.lexer = lex.lex(module=self) self.lexer = lex.lex(module=self)
self.parser = yacc.yacc(module=self) self.parser = yacc.yacc(module=self, errorlog=(silence_yacc and yacc.NullLogger() or None))
def parse(self, text): def parse(self, text):
""" """

View File

@ -643,7 +643,6 @@ def auto_step(ast, function_name='tigermain', function_args=[1234, 5678], step_b
if True: if True:
global PRINT_LEVEL global PRINT_LEVEL
PRINT_LEVEL = step_behavior['step_print_level'] PRINT_LEVEL = step_behavior['step_print_level']
print(PRINT_LEVEL)
# #
tdecls = ast.tdecls tdecls = ast.tdecls