Function: verilog-beg-of-statement
verilog-beg-of-statement is an interactive and byte-compiled function
defined in verilog-mode.el.gz.
Signature
(verilog-beg-of-statement)
Documentation
Move backward to beginning of statement.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/verilog-mode.el.gz
(defun verilog-beg-of-statement ()
"Move backward to beginning of statement."
(interactive)
;; Move back token by token until we see the end
;; of some earlier line.
(let (h)
(while
;; If the current point does not begin a new
;; statement, as in the character ahead of us is a ';', or SOF
;; or the string after us unambiguously starts a statement,
;; or the token before us unambiguously ends a statement,
;; then move back a token and test again.
(not (or
;; stop if beginning of buffer
(bobp)
;; stop if looking at a pre-processor directive
(looking-at "`\\w+")
;; stop if we find a ;
(= (preceding-char) ?\;)
;; stop if we see a named coverpoint
(looking-at "\\w+\\W*:\\W*\\(coverpoint\\|cross\\|constraint\\)")
;; keep going if we are in the middle of a word
(not (or (looking-at "\\<") (forward-word-strictly -1)))
;; stop if we see an assertion (perhaps labeled)
(and
(looking-at (concat "\\(\\w+\\W*:\\W*\\)?" verilog-concurrent-assertion-statement-re))
(progn
(setq h (point))
(save-excursion
(verilog-backward-token)
(if (and (looking-at verilog-label-re)
(not (looking-at verilog-end-block-re)))
(setq h (point))))
(goto-char h)))
;; stop if we see an extended complete reg, perhaps a complete one
(and
(looking-at verilog-complete-re)
(let* ((p (point)))
(while (and (looking-at verilog-extended-complete-re)
(progn (setq p (point))
(verilog-backward-token)
(/= p (point)))))
(goto-char p)))
;; stop if previous token is an ender
(save-excursion
(verilog-backward-token)
(or (looking-at verilog-end-block-re)
(verilog-in-directive-p)))))
(verilog-backward-syntactic-ws)
(verilog-backward-token))
;; Now point is where the previous line ended.
(verilog-forward-syntactic-ws)
;; Skip forward over any preprocessor directives, as they have wacky indentation
(if (looking-at verilog-preprocessor-re)
(progn (goto-char (match-end 0))
(verilog-forward-syntactic-ws)))))