Abstract syntax tree for a single regular expression. #
The abstract syntax tree Syntax.AstItems.Ast.
The type of an error that occurred while building an AST.
- BackRefenceInvalid : ErrorKind
Backrefence invalid.
- CaptureLimitExceeded : ErrorKind
The capturing group limit was exceeded.
- ClassEscapeInvalid : ErrorKind
An invalid escape sequence was found in a character class set.
- ClassRangeInvalid : ErrorKind
An invalid character class range was found.
- ClassRangeLiteral : ErrorKind
An invalid range boundary was found in a character class.
- ClassUnclosed : ErrorKind
An opening
[was found with no corresponding closing]. - DecimalInvalid : ErrorKind
An invalid decimal number was given where one was expected.
- EndQuoteWithoutOpenQuote : ErrorKind
End quote without a corresponding open quote.
- EscapeHexEmpty : ErrorKind
A bracketed hex literal was empty.
- EscapeHexInvalid : ErrorKind
A bracketed hex literal did not correspond to a Unicode scalar value.
- EscapeHexInvalidDigit : ErrorKind
An invalid hexadecimal digit was found.
- EscapeUnexpectedEof : ErrorKind
EOF was found before an escape sequence was completed.
- EscapeUnrecognized : ErrorKind
An unrecognized escape sequence.
- FixedWidtExcpected : ErrorKind
Fixed width in look behind
- FlagDanglingNegation : ErrorKind
A dangling negation was used when setting flags, e.g.,
i-. - FlagDuplicate : ErrorKind
A flag was used twice, e.g.,
i-i. - FlagRepeatedNegation : ErrorKind
The negation operator was used twice, e.g.,
-i-s. - FlagUnexpectedEof : ErrorKind
Expected a flag but got EOF, e.g.,
(?. - FlagUnrecognized : ErrorKind
Unrecognized flag, e.g.,
a. - GroupNameDuplicate : ErrorKind
A duplicate capture name was found.
- GroupNameEmpty : ErrorKind
A capture group name is empty, e.g.,
(?P<>abc). - GroupNameInvalid : ErrorKind
An invalid character was seen for a capture group name.
- GroupNameNotFound : ErrorKind
A capture group name is not found of a backreference.
- GroupNameUnexpectedEof : ErrorKind
A closing
>could not be found for a capture group name. - GroupUnclosed : ErrorKind
An unclosed group, e.g.,
(ab. - GroupUnopened : ErrorKind
An unopened group, e.g.,
ab). - NestLimitExceeded : ErrorKind
The nest limit was exceeded.
- RepetitionCountInvalid : ErrorKind
The range provided in a counted repetition operator is invalid.
- RepetitionCountDecimalEmpty : ErrorKind
An opening
{was not followed by a valid decimal value. - RepetitionCountUnclosed : ErrorKind
An opening
{was found with no corresponding closing}. - RepetitionMissing : ErrorKind
A repetition operator was applied to a missing sub-expression.
- RepetitionUngreedyAndPossessive : ErrorKind
A repetition operator was ungreedy and possessive.
- SpecialWordBoundaryUnclosed : ErrorKind
The special word boundary syntax,
\b{something}, was used, but either EOF without}was seen, or an invalid character in the braces was seen. - SpecialWordBoundaryUnrecognized : ErrorKind
The special word boundary syntax,
\b{something}, was used, butsomethingwas not recognized as a valid word boundary kind. - SpecialWordOrRepetitionUnexpectedEof : ErrorKind
The syntax
\b{was observed, but afterwards the end of the pattern was observed without being able to tell whether it was meant to be a bounded repetition on the\bor the beginning of a special word boundary assertion. - UnicodeClassInvalid : ErrorKind
The Unicode class is not valid.
- UnsupportedBackreference : ErrorKind
When octal support is disabled, this error is produced when an octal escape is used.
- UnsupportedLookAround : ErrorKind
When syntax similar to PCRE's look-around is used, this error is returned.
- UnkownAsciiClass : ErrorKind
ClassAsci not found.
- EscapeOctalInvalid : ErrorKind
A octal literal did not correspond to a Unicode scalar value.
- FeatureNotImplementedSubroutines : ErrorKind
Feature not implemented.
- FeatureNotImplementedFlagShorthand : ErrorKind
Feature not implemented.
- FeatureNotImplementedAtomicGroup : ErrorKind
Feature not implemented.
- FeatureNotImplementedConditionalExpression : ErrorKind
Feature not implemented.
- FeatureNotImplementedBranchResetGroup : ErrorKind
Feature not implemented.
- FeatureNotImplementedControlVerbs : ErrorKind
Feature not implemented.
- FeatureNotImplementedFlagExtended : ErrorKind
Feature not implemented.
Instances For
The type of a Unicode hex literal.
- x : HexLiteralKind
A
\xprefix. When used without brackets, this form is limited to one digit (Pcre flavor). - X : HexLiteralKind
A
\xprefix. When used without brackets, this form is limited to two digits. - UnicodeShort : HexLiteralKind
A
\uprefix. When used without brackets, this form is limited to four digits.
Instances For
The kind of a single literal expression.
- Verbatim : LiteralKind
The literal is written verbatim, e.g.,
aor☃. - Hex : HexLiteralKind → LiteralKind
The literal is written as a hex code with a fixed number of digits like '\u0061'
- HexBrace : HexLiteralKind → LiteralKind
The literal is written as a hex code with a bracketed number of digits. The only restriction is that the bracketed hex code must refer to a valid Unicode scalar value.
Instances For
A single character literal, which includes escape sequences.
- span : Substring.Raw
The span of this literal.
- kind : LiteralKind
The kind of this literal.
- c : Char
The Unicode scalar value corresponding to this literal.
Instances For
Instances For
A backrefence to a capturung group.
- span : Substring.Raw
The span of this backrefence.
- n : Nat
number of the capturung group.
Instances For
A range repetition operator.
- Exactly : Nat → RepetitionRange
{m} - AtLeast : Nat → RepetitionRange
{m,} - Bounded : Nat → Nat → RepetitionRange
{m,n}
Instances For
The kind of a repetition operator.
- ZeroOrOne : RepetitionKind
? - ZeroOrMore : RepetitionKind
* - OneOrMore : RepetitionKind
+ - Range : RepetitionRange → RepetitionKind
Instances For
The repetition operator itself.
- span : Substring.Raw
The span of this Repetition .
- kind : RepetitionKind
The kind of this Repetition .
Instances For
The kind of an item in a group of flags.
- Negation : FlagsItemKind
A negation operator applied to all subsequent flags in the enclosing group.
- Flag : AstItems.Flag → FlagsItemKind
A single flag in a group.
Instances For
A single item in a group of flags.
- span : Substring.Raw
The span of this item.
- kind : FlagsItemKind
The kind of this item.
Instances For
The kind of a Lookaround.
- PositiveLookahead : LookaroundKind
- NegativeLookahead : LookaroundKind
- PositiveLookbehind : Nat → LookaroundKind
- NegativeLookbehind : Nat → LookaroundKind
Instances For
The available forms of Unicode character classes.
- OneLetter : Char → ClassUnicodeKind
A one letter abbreviated class, e.g.,
\pN. - Named : String → ClassUnicodeKind
A binary property, general category or script. The string may be empty.
- NamedValue (op : ClassUnicodeOpKind) (n v : String) : ClassUnicodeKind
A property name and an associated value.
Instances For
A Unicode character class.
- span : Substring.Raw
The span of this class.
- negated : Bool
is class negated.
- kind : ClassUnicodeKind
The kind of Unicode class.
Instances For
An assertion kind.
- StartLine : AssertionKind
^ - EndLine : AssertionKind
$ - EndLineWithOptionalLF : AssertionKind
$pcre flavor - StartText : AssertionKind
\A - EndText : AssertionKind
\z - EndTextWithOptionalLF : AssertionKind
\Zpcre flavor - WordBoundary : AssertionKind
\b
- NotWordBoundary : AssertionKind
\B
- WordBoundaryStart : AssertionKind
\b{start} - WordBoundaryEnd : AssertionKind
\b{end} - WordBoundaryStartHalf : AssertionKind
\b{start-half} - WordBoundaryEndHalf : AssertionKind
\b{end-half} - PreviousMatch : AssertionKind
\G
- ClearMatches : AssertionKind
\K
Instances For
A single zero-width assertion.
- span : Substring.Raw
The span of this assertion.
- kind : AssertionKind
The assertion kind.
Instances For
The available ASCII character classes.
- Alnum : ClassAsciiKind
[0-9A-Za-z] - Alpha : ClassAsciiKind
[A-Za-z] - Ascii : ClassAsciiKind
[\x00-\x7F] - Blank : ClassAsciiKind
[ \t] - Cntrl : ClassAsciiKind
[\x00-\x1F\x7F] - Digit : ClassAsciiKind
[0-9] - Graph : ClassAsciiKind
[!-~] - Lower : ClassAsciiKind
[a-z] - Print : ClassAsciiKind
[ -~] - Punct : ClassAsciiKind
...
- Space : ClassAsciiKind
[\t\n\v\f\r ] - Upper : ClassAsciiKind
[A-Z] - Word : ClassAsciiKind
[0-9A-Za-z_] - Xdigit : ClassAsciiKind
[0-9A-Fa-f]
Instances For
Instances For
An ASCII character class.
- span : Substring.Raw
The span of this assertion.
- kind : ClassAsciiKind
The kind of ASCII class.
- negated : Bool
Whether the class is negated or not
Instances For
The available Perl character classes.
- Digit : ClassPerlKind
Decimal numbers.
- Space : ClassPerlKind
Whitespace.
- Word : ClassPerlKind
Word characters.
- Newline : ClassPerlKind
Newline.
- VerticalSpace : ClassPerlKind
Whitespace.
- HorizontalSpace : ClassPerlKind
Whitespace.
Instances For
A Perl character class.
- span : Substring.Raw
The span of this assertion.
- kind : ClassPerlKind
The kind of Perl class.
- negated : Bool
Whether the class is negated or not
Instances For
A repetition operation applied to a regular expression.
- mk (span : Substring.Raw) (op : RepetitionOp) (greedy possessive : Bool) (ast : Ast) : Repetition
Instances For
A grouped regular expression.
- mk (span : Substring.Raw) (kind : GroupKind) (ast : Ast) : Group
Instances For
A group of flags that is not applied to a particular regular expression.
- mk (span : Substring.Raw) (flags : Flags) : SetFlags
Instances For
A primitive is an expression with no sub-expressions.
- Literal : AstItems.Literal → Primitive
- BackRef : AstItems.BackRef → Primitive
- Dot : Substring.Raw → Primitive
- Assertion : AstItems.Assertion → Primitive
- Unicode : ClassUnicode → Primitive
- Perl : ClassPerl → Primitive
Instances For
A union of items inside a character class set.
- mk (span : Substring.Raw) (items : Array ClassSetItem) : ClassSetUnion
Instances For
A single component of a character class set.
- Empty : Substring.Raw → ClassSetItem
An empty item.
- Literal : AstItems.Literal → ClassSetItem
A single literal.
- Range : ClassSetRange → ClassSetItem
A range between two literals.
- Ascii : ClassAscii → ClassSetItem
An ASCII character class, e.g.,
[:alnum:]or[:punct:]. - Unicode : ClassUnicode → ClassSetItem
A Unicode character class, e.g.,
\pLor\p{Greek}. - Perl : ClassPerl → ClassSetItem
A perl character class, e.g.,
\dor\W. - Bracketed : ClassBracketed → ClassSetItem
A bracketed character class set, which may contain zero or more character ranges and/or zero or more nested classes. e.g.,
[a-zA-Z\pL]. - Union : ClassSetUnion → ClassSetItem
A union of items.
Instances For
The type of a Unicode character class set operation.
- Intersection : ClassSetBinaryOpKind
The intersection of two sets, e.g.,
\pN&&[a-z]. - Difference : ClassSetBinaryOpKind
The difference of two sets, e.g.,
\pN--[0-9]. - SymmetricDifference : ClassSetBinaryOpKind
The symmetric difference of two sets. The symmetric difference is the set of elements belonging to one but not both sets.
Instances For
A Unicode character class set operation.
- mk (span : Substring.Raw) (kind : ClassSetBinaryOpKind) (lhs rhs : ClassSet) : ClassSetBinaryOp
Instances For
A character class set.
- Item : ClassSetItem → ClassSet
An item, which can be a single literal, range, nested character class or a union of items.
- BinaryOp : ClassSetBinaryOp → ClassSet
A single binary operation (i.e., &&, -- or ~~).
Instances For
A bracketed character class, e.g., [a-z0-9].
- mk (span : Substring.Raw) (negated : Bool) (kind : ClassSet) : ClassBracketed
Instances For
An alternation of regular expressions.
- mk (span : Substring.Raw) (asts : Array Ast) : Alternation
Instances For
A concatenation of regular expressions.
- mk (span : Substring.Raw) (asts : Array Ast) : Concat
Instances For
An abstract syntax tree for a single regular expression.
- Empty : Ast
An empty regex that matches everything.
- Flags : SetFlags → Ast
A set of flags, e.g.,
(?is). - Literal : AstItems.Literal → Ast
A single character literal, which includes escape sequences.
- BackRef : AstItems.BackRef → Ast
A backrefence to a capturung group.
- Dot : Substring.Raw → Ast
The "any character" class.
- Assertion : AstItems.Assertion → Ast
A single zero-width assertion.
- ClassUnicode : AstItems.ClassUnicode → Ast
A single Unicode character class, e.g.,
\pLor\p{Greek}. - ClassPerl : AstItems.ClassPerl → Ast
A single perl character class, e.g.,
\dor\W. - ClassBracketed : AstItems.ClassBracketed → Ast
A single bracketed character class set, which may contain zero or more character range.
- Repetition : AstItems.Repetition → Ast
A repetition operator applied to an arbitrary regular expression.
- Alternation : AstItems.Alternation → Ast
An alternation of regular expressions.
- Group : AstItems.Group → Ast
A grouped regular expression.
- Concat : AstItems.Concat → Ast
A concatenation of regular expressions.
Instances For
Instances For
Return this union as a character class set item.