Example #1
0
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
Example #2
0
def overrides(cls):
    try:
        del cls.__rule_previous
    except AttributeError:
        raise ParseException('Rule named "%s" already overwritten.' %
                             cls.__name__)
    return cls
Example #3
0
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
Example #4
0
 def __init__(self):
     self.exc = ParseException("","",0)