Documentation

Regex.VM.Basic

structure Regex.VM.SearchState {s : String} (σ : Strategy s) (nfa : NFA) :
Instances For
    @[reducible, inline]
    abbrev Regex.VM.εStack {s : String} (σ : Strategy s) (nfa : NFA) :
    Equations
    Instances For
      @[inline]

      As an optimization, we write the updates to the buffer only when the state is done, a character, or a sparse state.

      Equations
      Instances For
        @[inline]
        def Regex.VM.εClosure.pushNext {s : String} (σ : Strategy s) (nfa : NFA) (p : s.ValidPos) (node : NFA.Node) (inBounds : node.inBounds nfa.nodes.size) (update : σ.Update) (stack : εStack σ nfa) :
        εStack σ nfa
        Equations
        Instances For
          @[irreducible]
          def Regex.VM.εClosure {s : String} (σ : Strategy s) (nfa : NFA) (wf : nfa.WellFormed) (p : s.ValidPos) (matched : Option σ.Update) (next : SearchState σ nfa) (stack : εStack σ nfa) :

          Visit all ε-transitions from the states in the stack, updating next.states when the new state is .done, .char, or .sparse. Returns .some updates if a .done state is reached, meaning a match is found.

          Equations
          • One or more equations did not get rendered due to their size.
          • Regex.VM.εClosure σ nfa wf p matched next [] = (matched, next)
          Instances For
            def Regex.VM.stepChar {s : String} (σ : Strategy s) (nfa : NFA) (wf : nfa.WellFormed) (p : s.ValidPos) (ne : p s.endValidPos) (currentUpdates : Vector σ.Update nfa.nodes.size) (next : SearchState σ nfa) (state : Fin nfa.nodes.size) :

            If the given state can make a transition on the current character of it, make the transition and traverse ε-closures from the resulting state.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              def Regex.VM.eachStepChar {s : String} (σ : Strategy s) (nfa : NFA) (wf : nfa.WellFormed) (p : s.ValidPos) (ne : p s.endValidPos) (current next : SearchState σ nfa) :

              For all states in current, make a transition on the current character of it and traverse ε-closures from the resulting states.

              Equations
              Instances For
                @[irreducible]
                def Regex.VM.eachStepChar.go {s : String} (σ : Strategy s) (nfa : NFA) (wf : nfa.WellFormed) (p : s.ValidPos) (ne : p s.endValidPos) (current : SearchState σ nfa) (i : Nat) (hle : i current.states.count) (next : SearchState σ nfa) :
                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  def Regex.VM.captureNext {s : String} (σ : Strategy s) (nfa : NFA) (wf : nfa.WellFormed) (p : s.ValidPos) :
                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    @[irreducible]
                    def Regex.VM.captureNext.go {s : String} (σ : Strategy s) (nfa : NFA) (wf : nfa.WellFormed) (p : s.ValidPos) (matched : Option σ.Update) (current next : SearchState σ nfa) :
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      def Regex.VM.captureNextBuf {s : String} (nfa : NFA) (wf : nfa.WellFormed) (bufferSize : Nat) (p : s.ValidPos) :
                      Option (Buffer s bufferSize)
                      Equations
                      Instances For