org.parboiled.support
Class Filters

java.lang.Object
  extended by org.parboiled.support.Filters

public class Filters
extends java.lang.Object


Field Summary
static Predicate<Node<java.lang.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<java.lang.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<java.lang.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
Filters()
           
 
Method Summary
static Predicate<Tuple2<Context<?>,java.lang.Boolean>> fromLine(int firstLine)
          A predicate usable as a filter (element) of a TracingParseRunner.
static Predicate<Tuple2<Context<?>,java.lang.Boolean>> lines(int firstLine, int lastLine)
          A predicate usable as a filter (element) of a TracingParseRunner.
static Predicate<Tuple2<Context<?>,java.lang.Boolean>> onlyMatches()
          A predicate usable as a filter (element) of a TracingParseRunner.
static Predicate<Tuple2<Context<?>,java.lang.Boolean>> onlyMismatches()
          A predicate usable as a filter (element) of a TracingParseRunner.
static Predicate<Tuple2<Context<?>,java.lang.Boolean>> onlyRules(Rule... rules)
          A predicate usable as a filter (element) of a TracingParseRunner.
static Predicate<Matcher> preventLoops()
          A predicate for rule tree printing.
static Predicate<Tuple2<Context<?>,java.lang.Boolean>> rules(Rule... rules)
          A predicate usable as a filter (element) of a TracingParseRunner.
static Predicate<Tuple2<Context<?>,java.lang.Boolean>> rulesBelow(Rule... rules)
          A predicate usable as a filter (element) of a TracingParseRunner.
static Predicate<Tuple2<Context<?>,java.lang.Boolean>> untilLine(int lastLine)
          A predicate usable as a filter (element) of a TracingParseRunner.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SKIP_EMPTY_OPTS

public static final Predicate<Node<java.lang.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<java.lang.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<java.lang.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<?>,java.lang.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<?>,java.lang.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<?>,java.lang.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<?>,java.lang.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<?>,java.lang.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<?>,java.lang.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<?>,java.lang.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<?>,java.lang.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