Class LazyParser<T>

  • Type Parameters:
    T - The return type of the parser.
    All Implemented Interfaces:
    Parser<T>

    public final class LazyParser<T>
    extends java.lang.Object
    implements Parser<T>
    Lazily initialized parser. Used to avoid problems with recursive definitions of grammar.
    • Constructor Summary

      Constructors 
      Constructor Description
      LazyParser()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T parse​(ParserContext context)
      The core of the parsing logic.
      void setDelegate​(Parser<T> delegate)
      Configure with the parser that all calls will be forwarded to.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface proguard.classfile.attribute.signature.parsing.Parser

        map, parse
    • Constructor Detail

      • LazyParser

        public LazyParser()
    • Method Detail

      • setDelegate

        public void setDelegate​(Parser<T> delegate)
        Configure with the parser that all calls will be forwarded to.
      • parse

        @Nullable
        public T parse​(ParserContext context)
        Description copied from interface: Parser
        The core of the parsing logic. The context argument specifies where in the input string we are currently parsing. The responsibility of this function is to do one of:
        • Consume a part of the input and return a non-null value.
        • Return null and keep the input context untouched. This can be achieved either by avoiding the calls to ParserContext.advance(int), or through the use of snapshotting (see ParserContext.snapshot()).
        Specified by:
        parse in interface Parser<T>
        Parameters:
        context - Context of the parser containing the parsed string and the position in that string.
        Returns:
        Null-value if this parser did not match anything. Non-null if it matched.