regexp library
Regular expression parser, AST models, and NFA execution engine.
Based on Thompson's algorithm for linear-time regex matching without catastrophic backtracking:
- xysun.github.io/posts/regex-parsing-thompsons-algorithm.html
- deniskyashif.com/2019/02/17/implementing-a-regular-expression-engine/
For example:
final parser = nodeParser;
final result = parser.parse('a*b+');
print(result.value);
Classes
- AlternationNode
-
An AST node matching either left or right (the
|operator). - ComplementNode
- An AST node matching the complement of child (inverting matches).
- ConcatenationNode
- An AST node matching left followed immediately by right.
- DotNode
-
An AST node matching any single character (the
.wildcard). - EmptyNode
- An AST node matching the empty string.
- EndAnchorNode
-
An AST node matching the end of input (the
$anchor). - IntersectionNode
-
An AST node matching the intersection of left and right (the
&operator). - LiteralNode
- An AST node matching a single literal character by its Unicode code point.
- Nfa
- A nondeterministic finite automaton (NFA) for executing regular expression patterns.
- NfaState
- A state within a nondeterministic finite automaton (Nfa).
- Node
- Base class for all regular expression Abstract Syntax Tree (AST) nodes.
- QuantificationNode
- An AST node repeating child between min and max times.
- RangeNode
- An AST node matching any character within the inclusive range between startCodePoint and endCodePoint.
- RegexpMatch
- A Match produced by a RegexpPattern.
- RegexpParserDefinition
- Grammar definition parsing regular expression syntax into a Node AST.
- RegexpPattern
- A Pattern implementation powered by a regular expression engine.
- StartAnchorNode
-
An AST node matching the start of input (the
^anchor).
Properties
-
nodeParser
→ Parser<
Node> -
A parser that converts regular expression strings into a Node AST.
final