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
def p_error(p): exc = ParseException("","EOF",-1) if p is not None: exc = exc.with_value(p.value).with_position(p.lexpos) raise exc