• 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
          • Vl-module
          • Vl-vardecl
          • Expressions
          • Vl-fundecl
          • Vl-assign
          • Vl-gateinst
          • Vl-modinst
          • Vl-commentmap
            • Vl-commentmap-p
              • Vl-descriptionlist-inject-comments-aux
              • Vl-commentmap-entry-sort
              • Vl-commentmap-falp
              • Vl-adjust-minloc-for-comments
              • Vl-kill-whitespace-and-comments
                • Vl-kill-whitespace-and-comments-core
              • Vl-description-inject-comments
              • Vl-gather-comments
              • Vl-descriptionlist-inject-comments
              • Vl-description-add-warning
              • Vl-description-set-comments
              • Vl-gather-comments-fal
              • Vl-commentmap-fal
              • Vl-description->minloc
              • Vl-description->maxloc
              • Vl-description->comments
              • Vl-description-has-comments-p
            • Vl-commentmap-fix
            • Vl-commentmap-equiv
          • Vl-portdecl
          • Vl-taskdecl
          • Vl-design
          • Vl-interface
          • Vl-plainarglist->exprs
          • Vl-taskdecllist->names
          • Vl-fundecllist->names
          • Vl-package
          • Vl-port
          • Vl-udp
          • Vl-paramdecl
          • Vl-genelement
          • Vl-cycledelayrange
          • Vl-namedarg
          • Vl-sort-blockitems-aux
          • Vl-distitem
          • Vl-gatedelay
          • Vl-repetition
          • Vl-typedef
          • Vl-range
          • Vl-gatestrength
          • Vl-program
          • Vl-config
          • Vl-always
          • Vl-datatype-update-dims
          • Vl-import
          • Vl-enumbasetype
          • Vl-repeateventcontrol
          • Vl-paramargs
          • Vl-initial
          • Vl-eventcontrol
          • Vl-udpsymbol-p
          • Vl-maybe-range
          • Vl-maybe-nettypename
          • Vl-maybe-gatestrength
          • Vl-maybe-gatedelay
          • Vl-maybe-delayoreventcontrol
          • Vl-alias
          • Maybe-string-fix
          • Vl-maybe-packeddimension
          • Vl-fwdtypedef
          • Vl-evatom
          • Vl-packeddimension-p
          • Vl-maybe-udpsymbol
          • Vl-maybe-module
          • Vl-maybe-direction
          • Vl-maybe-datatype
          • Vl-maybe-cstrength
          • Vl-direction-p
          • Vl-arguments
          • Vl-maybe-design
          • Vl-udpline
          • Vl-exprdist
          • Vl-context1
          • Vl-genvar
          • Vl-enumitem
          • Vl-datatype-update-udims
          • Vl-datatype-update-pdims
          • Vl-modelement
          • Vl-udpedge
          • Vl-delaycontrol
          • Vl-context
          • Vl-sort-blockitems
          • Vl-distweighttype-p
          • Vl-ctxelement->loc
          • Vl-blockitem
          • Vl-vardecllist
          • Vl-module->ifports
          • Vl-modelement->loc
          • Vl-ctxelement
          • Vl-coretypename-p
          • Vl-packeddimensionlist
          • Vl-modelementlist->genelements
          • Vl-gatetype-p
          • Vl-paramdecllist
          • Vl-lifetime-p
          • Vl-datatype->udims
          • Vl-datatype->pdims
          • Vl-timeunit-p
          • Vl-repetitiontype-p
          • Vl-port->name
          • Vl-importlist
          • Vl-genelement->loc
          • Vl-delayoreventcontrol
          • Vl-cstrength-p
          • Statements
          • Vl-udpentry-p
          • Vl-packeddimension-fix
          • Vl-nettypename-p
          • Vl-portdecllist
          • Vl-port->loc
          • Vl-enumbasekind-fix
          • Vl-arguments->args
          • Vl-taskdecllist
          • Vl-portlist
          • Vl-importpart-p
          • Vl-importpart-fix
          • Vl-fundecllist
          • Vl-blockstmt-p
          • Vl-assignlist
          • Vl-alwaystype-p
          • Vl-typedeflist
          • Vl-syntaxversion-p
          • Vl-randomqualifier-p
          • Vl-modinstlist
          • Vl-gateinstlist
          • Vl-blockitemlist
          • Vl-udptable
          • Vl-udplist
          • Vl-udpentrylist
          • Vl-programlist
          • Vl-paramvaluelist
          • Vl-packagelist
          • Vl-namedparamvaluelist
          • Vl-namedarglist
          • Vl-modulelist
          • Vl-modportlist
          • Vl-modport-portlist
          • Vl-interfacelist
          • Vl-initiallist
          • Vl-genvarlist
          • Vl-fwdtypedeflist
          • Vl-evatomlist
          • Vl-enumitemlist
          • Vl-distlist
          • Vl-configlist
          • Vl-alwayslist
          • Vl-aliaslist
          • Vl-regularportlist
          • Vl-rangelist-list
          • Vl-rangelist
          • Vl-paramdecllist-list
          • Vl-modelementlist
          • Vl-maybe-range-list
          • Vl-interfaceportlist
          • Vl-argumentlist
          • Data-types
        • Getting-started
        • Utilities
        • Loader
        • Transforms
        • Lint
        • Mlib
        • Server
        • Kit
        • Printer
        • Esim-vl
        • Well-formedness
      • Sv
      • Fgl
      • Vwsim
      • Vl
      • X86isa
      • Svl
      • Rtl
    • Software-verification
    • Math
    • Testing-utilities
  • Tokens
  • Vl-commentmap-p

