Function: verilog-read-auto-template-middle
verilog-read-auto-template-middle is a byte-compiled function defined
in verilog-mode.el.gz.
Signature
(verilog-read-auto-template-middle)
Documentation
With point in middle of an AUTO_TEMPLATE, parse it.
Returns REGEXP and list of ( (signal_name connection_name)... ).
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/verilog-mode.el.gz
(defun verilog-read-auto-template-middle ()
"With point in middle of an AUTO_TEMPLATE, parse it.
Returns REGEXP and list of ( (signal_name connection_name)... )."
(save-excursion
;; Find beginning
(let ((tpl-regexp "\\([0-9]+\\)")
(lineno -1) ; -1 to offset for the AUTO_TEMPLATE's newline
(templateno 0)
tpl-sig-list tpl-wild-list tpl-end-pt rep)
;; Parse "REGEXP"
;; We reserve @"..." for future lisp expressions that evaluate
;; once-per-AUTOINST
(when (looking-at "\\s-*\"\\([^\"]*\\)\"")
(setq tpl-regexp (match-string-no-properties 1))
(goto-char (match-end 0)))
(search-forward "(")
(while (verilog-within-string) ;; e.g. inside a tpl-regexp spec
(search-forward "("))
;; Parse lines in the template
(when (or verilog-auto-inst-template-numbers
verilog-auto-template-warn-unused)
(save-excursion
(let ((pre-pt (point)))
(goto-char (point-min))
(while (search-forward "AUTO_TEMPLATE" pre-pt t)
(setq templateno (1+ templateno)))
(while (< (point) pre-pt)
(forward-line 1)
(setq lineno (1+ lineno))))))
(setq tpl-end-pt (save-excursion
(backward-char 1)
(verilog-forward-sexp-cmt 1) ; Moves to paren that closes argdecl's
(backward-char 1)
(point)))
;;
(while (< (point) tpl-end-pt)
(cond ((looking-at "\\s-*\\.\\([a-zA-Z0-9`_$]+\\)\\s-*(\\(.*\\))\\s-*\\(,\\|)\\s-*;\\)")
(setq tpl-sig-list
(cons (list
(match-string-no-properties 1)
(match-string-no-properties 2)
templateno lineno
(save-excursion
(goto-char (match-end 0))
(looking-at "[^\n]*AUTONOHOOKUP")))
tpl-sig-list))
(goto-char (match-end 0)))
;; Regexp form??
((looking-at
;; Regexp bug in XEmacs disallows ][ inside [], and wants + last
"\\s-*\\.\\(\\([-a-zA-Z0-9`_$+@^.*?|]\\|[][]\\|\\\\[()|0-9]\\)+\\)\\s-*(\\(.*\\))\\s-*\\(,\\|)\\s-*;\\)")
(setq rep (match-string-no-properties 3))
(goto-char (match-end 0))
(setq tpl-wild-list
(cons (list
(concat "^"
(verilog-string-replace-matches "@" "\\\\([0-9]+\\\\)" nil nil
(match-string 1))
"$")
rep
templateno lineno
(save-excursion
(goto-char (match-end 0))
(looking-at "[^\n]*AUTONOHOOKUP")))
tpl-wild-list)))
((looking-at "[ \t\f]+")
(goto-char (match-end 0)))
((looking-at "\n")
(setq lineno (1+ lineno))
(goto-char (match-end 0)))
((looking-at "//")
(search-forward "\n")
(setq lineno (1+ lineno)))
((looking-at "/\\*")
(forward-char 2)
(or (search-forward "*/")
(error "%s: Unmatched /* */, at char %d" (verilog-point-text) (point))))
(t
(error "%s: AUTO_TEMPLATE parsing error: %s"
(verilog-point-text)
(progn (looking-at ".*$") (match-string 0))))))
;; Return
(vector tpl-regexp
(list tpl-sig-list tpl-wild-list)))))