Function: verilog-single-declaration-end
verilog-single-declaration-end is a byte-compiled function defined in
verilog-mode.el.gz.
Signature
(verilog-single-declaration-end LIMIT)
Documentation
Return pos where current (single) declaration statement ends.
Also, this function moves POINT forward to the start of a variable name
(skipping the range-part and whitespace).
Function expected to be called with POINT just after a declaration keyword.
LIMIT sets the max POINT for searching and moving to. No such limit if LIMIT
is 0.
Meaning of *single* declaration:
E.g. In a module's port-list -
module test(input clk, rst, x, output [1:0] y);
Here 'input clk, rst, x' is 1 *single* declaration statement,
and 'output [1:0] y' is the other single declaration. In the 1st single
declaration, POINT is moved to start of 'clk'. And in the 2nd declaration,
POINT is moved to 'y'.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/verilog-mode.el.gz
(defun verilog-single-declaration-end (limit)
"Return pos where current (single) declaration statement ends.
Also, this function moves POINT forward to the start of a variable name
(skipping the range-part and whitespace).
Function expected to be called with POINT just after a declaration keyword.
LIMIT sets the max POINT for searching and moving to. No such limit if LIMIT
is 0.
Meaning of *single* declaration:
E.g. In a module's port-list -
module test(input clk, rst, x, output [1:0] y);
Here 'input clk, rst, x' is 1 *single* declaration statement,
and 'output [1:0] y' is the other single declaration. In the 1st single
declaration, POINT is moved to start of 'clk'. And in the 2nd declaration,
POINT is moved to 'y'."
(let (maxpoint old-point)
;; maxpoint = min(curr-point + limit, buffer-size)
(setq maxpoint (if (eq limit 0)
(point-max) ;; no bounds if search-bound is zero
(+ (point) limit)))
(if (> maxpoint (buffer-size)) (setq maxpoint (buffer-size)))
;; Skip comment - range - comment
(verilog-forward-ws&directives maxpoint)
(when (eq (char-after) ?\[)
(re-search-forward verilog-range-re maxpoint t))
(verilog-forward-ws&directives maxpoint)
;; Move forward until a delimiter is reached which marks end of current
;; single declaration. Return point at found delimiter
(save-excursion
(while (and (< (point) maxpoint)
(not (eq old-point (point)))
(not (eq (char-after) ?\; ))
(not (eq (char-after) ?\) ))
(not (looking-at verilog-declaration-re)))
(setq old-point (point))
(ignore-errors
(forward-sexp)
(verilog-forward-ws&directives maxpoint)
(when (eq (char-after) ?,)
(forward-char)
(verilog-forward-ws&directives maxpoint))))
(point))))