• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
      • Fgl
      • Vwsim
      • Vl
        • Syntax
        • Loader
          • Preprocessor
          • Vl-loadconfig
          • Vl-loadstate
          • Lexer
            • Lex-strings
            • Lex-identifiers
            • Vl-typo-uppercase-p
            • Vl-typo-number-p
            • Vl-typo-lowercase-p
            • Lex-numbers
            • Chartypes
            • Vl-lex
            • Defchar
            • Tokens
            • Lex-keywords
            • Lexstate
            • Make-test-tokens
            • Lexer-utils
              • Def-prefix/remainder-thms
              • Def-token/remainder-thms
              • Vl-read-until-literal
              • Vl-read-through-literal
                • Vl-read-through-literal-prefix/remainder-thms
              • Vl-matches-string-p
              • Vl-read-literal
              • Vl-echarlist-kill-underscores
              • Vl-read-some-literal
            • Lex-comments
            • Vl-typo-uppercase-list-p
            • Vl-typo-lowercase-list-p
            • Vl-typo-number-list-p
          • Parser
          • Vl-load-merge-descriptions
          • Vl-find-basename/extension
          • Vl-load-file
          • Vl-loadresult
          • Scope-of-defines
          • Vl-find-file
          • Vl-flush-out-descriptions
          • Vl-description
          • Vl-read-file
          • Vl-includeskips-report-gather
          • Vl-load-main
          • Extended-characters
          • Vl-load
          • Vl-load-description
          • Vl-descriptions-left-to-load
          • Inject-warnings
          • Vl-preprocess-debug
          • Vl-write-preprocessor-debug-file
          • Vl-read-file-report-gather
          • Vl-load-descriptions
          • Vl-load-files
          • Translate-off
          • Vl-load-read-file-hook
          • Vl-read-file-report
          • Vl-loadstate-pad
          • Vl-load-summary
          • Vl-collect-modules-from-descriptions
          • Vl-loadstate->warnings
          • Vl-iskips-report
          • Vl-descriptionlist
        • Warnings
        • Getting-started
        • Utilities
        • Printer
        • Kit
        • Mlib
        • Transforms
      • X86isa
      • Svl
      • Rtl
    • Software-verification
    • Math
    • Testing-utilities
  • Lexer-utils

Vl-read-through-literal

Match any characters until and through some literal.

Signature
(vl-read-through-literal string echars) 
  → 
(mv successp prefix remainder)
Arguments
echars — Guard (vl-echarlist-p echars).
Returns
successp — Whether we ever found string.
prefix — On success, all characters from echars leading up to and including the first occurrence of string. When string never occurs in echars, then prefix is the entire list of echars and remainder is its final cdr.

Definitions and Theorems

Function: vl-read-through-literal

(defun vl-read-through-literal (string echars)
  (declare (type string string))
  (declare (xargs :guard (vl-echarlist-p echars)))
  (declare (xargs :guard (not (equal string ""))))
  (let ((__function__ 'vl-read-through-literal))
    (declare (ignorable __function__))
    (mbe :logic
         (b* ((string (string-fix string))
              ((mv successp prefix remainder)
               (vl-read-until-literal string echars))
              ((unless successp)
               (mv nil prefix remainder)))
           (mv t
               (append prefix (take (length string) remainder))
               (nthcdr (length string) remainder)))
         :exec
         (b* (((mv successp prefix remainder)
               (vl-read-until-literal-impl string echars nil))
              ((unless successp)
               (mv nil (reverse prefix) remainder))
              (strlen (length string)))
           (mv t
               (reverse (revappend-of-take strlen remainder prefix))
               (rest-n strlen remainder))))))

Theorem: prefix-of-vl-read-through-literal-under-iff

(defthm prefix-of-vl-read-through-literal-under-iff
  (b* (((mv ?successp prefix ?remainder)
        (vl-read-through-literal string echars)))
    (implies (and (stringp string)
                  (not (equal string "")))
             (iff prefix (consp echars)))))

Subtopics

Vl-read-through-literal-prefix/remainder-thms
Prefix and remainder theorems for vl-read-through-literal, automatically generated by def-prefix/remainder-thms.