Function: antlr-run-tool

antlr-run-tool is an interactive and byte-compiled function defined in antlr-mode.el.gz.

Signature

(antlr-run-tool COMMAND FILE &optional SAVED)

Documentation

Run Antlr took COMMAND on grammar FILE.

When called interactively, COMMAND is read from the minibuffer and defaults to antlr-tool-command, with a computed "-glib" option for ANTLR v2 grammars if necessary. See also variable antlr-run-tool-on-buffer-file.

Save all buffers first unless optional value SAVED is non-nil. When called interactively, the buffers are always saved, see also variable antlr-ask-about-save.

Probably introduced at or before Emacs version 31.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/antlr-mode.el.gz
(defun antlr-run-tool (command file &optional saved)
  "Run Antlr took COMMAND on grammar FILE.
When called interactively, COMMAND is read from the minibuffer and
defaults to `antlr-tool-command', with a computed \"-glib\" option for
ANTLR v2 grammars if necessary.
See also variable `antlr-run-tool-on-buffer-file'.

Save all buffers first unless optional value SAVED is non-nil.  When
called interactively, the buffers are always saved, see also variable
`antlr-ask-about-save'."
  (interactive (antlr-run-tool-interactive))
  (or saved (save-some-buffers (not antlr-ask-about-save)))
  (let ((default-directory (file-name-directory file))
        (error-regexp-alist antlr-compilation-error-regexp-alist)
        (process-environment
         (if antlr-tool-path
             (let ((path (mapconcat #'substitute-env-vars
                                    antlr-tool-path path-separator)))
               (cons (concat "PATH=" path path-separator
                             (getenv "PATH"))
                     (cons (concat "LD_LIBRARY_PATH=" path path-separator
                                   (getenv "LD_LIBRARY_PATH"))
                           process-environment)))
           process-environment))) ;#dynamic
    ;; the MODE argument of `compilation-start' is quite a hack...
    (with-current-buffer
        (compilation-start command antlr-compilation-mode
                           (lambda (_mode-name) "*Antlr-Run*"))
      (when error-regexp-alist
        (setq-local compilation-error-regexp-alist error-regexp-alist))
      (setq-local antlr-grammar-file file))))