Documentation

Regex.VM.Basic

structure Regex.VM.SearchState (σ : Strategy) (nfa : NFA) :
Instances For
    @[reducible, inline]
    abbrev Regex.VM.εStack (σ : Strategy) (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 (σ : Strategy) (nfa : NFA) (it : String.Iterator) (node : NFA.Node) (inBounds : node.inBounds nfa.nodes.size) (update : σ.Update) (stack : εStack σ nfa) :
        εStack σ nfa
        Equations
        Instances For
          @[irreducible]
          def Regex.VM.εClosure (σ : Strategy) (nfa : NFA) (wf : nfa.WellFormed) (it : String.Iterator) (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 it matched next [] = (matched, next)
          Instances For
            def Regex.VM.stepChar (σ : Strategy) (nfa : NFA) (wf : nfa.WellFormed) (it : String.Iterator) (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 (σ : Strategy) (nfa : NFA) (wf : nfa.WellFormed) (it : String.Iterator) (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 (σ : Strategy) (nfa : NFA) (wf : nfa.WellFormed) (it : String.Iterator) (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 (σ : Strategy) (nfa : NFA) (wf : nfa.WellFormed) (it : String.Iterator) :
                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    @[irreducible]
                    def Regex.VM.captureNext.go (σ : Strategy) (nfa : NFA) (wf : nfa.WellFormed) (it : String.Iterator) (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 (nfa : NFA) (wf : nfa.WellFormed) (bufferSize : Nat) (it : String.Iterator) :
                      Option (Buffer bufferSize)
                      Equations
                      Instances For