Function: vhdl-hs-forward-sexp-func

vhdl-hs-forward-sexp-func is a byte-compiled function defined in vhdl-mode.el.gz.

Signature

(vhdl-hs-forward-sexp-func COUNT)

Documentation

Find end of construct to hide (for hideshow). Only search forward.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/vhdl-mode.el.gz
(defun vhdl-hs-forward-sexp-func (count)
  "Find end of construct to hide (for hideshow).  Only search forward."
  (let ((pos (point)))
    (vhdl-prepare-search-2
     (beginning-of-line)
     (cond
      ;; generic/port clause
      ((looking-at "^\\s-*\\(generic\\|port\\)[ \t\n\r\f]*(")
       (goto-char (match-end 0))
       (backward-char)
       (forward-sexp))
      ;; component declaration
      ((looking-at "^\\s-*component\\>")
       (re-search-forward "^\\s-*end\\s-+component\\>" nil t))
      ;; component instantiation
      ((looking-at
	(concat
	 "^\\s-*\\w+\\s-*:[ \t\n\r\f]*"
	 "\\(\\(component\\|configuration\\|entity\\)[ \t\n\r\f]+\\)?"
	 "\\w+\\(\\s-*(\\w+)\\)?[ \t\n\r\f]*"
	 "\\(generic\\|port\\)\\s-+map[ \t\n\r\f]*("))
       (goto-char (match-end 0))
       (backward-char)
       (forward-sexp)
       (setq pos (point))
       (vhdl-forward-syntactic-ws)
       (when (looking-at "port\\s-+map[ \t\n\r\f]*(")
	 (goto-char (match-end 0))
	 (backward-char)
	 (forward-sexp)
	 (setq pos (point)))
       (goto-char pos))
      ;; subprogram declaration/body
      ((looking-at "^\\s-*\\(function\\|procedure\\)\\s-+\\(\\w+\\|\".+\"\\)")
       (goto-char (match-end 0))
       (vhdl-forward-syntactic-ws)
       (when (looking-at "(")
	 (forward-sexp))
       (while (and (re-search-forward "\\(;\\)\\|\\(\\<is\\>\\)" nil t)
		   (vhdl-in-literal)))
       ;; subprogram body
       (when (match-string 2)
	 (re-search-forward "^\\s-*\\<begin\\>" nil t)
	 (backward-word-strictly 1)
	 (vhdl-forward-sexp)))
      ;; block (recursive)
      ((looking-at "^\\s-*\\w+\\s-*:\\s-*block\\>")
       (goto-char (match-end 0))
       (while (and (re-search-forward "^\\s-*\\(\\(\\w+\\s-*:\\s-*block\\>\\)\\|\\(end\\s-+block\\>\\)\\)" nil t)
		   (match-beginning 2))
	 (vhdl-hs-forward-sexp-func count)))
      ;; process
      ((looking-at "^\\s-*\\(\\w+\\s-*:\\s-*\\)?process\\>")
       (re-search-forward "^\\s-*end\\s-+process\\>" nil t))
      ;; configuration declaration
      ((looking-at "^\\s-*configuration\\>")
       (forward-word-strictly 4)
       (vhdl-forward-sexp))
      (t (goto-char pos))))))