Function: antlr-syntactic-grammar-depth

antlr-syntactic-grammar-depth is a byte-compiled function defined in antlr-mode.el.gz.

Signature

(antlr-syntactic-grammar-depth POS BEG)

Documentation

Return syntactic context depth at POS.

Move to POS and from there on to the beginning of the string or comment if POS is inside such a construct. Then, return the syntactic context depth at point if the point position is smaller than BEG. WARNING: this may alter match-data.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/antlr-mode.el.gz
(defun antlr-syntactic-grammar-depth (pos beg)
  "Return syntactic context depth at POS.
Move to POS and from there on to the beginning of the string or comment
if POS is inside such a construct.  Then, return the syntactic context
depth at point if the point position is smaller than BEG.
WARNING: this may alter `match-data'."
  (goto-char pos)
  (let ((context (or (antlr-syntactic-context) 0)))
    (while (and context (not (integerp context)))
      (cond ((eq context 'string)
	     (setq context
		   (and (search-backward "\"" nil t)
			(>= (point) beg)
			(or (antlr-syntactic-context) 0))))
	    ((memq context '(comment block-comment))
	     (setq context
		   (and (re-search-backward "/[/*]" nil t)
			(>= (point) beg)
			(or (antlr-syntactic-context) 0))))))
    context))