Function: verilog-end-of-statement

verilog-end-of-statement is an interactive and byte-compiled function defined in verilog-mode.el.gz.

Signature

(verilog-end-of-statement)

Documentation

Move forward to end of current statement.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/verilog-mode.el.gz
;;
;;      (while (and
;;              (not (looking-at verilog-complete-reg))
;;              (not (bolp))
;;              (not (= (preceding-char) ?\;)))
;;        (verilog-backward-token)
;;        (verilog-backward-syntactic-ws)
;;        (setq pt (point)))
;;      (goto-char pt)
;;   ;(verilog-forward-syntactic-ws)

(defun verilog-end-of-statement ()
  "Move forward to end of current statement."
  (interactive)
  (let ((nest 0) pos)
    (cond
     ((verilog-in-directive-p)
      (forward-line 1)
      (backward-char 1))

     ((looking-at verilog-beg-block-re)
      (verilog-forward-sexp))

     ((equal (char-after) ?\})
      (forward-char))

     ;; Skip to end of statement
     ((condition-case nil
          (setq pos
                (catch 'found
                  (while t
                    (forward-sexp 1)
                    (verilog-skip-forward-comment-or-string)
                    (if (eolp)
                        (forward-line 1))
                    (cond ((looking-at "[ \t]*;")
                           (skip-chars-forward "^;")
                           (forward-char 1)
                           (throw 'found (point)))
                          ((save-excursion
                             (forward-sexp -1)
                             (looking-at verilog-beg-block-re))
                           (goto-char (match-beginning 0))
                           (throw 'found nil))
                          ((looking-at "[ \t]*)")
                           (throw 'found (point)))
                          ((eobp)
                           (throw 'found (point)))
                          )))

                )
        (error nil))
      (if (not pos)
          ;; Skip a whole block
          (catch 'found
            (while t
              (verilog-re-search-forward verilog-end-statement-re nil 'move)
              (setq nest (if (match-end 1)
                             (1+ nest)
                           (1- nest)))
              (cond ((eobp)
                     (throw 'found (point)))
                    ((= 0 nest)
                     (throw 'found (verilog-end-of-statement))))))
        pos)))))