Function: simula-inside-parens

simula-inside-parens is a byte-compiled function defined in simula.el.gz.

Signature

(simula-inside-parens)

Documentation

Return position after ( on line if inside parentheses, nil otherwise.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/simula.el.gz
(defun simula-inside-parens ()
  "Return position after `(' on line if inside parentheses, nil otherwise."
  (save-excursion
    (let ((parlevel 0))
      (catch 'simula-out
	(while t
	  (if (re-search-backward "(\\|)\\|;" nil t)
	      (if (eq (simula-context) nil)
		  ;; found something - check it out
		  (cond
		   ((eq (following-char) ?\;)
		    (if (zerop parlevel)
			(throw 'simula-out nil)
		      (error "Parenthesis mismatch or misplaced `;'")))
		   ((eq (following-char) ?\()
		    (if (zerop parlevel)
			(throw 'simula-out (1+ (current-column)))
		      (setq parlevel (1- parlevel))))
		   (t (setq parlevel (1+ parlevel))))
		);; nothing - inside comment or string
	    ;; search failed
	    (throw 'simula-out nil)))))))