• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
        • Warnings
        • Primitives
        • Use-set
        • Syntax
        • Getting-started
        • Utilities
        • Loader
          • Preprocessor
          • Vl-loadconfig
          • Lexer
            • Lex-strings
            • Lex-identifiers
            • Vl-typo-uppercase-p
            • Vl-typo-number-p
            • Vl-typo-lowercase-p
            • Lex-numbers
            • Chartypes
            • Vl-lex
            • Defchar
            • Tokens
              • Vl-inttoken-p
              • Vl-plaintoken-p
              • Vl-token->etext
              • Vl-token->type
              • Vl-token-p
              • Vl-idtoken-p
              • Vl-timetoken-p
              • Vl-stringtoken-p
              • Vl-kill-whitespace-and-comments
              • Vl-tokenlist->etext
              • Vl-extinttoken-p
              • Vl-sysidtoken-p
              • Vl-realtoken-p
              • Vl-tokenlist-p
              • Vl-tokenlist->string-with-spaces
                • Vl-tokenlist->string-with-spaces-aux
              • Vl-idtoken-list-p
              • Vl-token->loc
              • Vl-plaintokentypelist-p
              • Vl-tokenlistlist-p
              • Vl-token->string
            • 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
          • Vl-loadstate
          • Parser
          • Vl-load-merge-descriptions
          • Scope-of-defines
          • Vl-load-file
          • Vl-flush-out-descriptions
          • Vl-description
          • Vl-loadresult
          • Vl-read-file
          • Vl-find-basename/extension
          • Vl-find-file
          • Vl-read-files
          • Extended-characters
          • Vl-load
          • Vl-load-main
          • Vl-load-description
          • Vl-descriptions-left-to-load
          • Inject-warnings
          • Vl-load-descriptions
          • Vl-load-files
          • Vl-load-summary
          • Vl-collect-modules-from-descriptions
          • Vl-descriptionlist
        • Transforms
        • Lint
        • Mlib
        • Server
        • Kit
        • Printer
        • Esim-vl
        • Well-formedness
      • Sv
      • Fgl
      • Vwsim
      • Vl
      • X86isa
      • Svl
      • Rtl
    • Software-verification
    • Math
    • Testing-utilities
  • Tokens

Vl-tokenlist->string-with-spaces

Join together a token list into a single string, putting a single space between each token.

Signature
(vl-tokenlist->string-with-spaces x) → str
Arguments
x — Guard (vl-tokenlist-p x).
Returns
str — Type (stringp str).

This is occasionally useful for error reporting in the parser, where typically the tokens have already had the comments/whitespace stripped out of them. So, to display them in any sort of sensible way, we need to at least insert spaces between them.

Definitions and Theorems

Function: vl-tokenlist->string-with-spaces

(defun vl-tokenlist->string-with-spaces (x)
  (declare (xargs :guard (vl-tokenlist-p x)))
  (let ((__function__ 'vl-tokenlist->string-with-spaces))
    (declare (ignorable __function__))
    (mbe :logic
         (cond ((atom x) "")
               ((atom (cdr x))
                (vl-token->string (car x)))
               (t (cat (vl-token->string (car x))
                       " "
                       (vl-tokenlist->string-with-spaces (cdr x)))))
         :exec (str::rchars-to-string
                    (vl-tokenlist->string-with-spaces-aux x nil)))))

Theorem: stringp-of-vl-tokenlist->string-with-spaces

(defthm stringp-of-vl-tokenlist->string-with-spaces
  (b* ((str (vl-tokenlist->string-with-spaces x)))
    (stringp str))
  :rule-classes :type-prescription)

Subtopics

Vl-tokenlist->string-with-spaces-aux