diff options
| author | Simon Marshall | 1997-06-19 08:55:24 +0000 |
|---|---|---|
| committer | Simon Marshall | 1997-06-19 08:55:24 +0000 |
| commit | 52bb674b93a4b6b69fe00f4c2da5e564b1543d8e (patch) | |
| tree | 8657045e12b21b636b22fc07e2ed12bd8dbb9498 | |
| parent | 23a0e11b3bf8f0c8c63ab24ed76c9b849d4c79f8 (diff) | |
| download | emacs-52bb674b93a4b6b69fe00f4c2da5e564b1543d8e.tar.gz emacs-52bb674b93a4b6b69fe00f4c2da5e564b1543d8e.zip | |
Do <* *> via syntax table not regexps; use regexp-opt.
| -rw-r--r-- | lisp/progmodes/modula2.el | 65 |
1 files changed, 26 insertions, 39 deletions
diff --git a/lisp/progmodes/modula2.el b/lisp/progmodes/modula2.el index 47ef7d97017..c28758538ed 100644 --- a/lisp/progmodes/modula2.el +++ b/lisp/progmodes/modula2.el | |||
| @@ -151,14 +151,14 @@ followed by the first character of the construct. | |||
| 151 | (setq font-lock-defaults | 151 | (setq font-lock-defaults |
| 152 | '((m3-font-lock-keywords | 152 | '((m3-font-lock-keywords |
| 153 | m3-font-lock-keywords-1 m3-font-lock-keywords-2) | 153 | m3-font-lock-keywords-1 m3-font-lock-keywords-2) |
| 154 | nil nil ((?_ . "w") (?. . "w")) nil | 154 | nil nil ((?_ . "w") (?. . "w") (?< . ". 1") (?> . ". 4")) nil |
| 155 | ;; Obsoleted by Emacs 19.35 parse-partial-sexp's COMMENTSTOP. | 155 | ;; Obsoleted by Emacs 19.35 parse-partial-sexp's COMMENTSTOP. |
| 156 | ;(font-lock-comment-start-regexp . "(\\*") | 156 | ;(font-lock-comment-start-regexp . "(\\*") |
| 157 | )) | 157 | )) |
| 158 | (run-hooks 'm2-mode-hook)) | 158 | (run-hooks 'm2-mode-hook)) |
| 159 | 159 | ||
| 160 | ;; Regexps written with help from Ron Forrester <ron@orcad.com>. | 160 | ;; Regexps written with help from Ron Forrester <ron@orcad.com> |
| 161 | 161 | ;; and Spencer Allain <sallain@teknowledge.com>. | |
| 162 | (defconst m3-font-lock-keywords-1 | 162 | (defconst m3-font-lock-keywords-1 |
| 163 | '( | 163 | '( |
| 164 | ;; | 164 | ;; |
| @@ -174,7 +174,10 @@ followed by the first character of the construct. | |||
| 174 | (1 font-lock-reference-face))) | 174 | (1 font-lock-reference-face))) |
| 175 | ;; | 175 | ;; |
| 176 | ;; Pragmas as warnings. | 176 | ;; Pragmas as warnings. |
| 177 | ("<\\*.*\\*>" . font-lock-warning-face) | 177 | ;; Spencer Allain <sallain@teknowledge.com> says do them as comments... |
| 178 | ;; ("<\\*.*\\*>" . font-lock-warning-face) | ||
| 179 | ;; ... but instead we fontify the first word. | ||
| 180 | ("<\\*[ \t]*\\(\\sw+\\)" 1 font-lock-warning-face prepend) | ||
| 178 | ) | 181 | ) |
| 179 | "Subdued level highlighting for Modula-3 modes.") | 182 | "Subdued level highlighting for Modula-3 modes.") |
| 180 | 183 | ||
| @@ -182,42 +185,25 @@ followed by the first character of the construct. | |||
| 182 | (append m3-font-lock-keywords-1 | 185 | (append m3-font-lock-keywords-1 |
| 183 | (eval-when-compile | 186 | (eval-when-compile |
| 184 | (let ((m3-types | 187 | (let ((m3-types |
| 185 | ; (make-regexp | 188 | (regexp-opt |
| 186 | ; '("INTEGER" "BITS" "BOOLEAN" "CARDINAL" "CHAR" "FLOAT" | 189 | '("INTEGER" "BITS" "BOOLEAN" "CARDINAL" "CHAR" "FLOAT" "REAL" |
| 187 | ; "LONGREAL" "REAL" "REFANY" "ADDRESS" "ARRAY" "TEXT")) | 190 | "LONGREAL" "REFANY" "ADDRESS" "ARRAY" "SET" "TEXT" |
| 188 | (concat "A\\(DDRESS\\|RRAY\\)\\|B\\(ITS\\|OOLEAN\\)\\|" | 191 | "MUTEX" "ROOT" "EXTENDED"))) |
| 189 | "C\\(ARDINAL\\|HAR\\)\\|FLOAT\\|INTEGER\\|LONGREAL\\|" | ||
| 190 | "RE\\(AL\\|FANY\\)\\|TEXT")) | ||
| 191 | (m3-keywords | 192 | (m3-keywords |
| 192 | ; (make-regexp | 193 | (regexp-opt |
| 193 | ; '("AND" "ANY" "AS" "BEGIN" "BRANDED" "BY" "CASE" "CONST" "DIV" | 194 | '("AND" "ANY" "AS" "BEGIN" "BRANDED" "BY" "CASE" "CONST" "DIV" |
| 194 | ; "DO" "ELSE" "ELSIF" "EVAL" "EXCEPT" "EXIT" "EXTENDED" "FINALLY" | 195 | "DO" "ELSE" "ELSIF" "EVAL" "EXCEPT" "EXIT" "FINALLY" |
| 195 | ; "FOR" "IF" "IN" "LOCK" "LOOP" "METHODS" "MOD" "MUTEX" "NOT" | 196 | "FOR" "GENERIC" "IF" "IN" "LOCK" "LOOP" "METHODS" "MOD" "NOT" |
| 196 | ; "OBJECT" "OF" "OR" "OVERRIDES" "READONLY" "RECORD" "REF" | 197 | "OBJECT" "OF" "OR" "OVERRIDES" "READONLY" "RECORD" "REF" |
| 197 | ; "REPEAT" "RETURN" "REVEAL" "ROOT" "SET" "THEN" "TO" "TRY" | 198 | "REPEAT" "RETURN" "REVEAL" "THEN" "TO" "TRY" |
| 198 | ; "TYPE" "TYPECASE" "UNSAFE" "UNTIL" "UNTRACED" "VAR" "VALUE" | 199 | "TYPE" "TYPECASE" "UNSAFE" "UNTIL" "UNTRACED" "VAR" "VALUE" |
| 199 | ; "WHILE" "WITH")) | 200 | "WHILE" "WITH"))) |
| 200 | (concat "A\\(N[DY]\\|S\\)\\|B\\(EGIN\\|RANDED\\|Y\\)\\|" | ||
| 201 | "C\\(ASE\\|ONST\\)\\|D\\(IV\\|O\\)\\|" | ||
| 202 | "E\\(LS\\(E\\|IF\\)\\|VAL\\|" | ||
| 203 | "X\\(CEPT\\|IT\\|TENDED\\)\\)\\|F\\(INALLY\\|OR\\)\\|" | ||
| 204 | "I[FN]\\|LO\\(CK\\|OP\\)\\|M\\(ETHODS\\|OD\\|UTEX\\)\\|" | ||
| 205 | "NOT\\|O\\([FR]\\|BJECT\\|VERRIDES\\)\\|" | ||
| 206 | "R\\(E\\(ADONLY\\|CORD\\|F\\|PEAT\\|TURN\\|VEAL\\)\\|" | ||
| 207 | "OOT\\)\\|SET\\|T\\(HEN\\|O\\|RY\\|YPE\\(\\|CASE\\)\\)\\|" | ||
| 208 | "UN\\(SAFE\\|T\\(IL\\|RACED\\)\\)\\|VA\\(LUE\\|R\\)\\|" | ||
| 209 | "W\\(HILE\\|ITH\\)")) | ||
| 210 | (m3-builtins | 201 | (m3-builtins |
| 211 | ; (make-regexp | 202 | (regexp-opt |
| 212 | ; '("ABS" "ADR" "ADRSIZE" "BITSIZE" "BYTESIZE" "CEILING" | 203 | '("ABS" "ADR" "ADRSIZE" "BITSIZE" "BYTESIZE" "CEILING" |
| 213 | ; "DEC" "DISPOSE" "FIRST" "FLOOR" "INC" "ISTYPE" "LAST" | 204 | "DEC" "DISPOSE" "FIRST" "FLOOR" "INC" "ISTYPE" "LAST" |
| 214 | ; "LOOPHOLE" "MAX" "MIN" "NARROW" "NEW" "NUMBER" "ORD" | 205 | "LOOPHOLE" "MAX" "MIN" "NARROW" "NEW" "NUMBER" "ORD" |
| 215 | ; "ROUND" "SUBARRAY" "TRUNC" "TYPECODE" "VAL")) | 206 | "ROUND" "SUBARRAY" "TRUNC" "TYPECODE" "VAL"))) |
| 216 | (concat "A\\(BS\\|DR\\(\\|SIZE\\)\\)\\|B\\(ITSIZE\\|YTESIZE\\)\\|" | ||
| 217 | "CEILING\\|D\\(EC\\|ISPOSE\\)\\|F\\(IRST\\|LOOR\\)\\|" | ||
| 218 | "I\\(NC\\|STYPE\\)\\|L\\(AST\\|OOPHOLE\\)\\|" | ||
| 219 | "M\\(AX\\|IN\\)\\|N\\(ARROW\\|EW\\|UMBER\\)\\|ORD\\|" | ||
| 220 | "ROUND\\|SUBARRAY\\|T\\(RUNC\\|YPECODE\\)\\|VAL")) | ||
| 221 | ) | 207 | ) |
| 222 | (list | 208 | (list |
| 223 | ;; | 209 | ;; |
| @@ -233,7 +219,8 @@ followed by the first character of the construct. | |||
| 233 | ;; Fontify tokens as function names. | 219 | ;; Fontify tokens as function names. |
| 234 | '("\\<\\(END\\|EXCEPTION\\|RAISES?\\)\\>[ \t{]*" | 220 | '("\\<\\(END\\|EXCEPTION\\|RAISES?\\)\\>[ \t{]*" |
| 235 | (1 font-lock-keyword-face) | 221 | (1 font-lock-keyword-face) |
| 236 | (font-lock-match-c-style-declaration-item-and-skip-to-next nil nil | 222 | (font-lock-match-c-style-declaration-item-and-skip-to-next |
| 223 | nil (goto-char (match-end 0)) | ||
| 237 | (1 font-lock-function-name-face))) | 224 | (1 font-lock-function-name-face))) |
| 238 | ;; | 225 | ;; |
| 239 | ;; Fontify constants as references. | 226 | ;; Fontify constants as references. |