Function: cfengine3-make-syntax-cache

cfengine3-make-syntax-cache is a byte-compiled function defined in cfengine.el.gz.

Signature

(cfengine3-make-syntax-cache)

Documentation

Build the CFEngine 3 syntax cache and return the syntax.

Calls cfengine-cf-promises with "-s json".

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cfengine.el.gz
(defun cfengine3-make-syntax-cache ()
  "Build the CFEngine 3 syntax cache and return the syntax.
Calls `cfengine-cf-promises' with \"-s json\"."
  (or (cdr (assoc cfengine-cf-promises cfengine-mode-syntax-cache))
      (let ((syntax (or (when cfengine-cf-promises
                          (with-demoted-errors "cfengine3-make-syntax-cache: %S"
                            (with-temp-buffer
                              (or (zerop (process-file cfengine-cf-promises
                                                       nil ; no input
                                                       t   ; output
                                                       nil ; no redisplay
                                                       "-s" "json"))
                                  (error "%s" (buffer-substring
                                               (point-min)
                                               (progn (goto-char (point-min))
                                                      (line-end-position)))))
                              (goto-char (point-min))
                              (json-read))))
                        cfengine3-fallback-syntax)))
        (push (cons cfengine-cf-promises syntax)
              cfengine-mode-syntax-cache)
        (setq cfengine-mode-syntax-functions-regex
              (regexp-opt (mapcar (lambda (def)
                                    (format "%s" (car def)))
                                  (cdr (assq 'functions syntax)))
                          'symbols))
        syntax)))