Function: c-awk-at-vsemi-p

c-awk-at-vsemi-p is a byte-compiled function defined in cc-awk.el.gz.

Signature

(c-awk-at-vsemi-p &optional POS)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-awk.el.gz
;; NOTES ON "VIRTUAL SEMICOLONS"
;;
;; A "virtual semicolon" is what terminates a statement when there is no ;
;; or } to do the job.  Like point, it is considered to lie _between_ two
;; characters.  As from mid-March 2004, it is considered to lie just after
;; the last non-syntactic-whitespace character on the line; (previously, it
;; was considered an attribute of the EOL on the line).  A real semicolon
;; never counts as a virtual one.

(defun c-awk-at-vsemi-p (&optional pos)
  ;; Is there a virtual semicolon at POS (or POINT)?
  (save-excursion
    (let* (nl-prop
	   (pos-or-point (progn (if pos (goto-char pos)) (point)))
	   (bol (c-point 'bol)) (eol (c-point 'eol)))
      (c-awk-beginning-of-logical-line)
      ;; Next `while' goes round one logical line (ending in, e.g. "\\") per
      ;; iteration.  Such a line is rare, and can only be an open string
      ;; ending in an escaped \.
      (while
	  (progn
	    ;; Next `while' goes over a division sign or /regexp/ per iteration.
	    (while
		(and
		 (< (point) eol)
		 (progn
		   (search-forward-regexp c-awk-non-/-syn-ws*-re eol)
		   (looking-at c-awk-space*-/-re)))
	      (cond
	       ((looking-at c-awk-space*-regexp-/-re) ; /regexp/
		(forward-sexp))
	       ((looking-at c-awk-space*-unclosed-regexp-/-re) ; Unclosed /regexp
		(condition-case nil
		    (progn
		      (forward-sexp)
		      (backward-char))	; Move to end of (logical) line.
		  (error (end-of-line)))) ; Happens at EOB.
	       (t                       ; division sign
		(c-forward-syntactic-ws)
		(forward-char))))
	    (< (point) bol))
	(forward-line))
      (and (eq (point) pos-or-point)
	   (progn
	     (while (and (eq (setq nl-prop (c-awk-get-NL-prop-cur-line)) ?\\)
			 (eq (forward-line) 0)
			 (looking-at c-awk-blank-or-comment-line-re)))
	     (eq nl-prop ?\$))))))