Function: vhdl-win-il
vhdl-win-il is a byte-compiled function defined in vhdl-mode.el.gz.
Signature
(vhdl-win-il &optional LIM)
Documentation
Determine if point is in a VHDL literal.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/vhdl-mode.el.gz
;; This is the best we can do in Win-Emacs.
(defun vhdl-win-il (&optional lim)
"Determine if point is in a VHDL literal."
(save-excursion
(let* ((here (point))
(state nil)
(match nil)
(lim (or lim (vhdl-point 'bod))))
(goto-char lim )
(while (< (point) here)
(setq match
(and (re-search-forward "--\\|[\"']\\|`"
here 'move)
(buffer-substring (match-beginning 0) (match-end 0))))
(setq state
(cond
;; no match
((null match) nil)
;; looking at the opening of a VHDL style comment
((string= "--" match)
(if (<= here (progn (end-of-line) (point))) 'comment))
;; looking at a directive
((string= "`" match)
(if (<= here (progn (end-of-line) (point))) 'directive))
;; looking at the opening of a double quote string
((string= "\"" match)
(if (not (save-restriction
;; this seems to be necessary since the
;; re-search-forward will not work without it
(narrow-to-region (point) here)
(re-search-forward
;; this regexp matches a double quote
;; which is preceded by an even number
;; of backslashes, including zero
"\\([^\\]\\|^\\)\\(\\\\\\\\\\)*\"" here 'move)))
'string))
;; looking at the opening of a single quote string
((string= "'" match)
(if (not (save-restriction
;; see comments from above
(narrow-to-region (point) here)
(re-search-forward
;; this matches a single quote which is
;; preceded by zero or two backslashes.
"\\([^\\]\\|^\\)\\(\\\\\\\\\\)?'"
here 'move)))
'string))
(t nil)))
) ; end-while
state)))