• 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
                  • Ppstate
                  • Plexeme
                  • Pnumber
                  • Macro-info
                  • Macro-add
                  • Init-ppstate
                  • Plexeme-token/newline-p
                    • Newline
                    • Plexeme-option
                    • Macro-info-option
                    • Macro-table
                    • Plexeme+span
                    • Update-ppstate->lexemes-unread
                    • Update-ppstate->lexemes-read
                    • Update-ppstate->lexemes-length
                    • Update-ppstate->chars-unread
                    • Update-ppstate->chars-read
                    • Update-ppstate->version
                    • Update-ppstate->position
                    • Update-ppstate->macros
                    • Update-ppstate->chars-length
                    • Macro-lookup
                    • Update-ppstate->bytes
                    • Update-ppstate->size
                    • Plexeme-token/space-p
                    • Plexeme-tokenp
                    • Ppstate->gcc
                    • Plexeme-list-token/space-p
                    • Ppstate->size
                    • Ppstate->lexemes-unread
                    • Ppstate->lexemes-read
                    • Ppstate->lexemes-length
                    • Ppstate->chars-unread
                    • Ppstate->bytes
                    • Plexeme-list-token/newline-p
                    • Plexeme-list-not-token/newline-p
                    • Ident-macroinfo-alist
                    • Update-ppstate->lexeme
                    • Update-ppstate->char
                    • Ppstate->version
                    • Ppstate->macros
                    • Ppstate->chars-read
                    • Ppstate->chars-length
                    • Plexeme-list-tokenp
                    • Plexeme-list-not-tokenp
                    • Macro-table-init
                    • Ppstate->lexeme
                    • Ppstate->char
                    • Ppstate-fix
                    • Plexeme+span-list
                    • Plexeme-list
                    • Irr-pnumber
                    • Irr-plexeme
                    • Irr-macro-table
                    • Ppstate->position
                  • Pread-token/newline
                  • Pread-token
                  • Preprocessor-lexer
                  • Pproc-files
                  • Preprocessor-printer
                  • 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-states

    Plexeme-token/newline-p

    Check if a preprocessing lexeme is a token or a newline.

    Signature
    (plexeme-token/newline-p lexeme) → yes/no
    Arguments
    lexeme — Guard (plexemep lexeme).
    Returns
    yes/no — Type (booleanp yes/no).

    During preprocessing, newline characters are significant: see grammar rules in [C17:6.10/1]. Preprocessing is largely line-oriented. In our preprocessor, newline characters are captured as newline lexemes (see plexeme).

    [C17:5.1.1.2/3] requires that comments, including line comments, are turned into single space characters; we do not actually do that, to preserve the comment information, but conceptually we need our preprocessor to behave as if we did. This means that, if we are looking for tokens or newline characters, we must also consider line comments, because they are always followed by a newline character; recall that line comments exclude the ending newline [C17:6.4.9/2]. Although block comments may include newlines, those are part of the comment: the whole comment is turned into a space character, and so there are no newlines to consider here.

    Definitions and Theorems

    Function: plexeme-token/newline-p

    (defun plexeme-token/newline-p (lexeme)
      (declare (xargs :guard (plexemep lexeme)))
      (or (plexeme-tokenp lexeme)
          (plexeme-case lexeme :newline)
          (plexeme-case lexeme :line-comment)))

    Theorem: booleanp-of-plexeme-token/newline-p

    (defthm booleanp-of-plexeme-token/newline-p
      (b* ((yes/no (plexeme-token/newline-p lexeme)))
        (booleanp yes/no))
      :rule-classes :rewrite)

    Theorem: plexeme-token/newline-p-of-plexeme-fix-lexeme

    (defthm plexeme-token/newline-p-of-plexeme-fix-lexeme
      (equal (plexeme-token/newline-p (plexeme-fix lexeme))
             (plexeme-token/newline-p lexeme)))

    Theorem: plexeme-token/newline-p-plexeme-equiv-congruence-on-lexeme

    (defthm plexeme-token/newline-p-plexeme-equiv-congruence-on-lexeme
      (implies (plexeme-equiv lexeme lexeme-equiv)
               (equal (plexeme-token/newline-p lexeme)
                      (plexeme-token/newline-p lexeme-equiv)))
      :rule-classes :congruence)