Function: pascal-var-completion

pascal-var-completion is a byte-compiled function defined in pascal.el.gz.

Signature

(pascal-var-completion PREFIX)

Documentation

Calculate all possible completions for variables (or constants).

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/pascal.el.gz
(defun pascal-var-completion (prefix)
  "Calculate all possible completions for variables (or constants)."
  (save-excursion
    (let ((start (point))
          (pascal-all ())
          goon twice)
      ;; Search for all reachable var declarations
      (while (or (pascal-beg-of-defun)
                 (setq goon (not goon)))
        (save-excursion
          (if (> start (prog1 (save-excursion (pascal-end-of-defun)
                                              (point))))
              ()                        ; Declarations not reachable
            (if (search-forward "(" (point-at-eol) t)
                ;; Check parameterlist
                ;; FIXME: pascal-get-completion-decl doesn't understand
                ;; the var declarations in parameter lists :-(
                (setq pascal-all
                      (nconc (pascal-get-completion-decl prefix)
                             pascal-all)))
            (setq twice 2)
            (while (>= (setq twice (1- twice)) 0)
              (cond
               ((and (re-search-forward
                      (concat "\\<\\(var\\|const\\)\\>\\|"
                              "\\<\\(begin\\|function\\|procedure\\)\\>")
                      start t)
                     (not (match-end 2)))
                ;; Check var/const declarations
                (setq pascal-all
                      (nconc (pascal-get-completion-decl prefix)
                             pascal-all)))
               ((match-end 2)
                (setq twice 0)))))))
      pascal-all)))