Function: verilog-completion

verilog-completion is a byte-compiled function defined in verilog-mode.el.gz.

Signature

(verilog-completion STR PRED FLAG)

Documentation

Completion table for Verilog tokens.

Function passed to completing-read, try-completion or all-completions. Called to get completion on STR. If FLAG is t, the function returns a list of all possible completions. If FLAG is nil it returns a string, the longest possible completion, or t if STR is an exact match. If FLAG is lambda, the function returns t if STR is an exact match, nil otherwise.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/verilog-mode.el.gz
(defun verilog-completion (str pred flag)
  "Completion table for Verilog tokens.
Function passed to `completing-read', `try-completion' or `all-completions'.
Called to get completion on STR.
If FLAG is t, the function returns a list of all possible completions.
If FLAG is nil it returns a string, the longest possible completion,
or t if STR is an exact match.
If FLAG is `lambda', the function returns t if STR is an exact match,
nil otherwise."
  (let ((verilog-str str)
        (verilog-all nil))
    ;; Set buffer to use for searching labels. This should be set
    ;; within functions which use verilog-completions
    (with-current-buffer verilog-buffer-to-use

      ;; Determine what should be completed
      (let ((state (car (verilog-calculate-indent))))
	(cond ((eq state 'defun)
	       (save-excursion (verilog-var-completion))
	       (verilog-func-completion 'module)
	       (verilog-keyword-completion verilog-defun-keywords))

	      ((eq state 'behavioral)
	       (save-excursion (verilog-var-completion))
	       (verilog-func-completion 'module)
	       (verilog-keyword-completion verilog-defun-keywords))

	      ((eq state 'block)
	       (save-excursion (verilog-var-completion))
	       (verilog-func-completion 'tf)
	       (verilog-keyword-completion verilog-block-keywords))

	      ((eq state 'case)
	       (save-excursion (verilog-var-completion))
	       (verilog-func-completion 'tf)
	       (verilog-keyword-completion verilog-case-keywords))

	      ((eq state 'tf)
	       (save-excursion (verilog-var-completion))
	       (verilog-func-completion 'tf)
	       (verilog-keyword-completion verilog-tf-keywords))

	      ((eq state 'cpp)
	       (save-excursion (verilog-var-completion))
	       (verilog-keyword-completion verilog-cpp-keywords))

	      ((eq state 'cparenexp)
	       (save-excursion (verilog-var-completion)))

	      (t;--Anywhere else
	       (save-excursion (verilog-var-completion))
	       (verilog-func-completion 'both)
	       (verilog-keyword-completion verilog-separator-keywords))))

      ;; Now we have built a list of all matches. Give response to caller
      (verilog--complete-with-action flag verilog-all verilog-str pred))))