Function: antlr-skip-file-prelude

antlr-skip-file-prelude is a byte-compiled function defined in antlr-mode.el.gz.

Signature

(antlr-skip-file-prelude SKIP-COMMENT)

Documentation

Skip the file prelude: the header and file options.

If SKIP-COMMENT is non-nil, also skip the comment after that part. Return the start position of the file prelude.

Hack: if SKIP-COMMENT is header-only only skip header and return position before the comment after the header.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/antlr-mode.el.gz
(defun antlr-skip-file-prelude (skip-comment)
  "Skip the file prelude: the header and file options.
If SKIP-COMMENT is non-nil, also skip the comment after that part.
Return the start position of the file prelude.

Hack: if SKIP-COMMENT is `header-only' only skip header and return
position before the comment after the header."
  (let* ((pos (point))                  ; should be (point-min)
	 (pos0 pos))
    (antlr-c-forward-sws)
    (if skip-comment (setq pos0 (point)))
    (while (looking-at "header\\_>[ \t]*\\(\"\\)?")
      (setq pos (antlr-skip-sexps (if (match-beginning 1) 3 2))))
    (if (eq skip-comment 'header-only)	; a hack...
	pos
      (when (looking-at "options\\_>")
	(setq pos (antlr-skip-sexps 2)))
      (if (eq (char-after) ?\{) (setq pos (antlr-skip-sexps 1)))
      (or skip-comment (goto-char pos))
      pos0)))