Function: vhdl-get-library-unit

vhdl-get-library-unit is a byte-compiled function defined in vhdl-mode.el.gz.

Signature

(vhdl-get-library-unit BOD PLACEHOLDER)

Documentation

If there is an enclosing library unit at BOD, with its "begin" keyword at PLACEHOLDER, then return the library unit type.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/vhdl-mode.el.gz
;; Defuns for calculating the current syntactic state:

(defun vhdl-get-library-unit (bod placeholder)
  "If there is an enclosing library unit at BOD, with its \"begin\"
keyword at PLACEHOLDER, then return the library unit type."
  (let ((here (vhdl-point 'bol)))
    (if (save-excursion
	  (goto-char placeholder)
	  (vhdl-safe (vhdl-forward-sexp 1 bod))
	  (<= here (point)))
	(save-excursion
	  (goto-char bod)
	  (cond
	   ((looking-at "e") 'entity)
	   ((looking-at "a") 'architecture)
	   ((looking-at "conf") 'configuration)
	   ((looking-at "cont") 'context)
	   ((looking-at "p")
	    (save-excursion
	      (goto-char bod)
	      (forward-sexp)
	      (vhdl-forward-syntactic-ws here)
	      (if (looking-at "body\\b[^_]")
		  'package-body 'package))))))
    ))