parse.py 81.1 KB
Newer Older
2001
2002
        return self.__cycle_guard(lambda: str(self.parser), '...')

2003
2004
    @property
    def repr(self) -> str:
di68kap's avatar
di68kap committed
2005
        """Returns the parser's name if it has a name or repr(self) if not."""
2006
2007
        return self.parser.name if self.parser.name else repr(self)

2008
2009
2010
2011
2012
2013
2014
    def set(self, parser: Parser):
        """
        Sets the parser to which the calls to this Forward-object
        shall be delegated.
        """
        self.parser = parser

eckhart's avatar
eckhart committed
2015
2016
2017
    def _apply(self, func: ApplyFunc, flip: FlagFunc) -> bool:
        if super()._apply(func, flip):
            self.parser._apply(func, flip)
2018
2019
            return True
        return False