def to_ast(s): print s tp = parse(s) print tp astb = ASTBuilder() astb.sourcename = "test" return astb.dispatch(tp)
def test_get_pos(self): from js import operations from pypy.rlib.parsing.tree import Symbol astb = ASTBuilder() t = self.parse('6') assert isinstance(t, Symbol) pos = astb.get_pos(t) assert pos.lineno == 0 t = self.parse('[1,]') assert not isinstance(t, Symbol) pos = astb.get_pos(t) assert pos.start == 0
def test_get_pos(self): from js import operations from rpython.rlib.parsing.tree import Symbol astb = ASTBuilder() t = self.parse('6') assert isinstance(t, Symbol) pos = astb.get_pos(t) assert pos.lineno == 0 t = self.parse('[1,]') assert not isinstance(t, Symbol) pos = astb.get_pos(t) assert pos.start == 0
def to_ast(self, s): return ASTBuilder().dispatch(self.parse(s))