Function: antlr-option-level
antlr-option-level is a byte-compiled function defined in
antlr-mode.el.gz.
Signature
(antlr-option-level REQUESTED)
Documentation
Return level for option to insert near point.
Remove any restrictions from current buffer and return level for the option to insert near point, i.e., 1, 2, 3, 4, or nil if no such option can be inserted. If REQUESTED is non-nil, it is the only possible value to return except nil. If REQUESTED is nil, return level for the nearest option kind, i.e., the highest number possible.
If the result is 2, point is at the beginning of the class after the class definition. If the result is 3 or 4, point is at the beginning of the rule/subrule after the init action. Otherwise, the point position is undefined.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/antlr-mode.el.gz
(defun antlr-option-level (requested)
"Return level for option to insert near point.
Remove any restrictions from current buffer and return level for the
option to insert near point, i.e., 1, 2, 3, 4, or nil if no such option
can be inserted. If REQUESTED is non-nil, it is the only possible value
to return except nil. If REQUESTED is nil, return level for the nearest
option kind, i.e., the highest number possible.
If the result is 2, point is at the beginning of the class after the
class definition. If the result is 3 or 4, point is at the beginning of
the rule/subrule after the init action. Otherwise, the point position
is undefined."
(widen)
(if (eq requested 1)
(and (car antlr-options-alists) 1)
(let* ((orig (point))
(outsidep (antlr-outside-rule-p))
bor)
(setq bor (point)) ; beginning of rule
(cond ((eq requested 2) ; grammar options required?
(antlr-try-rule-or-grammar-option requested bor))
((and (car antlr-options-alists) ; file options available (v2)
(save-excursion ; in region of file options?
(goto-char (point-min))
(antlr-skip-file-prelude t) ; ws/comment after: OK
(< orig (point))))
(and (null requested) 1))
(outsidep ; outside -> grammar option
(when (memq requested '(nil 2))
(antlr-try-rule-or-grammar-option 2 bor)))
((looking-at antlr-grammar-header-regexp) ; rule = class def?
(goto-char (match-end 0))
(and (null requested) 2))
((or (eq requested 3) (null (elt antlr-options-alists 3)))
(antlr-try-rule-or-grammar-option requested bor))
((antlr-syntactic-grammar-depth orig bor t)
4)
(t
(antlr-try-rule-or-grammar-option requested bor))))))