reflection library
This package contains tools to reflect on and transform parsers.
Classes
- Analyzer
- Helper to reflect on properties of a grammar.
- LinterIssue
- Encapsulates a single linter issue.
- LinterRule
- Encapsulates a single linter rule.
- OptimizeRule
- Encapsulates a single optimization rule.
Enums
- LinterType
- The type of a linter issue.
Constants
-
allLinterRules
→ const List<
LinterRule> - All default linter rules to be run.
-
allOptimizerRules
→ const List<
OptimizeRule>
Functions
-
allParser(
Parser root) → Iterable< Parser> -
Returns a lazy iterable over all parsers reachable from
root
using a depth-first traversal over the connected parser graph. -
linter(
Parser parser, {LinterCallback? callback, List< LinterRule> ? rules, Set<String> excludedRules = const {}, Set<LinterType> excludedTypes = const {LinterType.info}}) → List<LinterIssue> -
Returns a list of linter issues found when analyzing the parser graph
reachable from
parser
. -
optimize<
R> (Parser< R> parser, {ReplaceParser? callback, List<OptimizeRule> ? rules}) → Parser<R> - Returns an in-place optimized version of the parser.
-
removeDuplicates<
R> (Parser< R> parser) → Parser<R> - Collapses all duplicate parsers in-place.
-
removeSettables<
R> (Parser< R> parser) → Parser<R> - Collapses all delegate parsers in-place.
-
transformParser<
R> (Parser< R> parser, TransformationHandler handler) → Parser<R> -
Transforms all parsers reachable from
parser
with the givenhandler
. The identity function returns a copy of the the incoming parser.
Typedefs
- LinterCallback = void Function(LinterIssue issue)
- Function signature of a linter callback that is called whenever a linter rule identifies an issue.
-
ReplaceParser<
R> = void Function(Parser< R> source, Parser<R> target) - Function signature of a linter callback that is called whenever a linter rule identifies an issue.
-
TransformationHandler
= Parser<
R> Function<R>(Parser< R> parser) - A function transforming one parser to another one.