Interface Matcher

    • Method Detail

      • getLabel

        String getLabel()
        Returns:
        the label of the matcher (which is identical to the label of the Rule this matcher matches)
      • hasCustomLabel

        boolean hasCustomLabel()
        Returns:
        true if this matcher has been assigned a custom label
      • isNodeSuppressed

        boolean isNodeSuppressed()
        Returns:
        true if this matcher has been marked with @SuppressNode
      • areSubnodesSuppressed

        boolean areSubnodesSuppressed()
        Returns:
        true if this matcher has been marked with @SuppressSubnodes
      • isNodeSkipped

        boolean isNodeSkipped()
        Returns:
        true if this matcher has been marked with @SkipNode
      • areMismatchesMemoed

        boolean areMismatchesMemoed()
        Returns:
        true if this matcher has been marked with @MemoMismatches
      • getSubContext

        MatcherContext getSubContext​(MatcherContext context)
        Creates a context for the matching of this matcher using the given parent context.
        Parameters:
        context - the parent context
        Returns:
        the context this matcher is to be run in
      • match

        <V> boolean match​(MatcherContext<V> context)
        Tries a match on the given MatcherContext.
        Parameters:
        context - the MatcherContext
        Returns:
        true if the match was successful
      • setTag

        void setTag​(Object tagObject)
        Associates an arbitrary object with this matcher. Used for example during profiling and packrat parsing. The matcher implementations themselves completely ignore the contents of this property. It purely serves as a performance optimization for ParseRunners and/or MatchHandlers and saves these from the need to use Map<Matcher, XYZ> structures for associating internal objects with matchers.
        Parameters:
        tagObject - the tag object
      • getTag

        Object getTag()
        Retrieves a previously set tag object.
        Returns:
        the tag object or null if none set
      • accept

        <R> R accept​(MatcherVisitor<R> visitor)
        Accepts the given matcher visitor.
        Parameters:
        visitor - the visitor
        Returns:
        the value returned by the given visitor