def test_parser(input_string): errors = ErrorReport() asmlexer = asmutil.create_lexer(errors) asmparser = asmutil.create_parser(errors, debug=True) ast = asmparser.parse(input_string, lexer=asmlexer) errors.report_errors() return ast, asmparser
def test_lexer(input_string): errors = ErrorReport() asmlexer = asmutil.create_lexer(errors) asmlexer.input(input_string) result = [] while True: token = asmlexer.token() if not token: break result = result + [(token.type, token.value)] errors.report_errors() return result