• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • 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
              • Vl-read-string-aux
              • Vl-read-octal-string-escape
              • Vl-read-string-escape-sequence
              • Vl-read-hex-string-escape
              • Vl-read-string
                • Vl-read-string-prefix/remainder-thms
              • Vl-lex-string
            • 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
            • 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
  • Lex-strings

Vl-read-string

Signature
(vl-read-string echars st) → (mv str? prefix remainder)
Arguments
echars — Characters we're reading, which we assume begin with a double-quote.
    Guard (and (vl-echarlist-p echars) (consp echars) (equal (vl-echar->char (car echars)) #\")) .
st — Guard (vl-lexstate-p st).
Returns
str? — NIL on failure. A stringp with the interpreted characters from the string literal otherwise. That is, we'll have already expanded things like \n into proper newline characters.
    Type (equal (stringp str?) (if str? t nil)).
prefix — The matched characters, starting at the opening double quote and extending through the closing double quote, inclusively, on success.
    Type (iff prefix str?).

Definitions and Theorems

Function: vl-read-string

(defun vl-read-string (echars st)
  (declare
       (xargs :guard (and (and (vl-echarlist-p echars)
                               (consp echars)
                               (equal (vl-echar->char (car echars))
                                      #\"))
                          (vl-lexstate-p st))))
  (let ((__function__ 'vl-read-string))
    (declare (ignorable __function__))
    (b* (((mv err eacc vacc remainder)
          (vl-read-string-aux (cdr echars)
                              nil nil st))
         ((when err)
          (mv (cw "Lexer error (~s0) while reading string: ~s1.~%"
                  (vl-location-string (vl-echar->loc (car echars)))
                  err)
              nil echars)))
      (mv (str::rchars-to-string vacc)
          (cons (car echars) (reverse eacc))
          remainder))))

Theorem: return-type-of-vl-read-string.str?

(defthm return-type-of-vl-read-string.str?
  (b* (((mv ?str? ?prefix ?remainder)
        (vl-read-string echars st)))
    (equal (stringp str?) (if str? t nil)))
  :rule-classes :rewrite)

Theorem: return-type-of-vl-read-string.prefix

(defthm return-type-of-vl-read-string.prefix
  (b* (((mv ?str? ?prefix ?remainder)
        (vl-read-string echars st)))
    (iff prefix str?))
  :rule-classes :rewrite)

Subtopics

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