                 "\\|" "table"
                 "\\|" "task" "\\)"
                 "\\s-+"
+                "\\([a-z]+\\s-+\\)*" ; void, static, automatic, ..
                 "\\(" modi/verilog-identifier-re "\\)" ; block name
                 "\\b"
                 )

Using the optional argument FWD does the search in forward direction.

This function updates the local variable `modi/verilog-which-func-xtra'."
        (let (instance-name return-val)
          (setq-local modi/verilog-which-func-xtra nil) ; reset
          (save-excursion
            (if (if fwd
                    (search-forward-regexp modi/verilog-module-instance-re nil :noerror)
                  (search-backward-regexp modi/verilog-module-instance-re nil :noerror))
                (progn
                  ;; (message "---- 1 ---- %s" (match-string 1))
                  ;; (message "---- 2 ---- %s" (match-string 2))
                  ;; (message "---- 3 ---- %s" (match-string 3))
                  ;; (message "---- 4 ---- %s" (match-string 4))
                  ;; (message "---- 5 ---- %s" (match-string 5))
                  (setq-local modi/verilog-which-func-xtra (match-string 1)) ; module name
                  (setq instance-name (match-string 4)) ; instance name

                  (when (and (stringp modi/verilog-which-func-xtra)
                             (string-match modi/verilog-keywords-re
                                           modi/verilog-which-func-xtra))
                    (setq-local modi/verilog-which-func-xtra nil))

                  (when (and (stringp instance-name)
                             (string-match modi/verilog-keywords-re
                                           instance-name))
                    (setq instance-name nil))

                  (setq return-val (if (or (null modi/verilog-which-func-xtra)
                                           (null instance-name))
                                       nil
                                     instance-name)))
              (setq return-val nil)))
          (when (featurep 'which-func)
            (modi/verilog-update-which-func-format))
          return-val))

;; Time-stamp: <2015-03-12 17:06:28 kmodi>

;;; Verilog