Vl-kill-whitespace-and-comments

Prepare a token list for parsing by removing whitespace and comment tokens, and construct a comment map from any comment tokens.

Signature
(vl-kill-whitespace-and-comments tokens) 
  → 
(mv filtered-tokens comment-map)
Arguments
tokens — Token list to process.
    Guard (vl-tokenlist-p tokens).
Returns
filtered-tokens — A copy of tokens with comments and whitespace removed.
comment-map — A comment map generated from the comment tokens.

Definitions and Theorems

Function: vl-kill-whitespace-and-comments

(defun vl-kill-whitespace-and-comments (tokens)
 (declare (xargs :guard (vl-tokenlist-p tokens)))
 (let ((__function__ 'vl-kill-whitespace-and-comments))
  (declare (ignorable __function__))
  (mbe
   :logic
   (b*
    (((when (atom tokens)) (mv nil nil))
     ((mv tokens-rest cmap-rest)
      (vl-kill-whitespace-and-comments (cdr tokens)))
     (type (vl-token->type (car tokens)))
     (new-tokens (if (or (eq type :vl-ws)
                         (eq type :vl-comment))
                     tokens-rest
                   (cons (car tokens) tokens-rest)))
     (new-cmap
       (if
        (eq type :vl-comment)
        (cons (cons (change-vl-location (vl-token->loc (car tokens))
                                        :col 0)
                    (vl-token->string (car tokens)))
              cmap-rest)
        cmap-rest)))
    (mv new-tokens new-cmap))
   :exec
   (b* (((local-stobjs nrev nrev2)
         (mv tokens cmap nrev nrev2))
        ((mv nrev nrev2)
         (vl-kill-whitespace-and-comments-core tokens nrev nrev2))
        ((mv tokens nrev) (nrev-finish nrev))
        ((mv cmap nrev2) (nrev-finish nrev2)))
     (mv tokens cmap nrev nrev2)))))

Theorem: vl-kill-whitespace-and-comments-mvtypes-0

(defthm vl-kill-whitespace-and-comments-mvtypes-0
  (true-listp (mv-nth 0
                      (vl-kill-whitespace-and-comments tokens)))
  :rule-classes :type-prescription)

Theorem: vl-kill-whitespace-and-comments-mvtypes-1

(defthm vl-kill-whitespace-and-comments-mvtypes-1
  (true-listp (mv-nth 1
                      (vl-kill-whitespace-and-comments tokens)))
  :rule-classes :type-prescription)

Theorem: vl-tokenlist-p-of-vl-kill-whitespace-and-comments

(defthm vl-tokenlist-p-of-vl-kill-whitespace-and-comments
  (implies (force (vl-tokenlist-p tokens))
           (vl-tokenlist-p
                (mv-nth 0
                        (vl-kill-whitespace-and-comments tokens)))))

Theorem: vl-commentmap-p-of-vl-kill-whitespace-and-comments

(defthm vl-commentmap-p-of-vl-kill-whitespace-and-comments
  (implies (force (vl-tokenlist-p tokens))
           (vl-commentmap-p
                (mv-nth 1
                        (vl-kill-whitespace-and-comments tokens)))))

Subtopics

Vl-kill-whitespace-and-comments-core