;; pascal-auto-endcomments t
;; pascal-auto-lineup '(all)
;; pascal-toggle-completions nil
-;; pascal-type-keywords '("array" "file" "packed" "char"
+;; pascal-type-keywords '("array" "file" "packed" "char"
;; "integer" "real" "string" "record")
;; pascal-start-keywords '("begin" "end" "function" "procedure"
;; "repeat" "until" "while" "read" "readln"
"Imenu expression for Pascal-mode. See `imenu-generic-expression'.")
(defvar pascal-keywords
- '("and" "array" "begin" "case" "const" "div" "do" "downto" "else" "end"
- "file" "for" "function" "goto" "if" "in" "label" "mod" "nil" "not" "of"
- "or" "packed" "procedure" "program" "record" "repeat" "set" "then" "to"
+ '("and" "array" "begin" "case" "const" "div" "do" "downto" "else" "end"
+ "file" "for" "function" "goto" "if" "in" "label" "mod" "nil" "not" "of"
+ "or" "packed" "procedure" "program" "record" "repeat" "set" "then" "to"
"type" "until" "var" "while" "with"
;; The following are not standard in pascal, but widely used.
"get" "put" "input" "output" "read" "readln" "reset" "rewrite" "write"
()
(setq pascal-mode-syntax-table (make-syntax-table))
(modify-syntax-entry ?\\ "." pascal-mode-syntax-table)
- (modify-syntax-entry ?( "()1" pascal-mode-syntax-table)
+ (modify-syntax-entry ?( "()1" pascal-mode-syntax-table)
(modify-syntax-entry ?) ")(4" pascal-mode-syntax-table)
(modify-syntax-entry ?* ". 23b" pascal-mode-syntax-table)
(modify-syntax-entry ?{ "<" pascal-mode-syntax-table)
(defun pascal-declaration-end ()
(let ((nest 1))
(while (and (> nest 0)
- (re-search-forward
- "[:=]\\|\\(\\<record\\>\\)\\|\\(\\<end\\>\\)"
+ (re-search-forward
+ "[:=]\\|\\(\\<record\\>\\)\\|\\(\\<end\\>\\)"
(save-excursion (end-of-line 2) (point)) t))
(cond ((match-beginning 1) (setq nest (1+ nest)))
((match-beginning 2) (setq nest (1- nest)))
((match-beginning 3) (setq nest (1+ nest)))))
(= nest 0)))
-
+
(defsubst pascal-within-string ()
(save-excursion
(nth 3 (parse-partial-sexp (pascal-get-beg-of-line) (point)))))
(search-forward "*)" (pascal-get-end-of-line) t))))
(setq setstar t))))
;; If last line was a star comment line then this one shall be too.
- (if (null setstar)
+ (if (null setstar)
(pascal-indent-line)
(insert "* "))))
(if (not (looking-at (concat "\\s \\|\\s)\\|" pascal-defun-re)))
(forward-sexp 1))
(let ((nest 0) (max -1) (func 0)
- (reg (concat pascal-beg-block-re "\\|"
+ (reg (concat pascal-beg-block-re "\\|"
pascal-end-block-re "\\|"
pascal-defun-re)))
(while (re-search-backward reg nil 'move)
(pascal-beg-of-defun))
(forward-char 1)
(let ((nest 0) (func 1)
- (reg (concat pascal-beg-block-re "\\|"
+ (reg (concat pascal-beg-block-re "\\|"
pascal-end-block-re "\\|"
pascal-defun-re)))
(while (and (/= func 0)
(catch 'found
(while t
(re-search-forward regexp nil 'move)
- (setq nest (if (match-end 1)
+ (setq nest (if (match-end 1)
(1+ nest)
(1- nest)))
(cond ((eobp)
)))))
;; Return type of block and indent level.
- (if (> par 0) ; Unclosed Parenthesis
+ (if (> par 0) ; Unclosed Parenthesis
(list 'contexp par)
(list type (pascal-indent-level))))))
(ind 0))
;; Get right indent
(while (< (point) end)
- (if (re-search-forward
+ (if (re-search-forward
"^[ \t]*[^ \t,:]+[ \t]*\\(,[ \t]*[^ \t,:]+[ \t]*\\)*:"
(marker-position end) 'move)
(forward-char -1))
(let* ((oldpos (point))
(stpos (progn (goto-char (scan-lists (point) -1 1)) (point)))
(stcol (1+ (current-column)))
- (edpos (progn (pascal-declaration-end)
+ (edpos (progn (pascal-declaration-end)
(search-backward ")" (pascal-get-beg-of-line) t)
(point)))
(usevar (re-search-backward "\\<var\\>" stpos t)))
(let ((pos (point-marker)))
(if (and (not (or arg start)) (not (pascal-declaration-beg)))
()
- (let ((lineup (if (or (looking-at "\\<var\\>\\|\\<record\\>") arg start)
+ (let ((lineup (if (or (looking-at "\\<var\\>\\|\\<record\\>") arg start)
":" "="))
(stpos (if start start
(forward-word 2) (backward-word 1) (point)))
(end-of-line)
(skip-chars-backward " \t")
(1+ (current-column))))))
-
+
\f
;;;
(t "\\<\\(function\\|procedure\\)\\s +"))
"\\<\\(" pascal-str "[a-zA-Z0-9_.]*\\)\\>"))
match)
-
+
(if (not (looking-at "\\<\\(function\\|procedure\\)\\>"))
(re-search-backward "\\<\\(function\\|procedure\\)\\>" nil t))
(forward-char 1)
(while (< (point) end)
(if (re-search-forward "[:=]" (pascal-get-end-of-line) t)
;; Traverse current line
- (while (and (re-search-backward
- (concat "\\((\\|\\<\\(var\\|type\\|const\\)\\>\\)\\|"
+ (while (and (re-search-backward
+ (concat "\\((\\|\\<\\(var\\|type\\|const\\)\\>\\)\\|"
pascal-symbol-re)
(pascal-get-beg-of-line) t)
(not (match-end 1)))
(defun pascal-keyword-completion (keyword-list)
"Give list of all possible completions of keywords in KEYWORD-LIST."
- (mapcar '(lambda (s)
+ (mapcar '(lambda (s)
(if (string-match (concat "\\<" pascal-str) s)
(if (or (null pascal-pred)
(funcall pascal-pred s))
(save-excursion (pascal-var-completion))
(pascal-func-completion 'function)
(pascal-keyword-completion pascal-separator-keywords))))
-
+
;; Now we have built a list of all matches. Give response to caller
(pascal-completion-response))))
(progn
;; Update entry number in list
(setq pascal-last-completions allcomp
- pascal-last-word-numb
+ pascal-last-word-numb
(if (>= pascal-last-word-numb (1- (length allcomp)))
0
(1+ pascal-last-word-numb)))
(if (not (null (cdr allcomp)))
(message "(Complete but not unique)")
(message "(Sole completion)")))
- ;; Display buffer if the current completion didn't help
+ ;; Display buffer if the current completion didn't help
;; on completing the label.
((and (not (null (cdr allcomp))) (= (length pascal-str)
(length match)))
(setq pascal-str (pascal-build-defun-re "[a-zA-Z_]"))
(setq pascal-str (pascal-build-defun-re pascal-str)))
(goto-char (point-min))
-
+
;; Build a list of all possible completions
(while (re-search-forward pascal-str nil t)
(setq match (buffer-substring (match-beginning 2) (match-end 2)))
(defun pascal-outline-change (b e pascal-flag)
(let ((modp (buffer-modified-p)))
(unwind-protect
- (subst-char-in-region b e (if (= pascal-flag ?\n)
+ (subst-char-in-region b e (if (= pascal-flag ?\n)
?\^M ?\n) pascal-flag)
(set-buffer-modified-p modp))))