Commit aa7dab97 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

* lisp/progmodes/pascal.el (pascal--syntax-propertize): New const.

(pascal-mode): Use it.  Use setq-local.
(pascal-font-lock-keywords): Use backquotes.
Merge the two entries that handle function definitions.
* test/indent/pascal.pas: Add test for mis-identified comments.
parent cbee2131
2013-05-05 Stefan Monnier <monnier@iro.umontreal.ca>
* progmodes/pascal.el (pascal-font-lock-keywords): Use backquotes.
Merge the two entries that handle function definitions.
(pascal--syntax-propertize): New const.
(pascal-mode): Use it. Use setq-local.
2013-05-04 Glenn Morris <rgm@gnu.org> 2013-05-04 Glenn Morris <rgm@gnu.org>
   
* calendar/diary-lib.el (diary-from-outlook-function): New variable. * calendar/diary-lib.el (diary-from-outlook-function): New variable.
......
...@@ -158,31 +158,44 @@ ...@@ -158,31 +158,44 @@
(defconst pascal-font-lock-keywords (purecopy (defconst pascal-font-lock-keywords
(list `(("\\_<\\(function\\|pro\\(cedure\\|gram\\)\\)[ \t]+\\([[:alpha:]][[:alnum:]_]*\\)"
'("^[ \t]*\\(function\\|pro\\(cedure\\|gram\\)\\)\\>[ \t]*\\([a-z]\\)" (1 font-lock-keyword-face)
(3 font-lock-function-name-face))
;; ("type" "const" "real" "integer" "char" "boolean" "var"
;; "record" "array" "file")
(,(concat "\\<\\(array\\|boolean\\|c\\(har\\|onst\\)\\|file\\|"
"integer\\|re\\(al\\|cord\\)\\|type\\|var\\)\\>")
font-lock-type-face)
("\\<\\(label\\|external\\|forward\\)\\>" . font-lock-constant-face)
("\\<\\([0-9]+\\)[ \t]*:" 1 font-lock-function-name-face)
;; ("of" "to" "for" "if" "then" "else" "case" "while"
;; "do" "until" "and" "or" "not" "in" "with" "repeat" "begin" "end")
,(concat "\\<\\("
"and\\|begin\\|case\\|do\\|e\\(lse\\|nd\\)\\|for\\|i[fn]\\|"
"not\\|o[fr]\\|repeat\\|t\\(hen\\|o\\)\\|until\\|w\\(hile\\|ith\\)"
"\\)\\>")
("\\<\\(goto\\)\\>[ \t]*\\([0-9]+\\)?"
1 font-lock-keyword-face) 1 font-lock-keyword-face)
'("^[ \t]*\\(function\\|pro\\(cedure\\|gram\\)\\)\\>[ \t]*\\([a-z][a-z0-9_]*\\)" ("\\<\\(goto\\)\\>[ \t]*\\([0-9]+\\)?"
3 font-lock-function-name-face t) 2 font-lock-keyword-face t))
; ("type" "const" "real" "integer" "char" "boolean" "var"
; "record" "array" "file")
(cons (concat "\\<\\(array\\|boolean\\|c\\(har\\|onst\\)\\|file\\|"
"integer\\|re\\(al\\|cord\\)\\|type\\|var\\)\\>")
'font-lock-type-face)
'("\\<\\(label\\|external\\|forward\\)\\>" . font-lock-constant-face)
'("\\<\\([0-9]+\\)[ \t]*:" 1 font-lock-function-name-face)
; ("of" "to" "for" "if" "then" "else" "case" "while"
; "do" "until" "and" "or" "not" "in" "with" "repeat" "begin" "end")
(concat "\\<\\("
"and\\|begin\\|case\\|do\\|e\\(lse\\|nd\\)\\|for\\|i[fn]\\|"
"not\\|o[fr]\\|repeat\\|t\\(hen\\|o\\)\\|until\\|w\\(hile\\|ith\\)"
"\\)\\>")
'("\\<\\(goto\\)\\>[ \t]*\\([0-9]+\\)?"
1 font-lock-keyword-face)
'("\\<\\(goto\\)\\>[ \t]*\\([0-9]+\\)?"
2 font-lock-keyword-face t)))
"Additional expressions to highlight in Pascal mode.") "Additional expressions to highlight in Pascal mode.")
(put 'pascal-mode 'font-lock-defaults '(pascal-font-lock-keywords nil t))
(defconst pascal--syntax-propertize
(syntax-propertize-rules
;; The syntax-table settings are too coarse and end up treating /* and (/
;; as comment starters. Fix it here by removing the "2" from the syntax
;; of the second char of such sequences.
("/\\(\\*\\)" (1 ". 3b"))
("(\\(\\/\\)" (1 (prog1 ". 1c" (forward-char -1) nil)))
;; Pascal uses '' and "" rather than \' and \" to escape quotes.
("''\\|\"\"" (0 (if (save-excursion
(nth 3 (syntax-ppss (match-beginning 0))))
(string-to-syntax ".")
;; In case of 3 or more quotes in a row, only advance
;; one quote at a time.
(forward-char -1)
nil)))))
(defcustom pascal-indent-level 3 (defcustom pascal-indent-level 3
"Indentation of Pascal statements with respect to containing block." "Indentation of Pascal statements with respect to containing block."
...@@ -346,23 +359,22 @@ See also the user variables `pascal-type-keywords', `pascal-start-keywords' and ...@@ -346,23 +359,22 @@ See also the user variables `pascal-type-keywords', `pascal-start-keywords' and
Turning on Pascal mode calls the value of the variable pascal-mode-hook with Turning on Pascal mode calls the value of the variable pascal-mode-hook with
no args, if that value is non-nil." no args, if that value is non-nil."
(set (make-local-variable 'local-abbrev-table) pascal-mode-abbrev-table) (setq-local local-abbrev-table pascal-mode-abbrev-table)
(set (make-local-variable 'indent-line-function) 'pascal-indent-line) (setq-local indent-line-function 'pascal-indent-line)
(set (make-local-variable 'comment-indent-function) 'pascal-indent-comment) (setq-local comment-indent-function 'pascal-indent-comment)
(set (make-local-variable 'parse-sexp-ignore-comments) nil) (setq-local parse-sexp-ignore-comments nil)
(set (make-local-variable 'blink-matching-paren-dont-ignore-comments) t) (setq-local blink-matching-paren-dont-ignore-comments t)
(set (make-local-variable 'case-fold-search) t) (setq-local case-fold-search t)
(set (make-local-variable 'comment-start) "{") (setq-local comment-start "{")
(set (make-local-variable 'comment-start-skip) "(\\*+ *\\|{ *") (setq-local comment-start-skip "(\\*+ *\\|{ *")
(set (make-local-variable 'comment-end) "}") (setq-local comment-end "}")
(add-hook 'completion-at-point-functions 'pascal-completions-at-point nil t) (add-hook 'completion-at-point-functions 'pascal-completions-at-point nil t)
;; Font lock support ;; Font lock support
(set (make-local-variable 'font-lock-defaults) (setq-local font-lock-defaults '(pascal-font-lock-keywords nil t))
'(pascal-font-lock-keywords nil t)) (setq-local syntax-propertize-function pascal--syntax-propertize)
;; Imenu support ;; Imenu support
(set (make-local-variable 'imenu-generic-expression) (setq-local imenu-generic-expression pascal-imenu-generic-expression)
pascal-imenu-generic-expression) (setq-local imenu-case-fold-search t)
(set (make-local-variable 'imenu-case-fold-search) t)
;; Pascal-mode's own hide/show support. ;; Pascal-mode's own hide/show support.
(add-to-invisibility-spec '(pascal . t))) (add-to-invisibility-spec '(pascal . t)))
......
2013-05-05 Stefan Monnier <monnier@iro.umontreal.ca>
* indent/pascal.pas: Add test for mis-identified comments.
2013-04-01 Masatake YAMATO <yamato@redhat.com> 2013-04-01 Masatake YAMATO <yamato@redhat.com>
* automated/imenu-tests.el: New file. (Bug#14112) * automated/imenu-tests.el: New file. (Bug#14112)
...@@ -5,7 +9,7 @@ ...@@ -5,7 +9,7 @@
2013-04-19 Fabián Ezequiel Gallina <fgallina@gnu.org> 2013-04-19 Fabián Ezequiel Gallina <fgallina@gnu.org>
* automated/python-tests.el (python-imenu-prev-index-position-1): * automated/python-tests.el (python-imenu-prev-index-position-1):
Removed test. Remove test.
(python-imenu-create-index-1, python-imenu-create-flat-index-1): (python-imenu-create-index-1, python-imenu-create-flat-index-1):
New tests. New tests.
...@@ -62,8 +66,8 @@ ...@@ -62,8 +66,8 @@
(ruby-move-to-block-skips-percent-literal): Add depth-affecting (ruby-move-to-block-skips-percent-literal): Add depth-affecting
bits inside the examples. bits inside the examples.
(ruby-move-to-block-skips-heredoc): New test. (ruby-move-to-block-skips-heredoc): New test.
(ruby-add-log-current-method-after-inner-class): Lower (ruby-add-log-current-method-after-inner-class):
expectations: move point inside a method, initially. Lower expectations: move point inside a method, initially.
2013-02-13 Dmitry Gutov <dgutov@yandex.ru> 2013-02-13 Dmitry Gutov <dgutov@yandex.ru>
...@@ -76,8 +80,8 @@ ...@@ -76,8 +80,8 @@
2013-02-03 Chong Yidong <cyd@gnu.org> 2013-02-03 Chong Yidong <cyd@gnu.org>
* automated/files.el (file-test--do-local-variables-test): Avoid * automated/files.el (file-test--do-local-variables-test):
compilation warning message. Avoid compilation warning message.
2013-01-27 Dmitry Gutov <dgutov@yandex.ru> 2013-01-27 Dmitry Gutov <dgutov@yandex.ru>
...@@ -381,7 +385,7 @@ ...@@ -381,7 +385,7 @@
2011-07-26 Ulf Jasper <ulf.jasper@web.de> 2011-07-26 Ulf Jasper <ulf.jasper@web.de>
* automated/icalendar-tests.el (icalendar-tests--compare-strings): * automated/icalendar-tests.el (icalendar-tests--compare-strings):
Removed, simply use string=. Remove, simply use string=.
(icalendar--diarytime-to-isotime) (icalendar--diarytime-to-isotime)
(icalendar--datetime-to-diary-date) (icalendar--datetime-to-diary-date)
(icalendar--datestring-to-isodate) (icalendar--datestring-to-isodate)
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, version 2. published by the Free Software Foundation, version 3.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
...@@ -25,7 +25,10 @@ ...@@ -25,7 +25,10 @@
{$gnu-pascal,I+} {$gnu-pascal,I+}
(* second style of comment *)
// Free-pascal style comment. // Free-pascal style comment.
var x:Char = 12 /* 45; // This /* does not start a comment.
var x:Char = (/ 4); // This (/ does not start a comment.
program CRTDemo; program CRTDemo;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment