• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • 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
        • C
          • Syntax-for-tools
            • Formalized-subset
            • Mapping-to-language-definition
            • Input-files
            • Compilation-database
            • Printer
            • Output-files
            • Abstract-syntax-operations
            • Implementation-environments
            • Abstract-syntax
            • Concrete-syntax
            • Disambiguation
            • Validation
            • Gcc-builtins
            • Preprocessing
              • Preprocessor
                • Preprocessor-states
                • Preprocessor-printer
                • Pread-token/newline
                • Pread-token
                • Preprocessor-lexer
                  • Plex-lexeme
                  • Plex-block-comment
                  • Plex-pp-number
                  • Plex-line-comment
                  • Plex-identifier
                  • Plex-escape-sequence
                  • Plex-spaces
                  • Plex-*-hexadecimal-digit
                  • Plex-*-s-char
                  • Plex-*-c-char
                  • Plex-header-name
                  • Plex-*-q-char
                  • Plex-*-h-char
                  • Plex-character-constant
                  • Plex-hexadecimal-digit
                  • Plex-string-literal
                    • Plex-hex-quad
                  • Pproc-files
                  • Pproc-file
                  • Filepath-plexeme-list-alist-to-filepath-filedata-map
                  • Filepath-plexeme-list-alist
                  • Preprocessor-reader
                  • Preprocessor-messages
                • External-preprocessing
              • Parsing
            • Atc
            • Transformation-tools
            • Language
            • Representation
            • Insertion-sort
            • Pack
          • Soft
          • Bv
          • Imp-language
          • Ethereum
          • Event-macros
          • Java
          • Riscv
          • Bitcoin
          • Zcash
          • Yul
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Axe
          • Lists-light
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Preprocessor-lexer

    Plex-string-literal

    Lex a string literal during preprocessing.

    Signature
    (plex-string-literal eprefix? first-pos ppstate) 
      → 
    (mv erp lexeme span new-ppstate)
    Arguments
    eprefix? — Guard (eprefix-optionp eprefix?).
    first-pos — Guard (positionp first-pos).
    ppstate — Guard (ppstatep ppstate).
    Returns
    lexeme — Type (plexemep lexeme).
    span — Type (spanp span).
    new-ppstate — Type (ppstatep new-ppstate), given (ppstatep ppstate).

    This is the same as lex-string-literal, but it operates on preprocessor states instead of parser states.

    Definitions and Theorems

    Function: plex-string-literal

    (defun plex-string-literal (eprefix? first-pos ppstate)
      (declare (xargs :stobjs (ppstate)))
      (declare (xargs :guard (and (eprefix-optionp eprefix?)
                                  (positionp first-pos)
                                  (ppstatep ppstate))))
      (b* (((reterr)
            (irr-plexeme)
            (irr-span)
            ppstate)
           ((erp schars closing-dquote-pos ppstate)
            (plex-*-s-char ppstate))
           (span (make-span :start first-pos
                            :end closing-dquote-pos)))
        (retok (plexeme-string (stringlit eprefix? schars))
               span ppstate)))

    Theorem: plexemep-of-plex-string-literal.lexeme

    (defthm plexemep-of-plex-string-literal.lexeme
      (b* (((mv acl2::?erp ?lexeme ?span ?new-ppstate)
            (plex-string-literal eprefix? first-pos ppstate)))
        (plexemep lexeme))
      :rule-classes :rewrite)

    Theorem: spanp-of-plex-string-literal.span

    (defthm spanp-of-plex-string-literal.span
      (b* (((mv acl2::?erp ?lexeme ?span ?new-ppstate)
            (plex-string-literal eprefix? first-pos ppstate)))
        (spanp span))
      :rule-classes :rewrite)

    Theorem: ppstatep-of-plex-string-literal.new-ppstate

    (defthm ppstatep-of-plex-string-literal.new-ppstate
      (implies (ppstatep ppstate)
               (b* (((mv acl2::?erp ?lexeme ?span ?new-ppstate)
                     (plex-string-literal eprefix? first-pos ppstate)))
                 (ppstatep new-ppstate)))
      :rule-classes :rewrite)

    Theorem: ppstate->size-of-plex-string-literal-uncond

    (defthm ppstate->size-of-plex-string-literal-uncond
      (b* (((mv acl2::?erp ?lexeme ?span ?new-ppstate)
            (plex-string-literal eprefix? first-pos ppstate)))
        (<= (ppstate->size new-ppstate)
            (ppstate->size ppstate)))
      :rule-classes :linear)

    Theorem: ppstate->size-of-plex-string-literal-cond

    (defthm ppstate->size-of-plex-string-literal-cond
      (b* (((mv acl2::?erp ?lexeme ?span ?new-ppstate)
            (plex-string-literal eprefix? first-pos ppstate)))
        (implies (not erp)
                 (<= (ppstate->size new-ppstate)
                     (1- (ppstate->size ppstate)))))
      :rule-classes :linear)