• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • C
        • Syntax-for-tools
          • Formalized-subset
          • Mapping-to-language-definition
          • Input-files
          • Compilation-database
            • Comp-db-entry
            • Comp-db-arg
            • Json-to-comp-db-entry
            • Json-to-comp-db-entry-list
            • To-preprocess-db
            • To-preprocess-map
            • Comp-db-arguments-absolute-dirs
            • Comp-db-keep-only-preprocessor-args
            • Json-to-comp-db
            • Json-to-comp-db-arguments
              • Comp-db-relativize-keys
              • Json-to-comp-db-get-exec-and-arguments
              • Preprocess-map-from-comp-file
              • Json-to-comp-db-exec-and-arguments
              • Relativize-path
              • Comp-db-arguments-keep-only-preprocessor-args
              • Comp-db-arguments-escape-for-shell
              • Parse-comp-db
              • Json-to-comp-db-get-directory
              • Json-to-comp-db-get-output
              • Json-to-comp-db-get-file
              • Comp-db-drop-shared
              • Comp-db-drop-non-c
              • Comp-db-arg-list-to-string-list
              • Comp-db-absolute-dirs
              • Comp-db-escape-for-shell
              • Json-to-comp-db-try-parse-short-option
              • Preprocess-db-to-map
              • Comp-db-arg-to-string
              • Comp-db
              • Json-to-comp-db-try-parse-equal-arg
              • Defpreprocess-map-fn
              • String-escape-for-shell
              • Comp-db-arg-list
              • Irr-comp-db-arg
              • Show-warnings
              • *cc-options-space-sep*
              • *cc-options-equal-sep*
              • *cc-options-dir*
            • Printer
            • Output-files
            • Abstract-syntax-operations
            • Implementation-environments
            • Abstract-syntax
            • Concrete-syntax
            • Disambiguation
            • Validation
            • Gcc-builtins
            • Preprocessing
            • Parsing
          • Atc
          • Transformation-tools
          • Language
          • Representation
          • Insertion-sort
          • Pack
        • Proof-checker-array
        • Soft
        • Farray
        • Rp-rewriter
        • Instant-runoff-voting
        • Imp-language
        • Sidekick
        • Ethereum
        • Leftist-trees
        • Java
        • Riscv
        • Taspi
        • Bitcoin
        • Zcash
        • Des
        • X86isa
        • Sha-2
        • Yul
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Axe
        • Poseidon
        • Where-do-i-place-my-book
        • Aleo
        • Bigmems
        • Builtins
        • Execloader
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Community
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Compilation-database

    Json-to-comp-db-arguments

    Parse an argument list into structured, name/value arguments.

    Signature
    (json-to-comp-db-arguments arguments) → (mv erp arguments$)
    Arguments
    arguments — Guard (json::value-listp arguments).
    Returns
    arguments$ — Type (comp-db-arg-listp arguments$).

    Definitions and Theorems

    Function: json-to-comp-db-arguments

    (defun json-to-comp-db-arguments (arguments)
     (declare (xargs :guard (json::value-listp arguments)))
     (b*
      (((reterr) nil)
       (arguments (json::value-list-fix arguments))
       ((when (endp arguments)) (retok nil))
       (name-value? (first arguments))
       ((unless (eq (json::value-kind name-value?)
                    :string))
        (retmsg$
         "Expected string type in \"arguments\" array of ~
                      JSON compilation database entry.
                      Found ~x0 instead."
         (json::value-kind name-value?)))
       (name-value?-str (json::value-string->get name-value?))
       ((erp comp-db-arg rest-arguments)
        (b*
         (((reterr) nil nil)
          ((unless
                (member-equal name-value?-str *cc-options-space-sep*))
           (b*
            (((mv erp argument?)
              (json-to-comp-db-try-parse-short-option name-value?-str))
             ((unless erp)
              (retok argument? (rest arguments)))
             ((mv erp argument?)
              (json-to-comp-db-try-parse-equal-arg name-value?-str))
             ((unless erp)
              (retok argument? (rest arguments))))
            (retok (make-comp-db-arg :name name-value?-str
                                     :separator ""
                                     :value nil)
                   (rest arguments))))
          ((when (endp (rest arguments)))
           (retmsg$ "Argument ~x0 is not followed by a value."
                    name-value?-str))
          (value (second arguments))
          ((unless (eq (json::value-kind value) :string))
           (retmsg$
            "Expected string type in \"arguments\" array of ~
                            JSON compilation database entry.
                            Found ~x0 instead."
            (json::value-kind value)))
          (value-str (json::value-string->get value)))
         (retok (make-comp-db-arg :name name-value?-str
                                  :separator " "
                                  :value value-str)
                (rest (rest arguments)))))
       ((erp arguments$)
        (json-to-comp-db-arguments rest-arguments)))
      (retok (cons comp-db-arg arguments$))))

    Theorem: comp-db-arg-listp-of-json-to-comp-db-arguments.arguments$

    (defthm comp-db-arg-listp-of-json-to-comp-db-arguments.arguments$
      (b* (((mv acl2::?erp ?arguments$)
            (json-to-comp-db-arguments arguments)))
        (comp-db-arg-listp arguments$))
      :rule-classes :rewrite)

    Theorem: json-to-comp-db-arguments-of-value-list-fix-arguments

    (defthm json-to-comp-db-arguments-of-value-list-fix-arguments
     (equal (json-to-comp-db-arguments (json::value-list-fix arguments))
            (json-to-comp-db-arguments arguments)))

    Theorem: json-to-comp-db-arguments-value-list-equiv-congruence-on-arguments

    (defthm
     json-to-comp-db-arguments-value-list-equiv-congruence-on-arguments
     (implies (json::value-list-equiv arguments arguments-equiv)
              (equal (json-to-comp-db-arguments arguments)
                     (json-to-comp-db-arguments arguments-equiv)))
     :rule-classes :congruence)