def _InitLexer(s): arena = test_lib.MakeArena('<lex_test.py>') _, lexer = test_lib.InitLexer(s, arena) return lexer
def _InitWordParser(s, arena=None): arena = arena or alloc.SideArena('word_parse_test.py') parse_ctx = parse_lib.ParseContext(arena, {}) line_reader, lexer = test_lib.InitLexer(s, arena) c_parser = parse_ctx.MakeOshParser(line_reader) return c_parser.w_parser # hack