• 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
              • Parser
                • Parse-keyword
                • Parse-variable-declaration
                • Parse-symbol
                • Parse-literal
                • Parse-identifier
                • Hex-chars-and-uscores-to-hex-string-rest-element-list
                • Parse-assignment-statement
                • Parse-identifier-and-open-paren
                • Parse-*-comma-identifier
                • Parse-*-.-identifier
                • Parse-continue-statement
                • Parse-*-comma-path
                • Parse-path
                • Parse-leave-statement
                • Parse-break-statement
                • Cst2ast-hex-string
                  • Cst2ast-string-literal-content
                  • Cst2ast-escape-sequence
                  • Cst2ast-string-literal-contents
                  • Cst2ast-quoted-printable
                  • Parse-yul
                  • Cst2ast-string-literal
                  • Parse-yul-bytes
                  • Cst2ast-hex-number
                  • Cst2ast-uhhhh
                  • Cst2ast-literal-kind
                  • Cst2ast-decimal-number
                  • Cst2ast-xhh
                  • Cst2ast-single-char
                  • Cst2ast-boolean
                  • Parse-*-case-clause
                  • Looks-like-hex-string-fringe
                  • Cst2ast-hex-digit-char-list
                  • Parse-*-statement
                  • Parse-*-comma-expression
                  • Parse-switch-statement
                  • Parse-if-statement
                  • Parse-for-statement
                  • Parse-expression
                  • Parse-case-clause
                  • Parse-fundef
                  • Parse-function-call
                  • Parse-block
                  • *single-quote-tree-list*
                  • *double-quote-tree-list*
                  • *yul-keywords*
                  • *single-quoted-content-rulenames*
                  • *list-leafterm-x*
                  • *list-leafterm-u*
                  • *list-leafterm-92*
                  • *double-quoted-content-rulenames*
                  • *yul-symbols*
                • 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
    • Parser

    Cst2ast-hex-string

    Given a :nonleaf tree with rulename "hex-string", return the appropriate literal AST node.

    Signature
    (cst2ast-hex-string tree) → ast-node?
    Arguments
    tree — Guard (abnf::treep tree).
    Returns
    ast-node? — Type (literal-optionp ast-node?).

    Definitions and Theorems

    Function: cst2ast-hex-string

    (defun cst2ast-hex-string (tree)
     (declare (xargs :guard (abnf::treep tree)))
     (let ((__function__ 'cst2ast-hex-string))
      (declare (ignorable __function__))
      (b*
       (((unless (and (abnf::treep tree)
                      (abnf::tree-case tree :nonleaf)))
         nil)
        (fringe (abnf::tree-list-list->string
                     (abnf::tree-nonleaf->branches tree)))
        ((unless (and (true-listp fringe)
                      (unsigned-byte-listp 8 fringe)
                      (>= (len fringe) 5)))
         nil)
        (double-quote-p (equal (nth 3 fringe) (char-code #\")))
        (hex-chars-and-underbars (subseq fringe 4 (- (len fringe) 1)))
        ((unless (unsigned-byte-listp 8 hex-chars-and-underbars))
         (raise "Internal error: character codes ~x0."
                hex-chars-and-underbars))
        (hex-chars-and-underbars (nats=>chars hex-chars-and-underbars))
        ((when (endp hex-chars-and-underbars))
         (make-literal-hex-string
              :get (make-hex-string :content nil
                                    :double-quote-p double-quote-p)))
        ((unless
          (and
              (consp hex-chars-and-underbars)
              (consp (cdr hex-chars-and-underbars))
              (str::hex-digit-char-p (first hex-chars-and-underbars))
              (str::hex-digit-char-p (second hex-chars-and-underbars))))
         (raise "Internal error: characters ~x0."
                hex-chars-and-underbars))
        (digit1 (make-hex-digit :get (first hex-chars-and-underbars)))
        (digit2 (make-hex-digit :get (second hex-chars-and-underbars)))
        (pair (make-hex-pair :1st digit1 :2nd digit2))
        (rest (hex-chars-and-uscores-to-hex-string-rest-element-list
                   (cddr hex-chars-and-underbars)))
        (content (make-hex-string-content :first pair
                                          :rest rest))
        (hex-string (make-hex-string :content content
                                     :double-quote-p double-quote-p)))
       (make-literal-hex-string :get hex-string))))

    Theorem: literal-optionp-of-cst2ast-hex-string

    (defthm literal-optionp-of-cst2ast-hex-string
      (b* ((ast-node? (cst2ast-hex-string tree)))
        (literal-optionp ast-node?))
      :rule-classes :rewrite)