• 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-printable-not-whitespace-p
              • Vl-simple-id-tail-p
              • Vl-simple-id-head-p
              • Vl-read-escaped-identifier
              • Vl-lex-system-identifier
              • Vl-lex-simple-identifier-or-keyword
                • Vl-lex-simple-identifier-or-keyword-token/remainder-thms
              • Vl-printable-not-whitespace-list-p
              • Vl-simple-id-tail-list-p
              • Vl-simple-id-head-list-p
              • Vl-read-simple-identifier
              • Vl-lex-escaped-identifier
            • Vl-typo-uppercase-p
            • Vl-typo-number-p
            • Vl-typo-lowercase-p
            • Lex-numbers
            • Chartypes
            • Vl-lex
            • Defchar
            • Tokens
            • 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
  • Lex-identifiers
  • Lex-keywords

Vl-lex-simple-identifier-or-keyword

Match either a keyword or an ordinary, simple identifier.

Signature
(vl-lex-simple-identifier-or-keyword echars table) 
  → 
(mv token/nil remainder)
Arguments
echars — The characters we're lexing.
    Guard (vl-echarlist-p echars).
table — The table of keywords we're currently using.
    Guard (vl-keyword-table-p table).

Definitions and Theorems

Function: vl-lex-simple-identifier-or-keyword

(defun vl-lex-simple-identifier-or-keyword (echars table)
  (declare (xargs :guard (and (vl-echarlist-p echars)
                              (vl-keyword-table-p table))))
  (let ((__function__ 'vl-lex-simple-identifier-or-keyword))
    (declare (ignorable __function__))
    (b* (((unless (and (consp echars)
                       (vl-simple-id-head-echar-p (car echars))))
          (mv nil echars))
         ((mv prefix remainder)
          (vl-read-simple-identifier echars))
         (str (hons-copy (vl-echarlist->string prefix)))
         (lookup (vl-keyword-lookup str table))
         (token (if lookup (make-vl-plaintoken :etext prefix
                                               :type lookup)
                  (make-vl-idtoken :etext prefix
                                   :name str))))
      (mv token remainder))))

Subtopics

Vl-lex-simple-identifier-or-keyword-token/remainder-thms
Token and remainder theorems for vl-lex-simple-identifier-or-keyword, automatically generated by def-token/remainder-thms.