Function: simula-find-if

simula-find-if is a byte-compiled function defined in simula.el.gz.

Signature

(simula-find-if)

Documentation

Find starting IF of a IF-THEN[-ELSE[-IF-THEN...]] statement.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/simula.el.gz
(defun simula-find-if ()
  "Find starting IF of a IF-THEN[-ELSE[-IF-THEN...]] statement."
  (catch 'simula-out
    (while t
      (if (and (simula-search-backward "\\<if\\>\\|;\\|\\<begin\\>"nil t)
	       (memq (following-char) '(?I ?i)))
	  (save-excursion
	    ;;
	    ;; find out if this IF was really the start of the IF statement
	    ;;
	    (simula-skip-comment-backward)
	    (if (and (eq (char-syntax (preceding-char)) ?w)
		     (progn
		       (backward-word-strictly 1)
		       (looking-at "else\\>")))
		()
	      (throw 'simula-out t)))
	(if (not (looking-at "\\<if\\>"))
	    (error "Missing IF or misplaced BEGIN or ';' (can't find IF)")
	  ;;
	  ;; we were at the starting IF in the first place..
	  ;;
	  (throw 'simula-out t))))))