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 &optional OUTSIDE-ACTION)
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.
With optional argument OUTSIDE-ACTION, move to beginning of action.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/antlr-mode.el.gz
(defun antlr-syntactic-grammar-depth (pos beg &optional outside-action)
"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'.
With optional argument OUTSIDE-ACTION, move to beginning of action."
(goto-char pos)
(let ((ppss (syntax-ppss)))
(when (or (nth 3 ppss) (nth 4 ppss)) ; string or comment -> to beginning
(goto-char (nth 8 ppss)))
(when outside-action
(let ((poss (nth 9 ppss)) ; TODO: syntax-ppss-open-positions
open)
(while (and poss (eq (char-after (car poss)) ?\())
(setq open (pop poss)))
(when open
(goto-char (1+ open))
(>= open beg))))))