Class Parser.Proxy<D,T>

java.lang.Object
eu.bandm.tools.ramus.runtime2.Parser<D,T>
eu.bandm.tools.ramus.runtime2.Parser.Proxy<D,T>
All Implemented Interfaces:
Action.Continuation<Parser.Input<D,T>,Parser.Output<D,T>,SimpleMessage<D>,Parser.Input<D,T>>, Function<Parser.Input<D,T>,Action<Parser.Output<D,T>,SimpleMessage<D>,Parser.Input<D,T>>>
Enclosing class:
Parser<D,T>

static class Parser.Proxy<D,T> extends Parser<D,T>
  • Field Details Link icon

    • body Link icon

      protected final Parser<D,T> body
  • Constructor Details Link icon

  • Method Details Link icon

    • apply Link icon

      Description copied from class: Parser
      Applies this continuation, possibly using a recyclable leaf node. Operational method.
      Specified by:
      apply in interface Action.Continuation<Parser.Input<D,T>,Parser.Output<D,T>,SimpleMessage<D>,Parser.Input<D,T>>
      Specified by:
      apply in class Parser<D,T>
      Parameters:
      in - the input parsing result
      recyclable - a recyclable leaf node, or null if not available
      Returns:
      a leaf node with a newly computed parsing result; either recyclable if available or new.
      See Also:
    • getFirstSet Link icon

      public Optional<Set<T>> getFirstSet()
      Description copied from class: Parser
      Returns the finite set of token types that this parser may consume first, if available.

      The default implementation returns Optional.empty(), which is always safe. Subclasses may override this method to return an actual set, if those parsers are known to never succeed with consuming a first token of another type, to enable optimizations.

      Overrides:
      getFirstSet in class Parser<D,T>
      Returns:
      an actual finite set if, whenever this parser succeeds consuming at least one token, the type of the first consumed token must be contained in the set; Optional.empty() if such a set is either unknown or infinite.
      See Also:
    • mayBeEpsilon Link icon

      public boolean mayBeEpsilon()
      Description copied from class: Parser
      Checks whether this parser may succeed without consuming any token.

      The default implementation returns true, which is always safe. Subclasses may override this method to return false, if those parsers are known to never succeed without consuming any token, to enable optimizations.

      Overrides:
      mayBeEpsilon in class Parser<D,T>
      Returns:
      true iff it is possible (certain or unknown) that this parser accepts zero tokens.
      See Also: