High-level intermediate representation for a regular expression. #
A high-level intermediate representation Syntax.Hir
for a regular expression.
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- Syntax.instToStringIntervalSetChar = { toString := fun (set : IntervalSet Char) => toString "ranges: " ++ toString set.intervals ++ toString "" }
Equations
- Syntax.instToStringClassUnicode = { toString := fun (cls : Syntax.ClassUnicode) => toString "" ++ toString cls.set ++ toString "" }
see UInt32.isValidChar
Equations
- One or more equations did not get rendered due to their size.
Equations
- Syntax.ClassUnicode.empty = { set := { intervals := #[], isNonOverlapping := ⋯ } }
Instances For
Equations
- cls.canonicalize = { set := IntervalSet.canonicalize cls.set.intervals }
Instances For
Equations
- cls1.union cls2 = { set := cls1.set.union cls2.set }
Instances For
Equations
- cls1.intersection cls2 = { set := cls1.set.intersection cls2.set }
Instances For
Equations
- cls1.difference cls2 = { set := cls1.set.difference cls2.set }
Instances For
Equations
- cls1.symmetric_difference cls2 = { set := cls1.set.symmetric_difference cls2.set }
Instances For
Equations
- cls.negate = { set := cls.set.negate }
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
- Unicode : ClassUnicode → Class
A set of characters represented by Unicode scalar values.
Instances For
Equations
- Syntax.instToStringClass = { toString := fun (cls : Syntax.Class) => match cls with | Syntax.Class.Unicode cls => toString "" ++ toString cls ++ toString "" }
The high-level intermediate representation for a look-around assertion.
- Start : Look
Match the beginning of text.
- End : Look
Match the end of text.
- EndWithOptionalLF : Look
Match the end of text (before optional newline).
- StartLF : Look
Match the beginning of a line or the beginning of text.
- EndLF : Look
Match the end of a line or the end of text.
- StartCRLF : Look
Match the beginning of a line or the beginning of text.
- EndCRLF : Look
Match the end of a line or the end of text.
- WordUnicode : Look
Match a Unicode-aware word boundary.
- WordUnicodeNegate : Look
Match a Unicode-aware negation of a word boundary.
- WordStartUnicode : Look
Match the start of a Unicode word boundary.
- WordEndUnicode : Look
Match the end of a Unicode word boundary.
- WordStartHalfUnicode : Look
Match the start half of a Unicode word boundary.
- WordEndHalfUnicode : Look
Match the end half of a Unicode word boundary.
- PreviousMatch : Look
Match the end of the previous match or start of string.
- ClearMatches : Look
Clear all matches.
Instances For
Equations
- Syntax.Look.Start.toString = toString "Start"
- Syntax.Look.End.toString = toString "End"
- Syntax.Look.EndWithOptionalLF.toString = toString "EndWithOptionalLF"
- Syntax.Look.StartLF.toString = toString "StartLF"
- Syntax.Look.EndLF.toString = toString "EndLF"
- Syntax.Look.StartCRLF.toString = toString "StartCRLF"
- Syntax.Look.EndCRLF.toString = toString "EndCRLF"
- Syntax.Look.WordUnicode.toString = toString "WordUnicode"
- Syntax.Look.WordUnicodeNegate.toString = toString "WordUnicodeNegate"
- Syntax.Look.WordStartUnicode.toString = toString "WordStartUnicode"
- Syntax.Look.WordEndUnicode.toString = toString "WordEndUnicode"
- Syntax.Look.WordStartHalfUnicode.toString = toString "WordStartHalfUnicode"
- Syntax.Look.WordEndHalfUnicode.toString = toString "WordEndHalfUnicode"
- Syntax.Look.PreviousMatch.toString = toString "PreviousMatch"
- Syntax.Look.ClearMatches.toString = toString "ClearMatches"
Instances For
Equations
- Syntax.instToStringLook = { toString := Syntax.Look.toString }
Equations
- Syntax.instInhabitedProperties = { default := { minimum_len := none, maximum_len := none } }
A translator's representation of a regular expression's flags at any given moment in time.
- extended : Option Regex.Grammar.ExtendedKind
Instances For
Equations
- One or more equations did not get rendered due to their size.
The high-level intermediate representation for a look-around assertion.
- PositiveLookahead : Hir → Lookaround
- NegativeLookahead : Hir → Lookaround
- PositiveLookbehind : Nat → Hir → Lookaround
- NegativeLookbehind : Nat → Hir → Lookaround
Instances For
A concatenation of regular expressions.
Instances For
The underlying kind of an arbitrary [Hir
] expression.
- Empty : HirKind
The empty regular expression, which matches everything, including the empty string.
- Literal : Char → HirKind
A literal string that matches exactly these bytes.
- BackRef : Bool → Nat → HirKind
A backrefence to a capturung group.
- Class : Syntax.Class → HirKind
A single character class that matches any of the characters in the class.
- Look : Syntax.Look → HirKind
A look-around assertion. A look-around match always has zero length.
- Lookaround : Syntax.Lookaround → HirKind
A complex look-around assertion.
- Repetition : Syntax.Repetition → HirKind
A repetition operation applied to a sub-expression.
- Capture : Syntax.Capture → HirKind
A capturing group, which contains a sub-expression.
- Concat : Array Hir → HirKind
A concatenation of expressions.
- Alternation : Array Hir → HirKind
An alternation of expressions.
Instances For
A high-level intermediate representation (HIR) for a regular expression.
- mk (kind : HirKind) (props : Properties) : Hir
Instances For
Equations
- Syntax.instInhabitedHir = { default := Syntax.Hir.mk Syntax.HirKind.Empty default }
Equations
- (Syntax.Hir.mk kind props).kind = kind
Instances For
Equations
- (Syntax.Hir.mk kind props).properties = props
Instances For
Equations
- Syntax.Hir.toProperties (Syntax.HirKind.Class (Syntax.Class.Unicode cls)) = { minimum_len := if cls.set.intervals.size > 0 then some 1 else none, maximum_len := none }
- Syntax.Hir.toProperties kind = default
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
- (Syntax.Hir.mk Syntax.HirKind.Empty props).fold f init = f (f init (Syntax.Hir.mk Syntax.HirKind.Empty props)) (Syntax.Hir.mk Syntax.HirKind.Empty props)
- (Syntax.Hir.mk (Syntax.HirKind.Literal a) props).fold f init = f (f init (Syntax.Hir.mk (Syntax.HirKind.Literal a) props)) (Syntax.Hir.mk (Syntax.HirKind.Literal a) props)
- (Syntax.Hir.mk (Syntax.HirKind.BackRef a a_1) props).fold f init = f (f init (Syntax.Hir.mk (Syntax.HirKind.BackRef a a_1) props)) (Syntax.Hir.mk (Syntax.HirKind.BackRef a a_1) props)
- (Syntax.Hir.mk (Syntax.HirKind.Class a) props).fold f init = f (f init (Syntax.Hir.mk (Syntax.HirKind.Class a) props)) (Syntax.Hir.mk (Syntax.HirKind.Class a) props)
- (Syntax.Hir.mk (Syntax.HirKind.Look a) props).fold f init = f (f init (Syntax.Hir.mk (Syntax.HirKind.Look a) props)) (Syntax.Hir.mk (Syntax.HirKind.Look a) props)
- (Syntax.Hir.mk (Syntax.HirKind.Capture a) props).fold f init = f (f init (Syntax.Hir.mk (Syntax.HirKind.Capture a) props)) (Syntax.Hir.mk (Syntax.HirKind.Capture a) props)
Instances For
check if an hir
contains .Lookaround
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Syntax.instToStringHir = { toString := fun (hir : Syntax.Hir) => hir.toString 0 }
A type describing the different flavors of .
.
- AnyChar : Dot
Matches the UTF-8 encoding of any Unicode scalar value. This is equivalent to
(?su:.)
and also\p{any}
. - AnyCharExceptLF : Dot
Matches the UTF-8 encoding of any Unicode scalar value except for
\n
. This is equivalent to(?u-s:.)
and also[\p{any}--\n]
. - AnyCharExceptCRLF : Dot
Matches the UTF-8 encoding of any Unicode scalar value except for
\r
and\n
. This is equivalent to(?uR-s:.)
and also[\p{any}--\r\n]
.
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Syntax.dot Syntax.Dot.AnyChar = Syntax.Hir.mk (Syntax.HirKind.Class (Syntax.Class.Unicode default)) (Syntax.Hir.toProperties (Syntax.HirKind.Class (Syntax.Class.Unicode default)))
Instances For
An HirFrame is a single stack frame, represented explicitly, which is created for each item in the Ast that we traverse.
- Expr : Hir → HirFrame
- Literal : Char → HirFrame
- BackRef : Bool → Nat → HirFrame
- ClassUnicode : Syntax.ClassUnicode → HirFrame
- Repetition : HirFrame
- Group (old_flags : Flags) : HirFrame
- Concat : HirFrame
- Alternation : HirFrame
Instances For
Equations
- (Syntax.HirFrame.Expr hir).toString = toString "Expr '" ++ toString hir ++ toString "'"
- (Syntax.HirFrame.Literal c).toString = toString "Literal " ++ toString c ++ toString ""
- (Syntax.HirFrame.BackRef f n).toString = toString "BackRef " ++ toString (if f = true then "case_insensitive" else "") ++ toString " " ++ toString n ++ toString ""
- (Syntax.HirFrame.ClassUnicode cls).toString = toString "ClassUnicode cls set size " ++ toString cls.set.intervals.size ++ toString ""
- Syntax.HirFrame.Repetition.toString = "Repetition"
- (Syntax.HirFrame.Group flags).toString = toString "Group " ++ toString flags ++ toString ""
- Syntax.HirFrame.Concat.toString = "Concat"
- Syntax.HirFrame.Alternation.toString = "Alternation"
Instances For
Equations
- (Syntax.HirFrame.Expr expr).unwrap_expr = Except.ok expr
- (Syntax.HirFrame.Literal c).unwrap_expr = Except.ok (Syntax.Hir.mk (Syntax.HirKind.Literal c) default)
- (Syntax.HirFrame.BackRef f n).unwrap_expr = Except.ok (Syntax.Hir.mk (Syntax.HirKind.BackRef f n) default)
- frame.unwrap_expr = Except.error "unwrap_expr, Literal or Expr expected"
Instances For
Assert that the current stack frame is a Unicode class expression and return it.
Equations
- (Syntax.HirFrame.ClassUnicode cls).unwrap_class_unicode = Except.ok cls
- frame.unwrap_class_unicode = Except.error "unwrap_repetition, Repetition expected"
Instances For
Assert that the current stack frame is a repetition.
Equations
- Syntax.HirFrame.Repetition.unwrap_repetition = Except.ok ()
- frame.unwrap_repetition = Except.error "unwrap_repetition, Repetition expected"
Instances For
Assert that the current stack frame is a group.
Equations
- (Syntax.HirFrame.Group flags).unwrap_group = Except.ok flags
- frame.unwrap_group = Except.error "unwrap_repetition, Repetition expected"
Instances For
Equations
- Syntax.instToStringHirFrame = { toString := Syntax.HirFrame.toString }