Package org.parboiled.support
Class Filters
- java.lang.Object
-
- org.parboiled.support.Filters
-
public class Filters extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static 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.static 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.static 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.
-
Constructor Summary
Constructors Constructor Description Filters()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Predicate<Tuple2<Context<?>,Boolean>>
fromLine(int firstLine)
A predicate usable as a filter (element) of aTracingParseRunner
.static Predicate<Tuple2<Context<?>,Boolean>>
lines(int firstLine, int lastLine)
A predicate usable as a filter (element) of aTracingParseRunner
.static Predicate<Tuple2<Context<?>,Boolean>>
onlyMatches()
A predicate usable as a filter (element) of aTracingParseRunner
.static Predicate<Tuple2<Context<?>,Boolean>>
onlyMismatches()
A predicate usable as a filter (element) of aTracingParseRunner
.static Predicate<Tuple2<Context<?>,Boolean>>
onlyRules(Rule... rules)
A predicate usable as a filter (element) of aTracingParseRunner
.static Predicate<Matcher>
preventLoops()
A predicate for rule tree printing.static Predicate<Tuple2<Context<?>,Boolean>>
rules(Rule... rules)
A predicate usable as a filter (element) of aTracingParseRunner
.static Predicate<Tuple2<Context<?>,Boolean>>
rulesBelow(Rule... rules)
A predicate usable as a filter (element) of aTracingParseRunner
.static Predicate<Tuple2<Context<?>,Boolean>>
untilLine(int lastLine)
A predicate usable as a filter (element) of aTracingParseRunner
.
-
-
-
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.
-
-
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 aTracingParseRunner
. 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 forlastLine
- 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 aTracingParseRunner
. 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 aTracingParseRunner
. 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 aTracingParseRunner
. 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 aTracingParseRunner
. 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 aTracingParseRunner
. 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 aTracingParseRunner
. 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 aTracingParseRunner
. Enables printing of rule tracing log messages for all mismatched rules.- Returns:
- a predicate
-
-