Function: antlr-syntactic-context
antlr-syntactic-context is a byte-compiled function defined in
antlr-mode.el.gz.
Signature
(antlr-syntactic-context)
Documentation
Return some syntactic context information.
Return string if point is within a string, block-comment or
comment is point is within a comment or the depth within all
parenthesis-syntax delimiters at point otherwise.
WARNING: this may alter match-data.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/antlr-mode.el.gz
(defun antlr-syntactic-context ()
"Return some syntactic context information.
Return `string' if point is within a string, `block-comment' or
`comment' is point is within a comment or the depth within all
parenthesis-syntax delimiters at point otherwise.
WARNING: this may alter `match-data'."
(let ((orig (point)) diff state
;; Arg, Emacs's (buffer-modified-tick) changes with font-lock. Use
;; hack that `loudly' is bound during font-locking => cache use will
;; increase from 7% to 99.99% during font-locking.
(tick (or (boundp antlr-slow-cache-enabling-symbol)
(buffer-modified-tick))))
(if (and (cdr antlr-slow-context-cache)
(>= (setq diff (- orig (cadr antlr-slow-context-cache))) 0)
(< diff antlr-slow-cache-diff-threshold)
(eq (current-buffer) (caar antlr-slow-context-cache))
(eq tick (cdar antlr-slow-context-cache)))
;; (setq antlr-statistics-cache (1+ antlr-statistics-cache) ...)
(setq state (parse-partial-sexp (cadr antlr-slow-context-cache) orig
nil nil
(cddr antlr-slow-context-cache)))
(if (>= orig antlr-slow-cache-diff-threshold)
(beginning-of-defun)
(goto-char (point-min)))
;; (cond ((and diff (< diff 0)) (cl-incf antlr-statistics-full-neg))
;; ((and diff (>= diff 3000)) (cl-incf antlr-statistics-full-diff))
;; (t (cl-incf antlr-statistics-full-other)))
(setq state (parse-partial-sexp (point) orig)))
(goto-char orig)
(if antlr-slow-context-cache
(setcdr antlr-slow-context-cache (cons orig state))
(setq antlr-slow-context-cache
(cons (cons (current-buffer) tick)
(cons orig state))))
(cond ((nth 3 state) 'string)
((nth 4 state) 'comment) ; block-comment? -- we don't care
(t (car state)))))