class LineParser(object): def __init__(self): self.exc = ParseException("","",0) def parse(self,line): self.exc = self.exc.with_line(line) try: return self._parser.parse(line,lexer=self._lexer) except ParseException as pe: self.exc = self.exc.with_value(pe.value).with_position(pe.position) raise self.exc