Function: verilog-re-search-forward-substr

verilog-re-search-forward-substr is a byte-compiled function defined in verilog-mode.el.gz.

Signature

(verilog-re-search-forward-substr SUBSTR REGEXP BOUND NOERROR)

Documentation

Like re-search-forward, but first search for SUBSTR constant.

Then searched for the normal REGEXP (which contains SUBSTR), with given BOUND and NOERROR. The REGEXP must fit within a single line. This speeds up complicated regexp matches.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/verilog-mode.el.gz
(defsubst verilog-re-search-forward-substr (substr regexp bound noerror)
  "Like `re-search-forward', but first search for SUBSTR constant.
Then searched for the normal REGEXP (which contains SUBSTR), with given
BOUND and NOERROR.  The REGEXP must fit within a single line.
This speeds up complicated regexp matches."
  ;; Problem with overlap: search-forward BAR then FOOBARBAZ won't match.
  ;; thus require matches to be on one line, and use beginning-of-line.
  (let (done)
    (while (and (not done)
		(search-forward substr bound noerror))
      (save-excursion
	(beginning-of-line)
	(setq done (re-search-forward regexp (point-at-eol) noerror)))
      (unless (and (<= (match-beginning 0) (point))
		   (>= (match-end 0) (point)))
	(setq done nil)))
    (when done (goto-char done))
    done))