• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • Soft
        • C
        • Bv
        • Imp-language
        • Event-macros
        • Java
        • Bitcoin
        • Ethereum
        • Yul
          • Transformations
          • Language
            • Abstract-syntax
            • Dynamic-semantics
            • Concrete-syntax
              • Lexer
                • Lex-keyword
                • Lex-group-escape-sequence-single
                • Lex-symbol
                • Lex-rest-of-block-comment-fns
                • Lex-group-for-hex-string
                • Lex-hex-digit
                • Lex-group-escape-sequence-body
                • Lex-whitespace-char
                • Lex-string-literal
                  • Lex-literal
                  • Lex-identifier-start
                  • Lex-hex-string
                  • Lex-single-quoted-printable
                  • Lex-double-quoted-printable
                  • Lex-group-optional-underbar-and-two-hex-digits
                  • Lex-escape-sequence
                  • Lex-token
                  • Lex-not-star-or-slash
                  • Lex-not-lf-or-cr
                  • Lex-group-squoted-or-escape
                  • Lex-group-dquoted-or-escape
                  • Lex-optional-sequence-of-2hex-digits
                  • Lex-decimal-number
                  • Lex-lexeme
                  • Lex-identifier-rest
                  • Lex-end-of-line-comment
                  • Lex-nonzero-decimal-digit
                  • Lex-repetition-*-optional-underbar-and-two-hex-digits
                  • Lex-not-star
                  • Lex-comment
                  • Lex-boolean
                  • Lex-block-comment
                  • Lex-uppercase-letter
                  • Lex-lowercase-letter
                  • Lex-identifier
                  • Lex-hex-number
                  • Lex-decimal-digit
                  • Lex-squote
                  • Lex-repetition-4-hex-digits
                  • Lex-optional-underbar
                  • Lex-dquote
                  • Lex-repetition-*-squoted-or-escape
                  • Lex-repetition-*-dquoted-or-escape
                  • Lex-repetition-*-whitespace-char
                  • Lex-repetition-*-identifier-rest
                  • Lex-repetition-2-hex-digits
                  • Lex-lf
                  • Lex-cr
                  • Lex-repetition-*-not-lf-or-cr
                  • Lex-repetition-*-decimal-digit
                  • Lexemeize-yul
                  • Lex-repetition-*-lexeme
                  • Lex-repetition-*-hex-digit
                  • *defparse-yul-group-table*
                  • Lex-whitespace
                  • Lexemeize-yul-bytes
                  • *defparse-yul-repetition-table*
                  • *defparse-yul-option-table*
                • Parser
                • Grammar-old
                • Grammar
                • Tokenizer
              • Static-soundness
              • Static-semantics
              • Errors
            • Yul-json
          • Zcash
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Lists-light
          • Axe
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Lexer

    Lex-string-literal

    Parse a string-literal.

    Signature
    (lex-string-literal abnf::input) 
      → 
    (mv abnf::tree abnf::rest-input)
    Arguments
    abnf::input — Guard (nat-listp abnf::input).
    Returns
    abnf::tree — Type (abnf::tree-resultp abnf::tree).
    abnf::rest-input — Type (nat-listp abnf::rest-input).

    Definitions and Theorems

    Function: lex-string-literal

    (defun lex-string-literal (abnf::input)
     (declare (xargs :guard (nat-listp abnf::input)))
     (let ((__function__ 'lex-string-literal))
      (declare (ignorable __function__))
      (b*
       (((mv abnf::treess abnf::input)
         (b* (((mv abnf::treess1 abnf::input1)
               (b* (((mv abnf::tree abnf::input)
                     (lex-dquote abnf::input))
                    ((when (reserrp abnf::tree))
                     (mv (fty::reserrf-push abnf::tree)
                         abnf::input))
                    (abnf::trees1 (list abnf::tree))
                    ((mv abnf::trees2 abnf::input)
                     (lex-repetition-*-dquoted-or-escape abnf::input))
                    ((when (reserrp abnf::trees2))
                     (mv (fty::reserrf-push abnf::trees2)
                         abnf::input))
                    ((mv abnf::tree abnf::input)
                     (lex-dquote abnf::input))
                    ((when (reserrp abnf::tree))
                     (mv (fty::reserrf-push abnf::tree)
                         abnf::input))
                    (abnf::trees3 (list abnf::tree))
                    (abnf::treess (list abnf::trees1
                                        abnf::trees2 abnf::trees3)))
                 (mv abnf::treess abnf::input)))
              ((when (not (reserrp abnf::treess1)))
               (mv abnf::treess1 abnf::input1))
              ((mv abnf::treess2 abnf::input1)
               (b* (((mv abnf::tree abnf::input)
                     (lex-squote abnf::input))
                    ((when (reserrp abnf::tree))
                     (mv (fty::reserrf-push abnf::tree)
                         abnf::input))
                    (abnf::trees1 (list abnf::tree))
                    ((mv abnf::trees2 abnf::input)
                     (lex-repetition-*-squoted-or-escape abnf::input))
                    ((when (reserrp abnf::trees2))
                     (mv (fty::reserrf-push abnf::trees2)
                         abnf::input))
                    ((mv abnf::tree abnf::input)
                     (lex-squote abnf::input))
                    ((when (reserrp abnf::tree))
                     (mv (fty::reserrf-push abnf::tree)
                         abnf::input))
                    (abnf::trees3 (list abnf::tree))
                    (abnf::treess (list abnf::trees1
                                        abnf::trees2 abnf::trees3)))
                 (mv abnf::treess abnf::input)))
              ((when (not (reserrp abnf::treess2)))
               (mv abnf::treess2 abnf::input1)))
          (mv
           (reserrf
            (list
             :found (list abnf::treess1 abnf::treess2)
             :required
             '(((:repetition (:repeat 1 (:finite 1))
                             (:rulename (:rulename "dquote")))
                (:repetition
                 (:repeat 0 (:infinity))
                 (:group
                  (((:repetition
                     (:repeat 1 (:finite 1))
                     (:rulename (:rulename "double-quoted-printable"))))
                   ((:repetition
                         (:repeat 1 (:finite 1))
                         (:rulename (:rulename "escape-sequence")))))))
                (:repetition (:repeat 1 (:finite 1))
                             (:rulename (:rulename "dquote"))))
               ((:repetition (:repeat 1 (:finite 1))
                             (:rulename (:rulename "squote")))
                (:repetition
                 (:repeat 0 (:infinity))
                 (:group
                  (((:repetition
                     (:repeat 1 (:finite 1))
                     (:rulename (:rulename "single-quoted-printable"))))
                   ((:repetition
                         (:repeat 1 (:finite 1))
                         (:rulename (:rulename "escape-sequence")))))))
                (:repetition (:repeat 1 (:finite 1))
                             (:rulename (:rulename "squote")))))))
           abnf::input)))
        ((when (reserrp abnf::treess))
         (mv (fty::reserrf-push abnf::treess)
             (nat-list-fix abnf::input))))
       (mv (abnf::make-tree-nonleaf
                :rulename? (abnf::rulename "string-literal")
                :branches abnf::treess)
           abnf::input))))

    Theorem: tree-resultp-of-lex-string-literal.tree

    (defthm tree-resultp-of-lex-string-literal.tree
      (b* (((mv abnf::?tree abnf::?rest-input)
            (lex-string-literal abnf::input)))
        (abnf::tree-resultp abnf::tree))
      :rule-classes :rewrite)

    Theorem: nat-listp-of-lex-string-literal.rest-input

    (defthm nat-listp-of-lex-string-literal.rest-input
      (b* (((mv abnf::?tree abnf::?rest-input)
            (lex-string-literal abnf::input)))
        (nat-listp abnf::rest-input))
      :rule-classes :rewrite)

    Theorem: len-of-lex-string-literal-<=

    (defthm len-of-lex-string-literal-<=
      (b* (((mv abnf::?tree abnf::?rest-input)
            (lex-string-literal abnf::input)))
        (<= (len abnf::rest-input)
            (len abnf::input)))
      :rule-classes :linear)

    Theorem: len-of-lex-string-literal-<

    (defthm len-of-lex-string-literal-<
      (b* (((mv abnf::?tree abnf::?rest-input)
            (lex-string-literal abnf::input)))
        (implies (not (reserrp abnf::tree))
                 (< (len abnf::rest-input)
                    (len abnf::input))))
      :rule-classes :linear)

    Theorem: lex-string-literal-of-nat-list-fix-input

    (defthm lex-string-literal-of-nat-list-fix-input
      (equal (lex-string-literal (nat-list-fix abnf::input))
             (lex-string-literal abnf::input)))

    Theorem: lex-string-literal-nat-list-equiv-congruence-on-input

    (defthm lex-string-literal-nat-list-equiv-congruence-on-input
      (implies (acl2::nat-list-equiv abnf::input input-equiv)
               (equal (lex-string-literal abnf::input)
                      (lex-string-literal input-equiv)))
      :rule-classes :congruence)