Class Filters


  • public class Filters
    extends Object
    • Field Detail

      • SKIP_EMPTY_OPTS

        public static final Predicate<Node<Object>> SKIP_EMPTY_OPTS
        A predicate for Node tree printing, suppresses printing of parse tree nodes for Optional rules that do not have sub nodes.
      • SKIP_EMPTY_ZOMS

        public static final Predicate<Node<Object>> SKIP_EMPTY_ZOMS
        A predicate for Node tree printing, suppresses printing of parse tree nodes for ZeroOrMore rules that do not have sub nodes.
      • SKIP_EMPTY_OPTS_AND_ZOMS

        public static final Predicate<Node<Object>> SKIP_EMPTY_OPTS_AND_ZOMS
        A predicate for Node tree printing, suppresses printing of parse tree nodes for Optional and ZeroOrMore rules that do not have sub nodes.
    • Constructor Detail

      • Filters

        public Filters()
    • Method Detail

      • preventLoops

        public static Predicate<Matcher> preventLoops()
        A predicate for rule tree printing. Prevents SOEs by detecting and suppressing loops in the rule tree.
        Returns:
        a predicate
      • lines

        public static Predicate<Tuple2<Context<?>,​Boolean>> lines​(int firstLine,
                                                                        int lastLine)
        A predicate usable as a filter (element) of a TracingParseRunner. Enables printing of rule tracing log messages for all input in the given range of input lines.
        Parameters:
        firstLine - the number of the first input line to generate tracing message for
        lastLine - the number of the last input line to generate tracing message for
        Returns:
        a predicate
      • fromLine

        public static Predicate<Tuple2<Context<?>,​Boolean>> fromLine​(int firstLine)
        A predicate usable as a filter (element) of a TracingParseRunner. Enables printing of rule tracing log messages for all input in the given range of input lines.
        Parameters:
        firstLine - the number of the first input line to generate tracing message for
        Returns:
        a predicate
      • untilLine

        public static Predicate<Tuple2<Context<?>,​Boolean>> untilLine​(int lastLine)
        A predicate usable as a filter (element) of a TracingParseRunner. Enables printing of rule tracing log messages for all input in the given range of input lines.
        Parameters:
        lastLine - the number of the last input line to generate tracing message for
        Returns:
        a predicate
      • rules

        public static Predicate<Tuple2<Context<?>,​Boolean>> rules​(Rule... rules)
        A predicate usable as a filter (element) of a TracingParseRunner. Enables printing of rule tracing log messages for all given rules and their sub rules.
        Parameters:
        rules - the rules to generate tracing message for
        Returns:
        a predicate
      • onlyRules

        public static Predicate<Tuple2<Context<?>,​Boolean>> onlyRules​(Rule... rules)
        A predicate usable as a filter (element) of a TracingParseRunner. Enables printing of rule tracing log messages for all given rules (without their sub rules).
        Parameters:
        rules - the rules to generate tracing message for
        Returns:
        a predicate
      • rulesBelow

        public static Predicate<Tuple2<Context<?>,​Boolean>> rulesBelow​(Rule... rules)
        A predicate usable as a filter (element) of a TracingParseRunner. Enables printing of rule tracing log messages for all sub rules of the given rules.
        Parameters:
        rules - the rules whose sub rules to generate tracing message for
        Returns:
        a predicate
      • onlyMatches

        public static Predicate<Tuple2<Context<?>,​Boolean>> onlyMatches()
        A predicate usable as a filter (element) of a TracingParseRunner. Enables printing of rule tracing log messages for all matched rules.
        Returns:
        a predicate
      • onlyMismatches

        public static Predicate<Tuple2<Context<?>,​Boolean>> onlyMismatches()
        A predicate usable as a filter (element) of a TracingParseRunner. Enables printing of rule tracing log messages for all mismatched rules.
        Returns:
        a predicate