Function: antlr-guess-tool-version

antlr-guess-tool-version is a byte-compiled function defined in antlr-mode.el.gz.

Signature

(antlr-guess-tool-version)

Documentation

Guess whether current grammar is for ANTLR v2 or v3.

By default, we assume v3. Only if we find a keyword class or header at the beginning of a line before any grammar keyword, we assume v2.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/antlr-mode.el.gz
(defun antlr-guess-tool-version ()
  "Guess whether current grammar is for ANTLR v2 or v3.
By default, we assume v3.  Only if we find a keyword `class' or
`header' at the beginning of a line before any `grammar' keyword,
we assume v2."
  (save-excursion
    (goto-char (point-min))
    (if (and (antlr-re-search-forward "^\\(lexer[ \t]+grammar\\|parser[ \t]+grammar\\|tree[ \t]+grammar\\|grammar\\|\\(class\\|header\\)\\)\\_>" (+ (point) (car antlr-language-limit-n-regexp)))
             (match-beginning 2))      ; class or header
        'antlr-v2
      'antlr-v3)))