def ast(self, begin, ast):
        end = self.parser.input.position
        full = ''.join(self.parser.input.data)
        text = full[begin:end]
        start_line = full[:begin].count("\n") + self.line_offset
        start_col = begin - full.rfind("\n", 0, begin)-1
        end_line = start_line + text.count("\n")
        inside_nl = text.rfind("\n", 0)
        if inside_nl == -1:
            end_col = start_col + len(text)
        else:
            end_col = len(text[inside_nl:])
        node = ASTNode(ast, text, start_line, start_col, end_line, end_col)
        return node
dataset/ETHPy150Open thiago-silva/memetalk/sugarfoot/pyparsers/astbuilder.py/ASTBuilder.ast/original