TorchLean API

NN.Verification.Util.TextCursor

Text cursor primitives for verification parsers #

ODE and PINN certificates both contain small mathematical expression languages. This module owns their shared byte-position cursor, fuel-bounded scanning, and decimal literal parsing. Grammar and AST decisions remain in the respective verifier modules.

A source string paired with the current raw byte position.

Instances For
    @[inline]

    Inspect the current character without advancing the cursor.

    Instances For
      @[inline]

      Advance by one character, preserving the source text.

      Instances For
        @[inline]

        Remaining bytes plus one, suitable as a budget for a single linear scan.

        Instances For
          @[inline]

          Whether the cursor has reached or passed the source's raw end position.

          Instances For

            ASCII whitespace accepted by the verification expression languages.

            Instances For

              Skip characters satisfying predicate, bounded by explicit recursion fuel.

              Instances For
                def NN.Verification.Util.TextCursor.takeWhileFuel (fuel : Nat) (predicate : Char → Bool) (accumulator : String) (cursor : Cursor) :

                Consume characters satisfying predicate, bounded by explicit recursion fuel.

                Instances For

                  Fold a string of decimal digits into a natural number; callers guarantee digit-only input.

                  This is deliberately not String.toNat?, whose grammar also accepts _ digit separators, which the ODE/PDE literal languages do not.

                  Instances For

                    Convert decimal digits to a natural number, rejecting empty or nondigit input.

                    Instances For

                      Parse a whitespace-prefixed unsigned decimal natural using a caller-supplied scan budget.

                      Instances For

                        Parse a finite signed decimal Float without scientific notation.

                        Instances For