1 ;;; icon.el --- mode for editing Icon code
3 ;; Copyright (C) 1989 Free Software Foundation, Inc.
5 ;; Author: Chris Smith <csmith@convex.com>
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
28 ;; A major mode for editing the Icon programming language.
32 (defvar icon-mode-abbrev-table nil
33 "Abbrev table in use in Icon-mode buffers.")
34 (define-abbrev-table 'icon-mode-abbrev-table ())
36 (defvar icon-mode-map ()
37 "Keymap used in Icon mode.")
40 (let ((map (make-sparse-keymap "Icon")))
41 (setq icon-mode-map (make-sparse-keymap))
42 (define-key icon-mode-map "{" 'electric-icon-brace)
43 (define-key icon-mode-map "}" 'electric-icon-brace)
44 (define-key icon-mode-map "\e\C-h" 'mark-icon-function)
45 (define-key icon-mode-map "\e\C-a" 'beginning-of-icon-defun)
46 (define-key icon-mode-map "\e\C-e" 'end-of-icon-defun)
47 (define-key icon-mode-map "\e\C-q" 'indent-icon-exp)
48 (define-key icon-mode-map "\177" 'backward-delete-char-untabify)
49 (define-key icon-mode-map "\t" 'icon-indent-command)
51 (define-key icon-mode-map [menu-bar] (make-sparse-keymap))
52 (define-key icon-mode-map [menu-bar icon]
54 (define-key map [beginning-of-icon-defun] '("Beginning of function" . beginning-of-icon-defun))
55 (define-key map [end-of-icon-defun] '("End of function" . end-of-icon-defun))
56 (define-key map [comment-region] '("Comment Out Region" . comment-region))
57 (define-key map [indent-region] '("Indent Region" . indent-region))
58 (define-key map [indent-line] '("Indent Line" . icon-indent-command))
59 (put 'eval-region 'menu-enable 'mark-active)
60 (put 'comment-region 'menu-enable 'mark-active)
61 (put 'indent-region 'menu-enable 'mark-active)))
63 (defvar icon-mode-syntax-table nil
64 "Syntax table in use in Icon-mode buffers.")
66 (if icon-mode-syntax-table
68 (setq icon-mode-syntax-table (make-syntax-table))
69 (modify-syntax-entry ?\\ "\\" icon-mode-syntax-table)
70 (modify-syntax-entry ?# "<" icon-mode-syntax-table)
71 (modify-syntax-entry ?\n ">" icon-mode-syntax-table)
72 (modify-syntax-entry ?$ "." icon-mode-syntax-table)
73 (modify-syntax-entry ?/ "." icon-mode-syntax-table)
74 (modify-syntax-entry ?* "." icon-mode-syntax-table)
75 (modify-syntax-entry ?+ "." icon-mode-syntax-table)
76 (modify-syntax-entry ?- "." icon-mode-syntax-table)
77 (modify-syntax-entry ?= "." icon-mode-syntax-table)
78 (modify-syntax-entry ?% "." icon-mode-syntax-table)
79 (modify-syntax-entry ?< "." icon-mode-syntax-table)
80 (modify-syntax-entry ?> "." icon-mode-syntax-table)
81 (modify-syntax-entry ?& "." icon-mode-syntax-table)
82 (modify-syntax-entry ?| "." icon-mode-syntax-table)
83 (modify-syntax-entry ?\' "\"" icon-mode-syntax-table))
85 (defvar icon-indent-level 4
86 "*Indentation of Icon statements with respect to containing block.")
87 (defvar icon-brace-imaginary-offset 0
88 "*Imagined indentation of a Icon open brace that actually follows a statement.")
89 (defvar icon-brace-offset 0
90 "*Extra indentation for braces, compared with other text in same context.")
91 (defvar icon-continued-statement-offset 4
92 "*Extra indent for lines not starting new statements.")
93 (defvar icon-continued-brace-offset 0
94 "*Extra indent for substatements that start with open-braces.
95 This is in addition to icon-continued-statement-offset.")
97 (defvar icon-auto-newline nil
98 "*Non-nil means automatically newline before and after braces
99 inserted in Icon code.")
101 (defvar icon-tab-always-indent t
102 "*Non-nil means TAB in Icon mode should always reindent the current line,
103 regardless of where in the line point is when the TAB command is used.")
105 (defvar icon-imenu-generic-expression
106 '((nil "^[ \t]*procedure[ \t]*\\(\\sw+\\)[ \t]*(" 1))
107 "Imenu expression for Icon-mode. See `imenu-generic-expression'.")
113 "Major mode for editing Icon code.
114 Expression and list commands understand all Icon brackets.
115 Tab indents for Icon code.
116 Paragraphs are separated by blank lines only.
117 Delete converts tabs to spaces as it moves back.
119 Variables controlling indentation style:
120 icon-tab-always-indent
121 Non-nil means TAB in Icon mode should always reindent the current line,
122 regardless of where in the line point is when the TAB command is used.
124 Non-nil means automatically newline before and after braces
125 inserted in Icon code.
127 Indentation of Icon statements within surrounding block.
128 The surrounding block's indentation is the indentation
129 of the line on which the open-brace appears.
130 icon-continued-statement-offset
131 Extra indentation given to a substatement, such as the
132 then-clause of an if or body of a while.
133 icon-continued-brace-offset
134 Extra indentation given to a brace that starts a substatement.
135 This is in addition to `icon-continued-statement-offset'.
137 Extra indentation for line if it starts with an open brace.
138 icon-brace-imaginary-offset
139 An open brace following other text is treated as if it were
140 this far to the right of the start of its line.
142 Turning on Icon mode calls the value of the variable `icon-mode-hook'
143 with no args, if that value is non-nil."
145 (kill-all-local-variables)
146 (use-local-map icon-mode-map)
147 (setq major-mode 'icon-mode)
148 (setq mode-name "Icon")
149 (setq local-abbrev-table icon-mode-abbrev-table)
150 (set-syntax-table icon-mode-syntax-table)
151 (make-local-variable 'paragraph-start)
152 (setq paragraph-start (concat "$\\|" page-delimiter))
153 (make-local-variable 'paragraph-separate)
154 (setq paragraph-separate paragraph-start)
155 (make-local-variable 'indent-line-function)
156 (setq indent-line-function 'icon-indent-line)
157 (make-local-variable 'require-final-newline)
158 (setq require-final-newline t)
159 (make-local-variable 'comment-start)
160 (setq comment-start "# ")
161 (make-local-variable 'comment-end)
162 (setq comment-end "")
163 (make-local-variable 'comment-column)
164 (setq comment-column 32)
165 (make-local-variable 'comment-start-skip)
166 (setq comment-start-skip "# *")
167 (make-local-variable 'comment-indent-function)
168 (setq comment-indent-function 'icon-comment-indent)
170 (make-local-variable 'font-lock-defaults)
171 (setq font-lock-defaults
172 '((icon-font-lock-keywords
173 icon-font-lock-keywords-1
174 icon-font-lock-keywords-2
176 nil nil ((?_ . "w")) beginning-of-defun
177 (font-lock-comment-start-regexp . "#")
178 (font-lock-mark-block-function . mark-defun)))
180 (make-local-variable 'imenu-generic-expression)
181 (setq imenu-generic-expression icon-imenu-generic-expression)
183 ;; we start from the assertion that `hs-special-modes-alist' is autoloaded.
184 (pushnew '(icon-mode "procedure" "end" icon-forward-sexp-function)
185 hs-special-modes-alist :test 'equal)
186 (run-hooks 'icon-mode-hook))
188 ;; This is used by indent-for-comment to decide how much to
189 ;; indent a comment in Icon code based on its context.
190 (defun icon-comment-indent ()
191 (if (looking-at "^#")
194 (skip-chars-backward " \t")
195 (max (if (bolp) 0 (1+ (current-column)))
198 (defun electric-icon-brace (arg)
199 "Insert character and correct line's indentation."
205 (skip-chars-backward " \t")
207 (if icon-auto-newline
208 (progn (icon-indent-line) (newline) t)
211 (insert last-command-char)
213 (if icon-auto-newline
216 ;; (newline) may have done auto-fill
217 (setq insertpos (- (point) 2))
220 (if insertpos (goto-char (1+ insertpos)))
224 (goto-char insertpos)
225 (self-insert-command (prefix-numeric-value arg)))
226 (self-insert-command (prefix-numeric-value arg)))))
228 (defun icon-indent-command (&optional whole-exp)
230 "Indent current line as Icon code, or in some cases insert a tab character.
231 If `icon-tab-always-indent' is non-nil (the default), always indent current
232 line. Otherwise, indent the current line only if point is at the left margin
233 or in the line's indentation; otherwise insert a tab.
235 A numeric argument, regardless of its value, means indent rigidly all the
236 lines of the expression starting after point so that this line becomes
237 properly indented. The relative indentation among the lines of the
238 expression are preserved."
240 ;; If arg, always indent this line as Icon
241 ;; and shift remaining lines of expression the same amount.
242 (let ((shift-amt (icon-indent-line))
245 (if icon-tab-always-indent
254 (indent-code-rigidly beg end shift-amt "#")))
255 (if (and (not icon-tab-always-indent)
257 (skip-chars-backward " \t")
260 (icon-indent-line))))
262 (defun icon-indent-line ()
263 "Indent current line as Icon code.
264 Return the amount the indentation changed by."
265 (let ((indent (calculate-icon-indent nil))
267 (case-fold-search nil)
268 (pos (- (point-max) (point))))
271 (cond ((eq indent nil)
272 (setq indent (current-indentation)))
274 (setq indent (calculate-icon-indent-within-comment)))
275 ((looking-at "[ \t]*#")
278 (skip-chars-forward " \t")
279 (if (listp indent) (setq indent (car indent)))
280 (cond ((and (looking-at "else\\b")
281 (not (looking-at "else\\s_")))
282 (setq indent (save-excursion
283 (icon-backward-to-start-of-if)
284 (current-indentation))))
285 ((or (= (following-char) ?})
286 (looking-at "end\\b"))
287 (setq indent (- indent icon-indent-level)))
288 ((= (following-char) ?{)
289 (setq indent (+ indent icon-brace-offset))))))
290 (skip-chars-forward " \t")
291 (setq shift-amt (- indent (current-column)))
292 (if (zerop shift-amt)
293 (if (> (- (point-max) pos) (point))
294 (goto-char (- (point-max) pos)))
295 (delete-region beg (point))
297 ;; If initial point was within line's indentation,
298 ;; position after the indentation. Else stay at same point in text.
299 (if (> (- (point-max) pos) (point))
300 (goto-char (- (point-max) pos))))
303 (defun calculate-icon-indent (&optional parse-start)
304 "Return appropriate indentation for current line as Icon code.
305 In usual case returns an integer: the column to indent to.
306 Returns nil if line starts inside a string, t if in a comment."
309 (let ((indent-point (point))
310 (case-fold-search nil)
315 (goto-char parse-start)
316 (setq toplevel (beginning-of-icon-defun)))
317 (while (< (point) indent-point)
318 (setq parse-start (point))
319 (setq state (parse-partial-sexp (point) indent-point 0))
320 (setq containing-sexp (car (cdr state))))
321 (cond ((or (nth 3 state) (nth 4 state))
322 ;; return nil or t if should not change this line
324 ((and containing-sexp
325 (/= (char-after containing-sexp) ?{))
326 ;; line is expression, not statement:
327 ;; indent to just after the surrounding open.
328 (goto-char (1+ containing-sexp))
332 ;; Outside any procedures.
333 (progn (icon-backward-to-noncomment (point-min))
334 (if (icon-is-continuation-line)
335 icon-continued-statement-offset 0))
337 (if (null containing-sexp)
338 (progn (beginning-of-icon-defun)
339 (setq containing-sexp (point))))
340 (goto-char indent-point)
341 ;; Is it a continuation or a new statement?
342 ;; Find previous non-comment character.
343 (icon-backward-to-noncomment containing-sexp)
344 ;; Now we get the answer.
345 (if (icon-is-continuation-line)
346 ;; This line is continuation of preceding line's statement;
347 ;; indent icon-continued-statement-offset more than the
348 ;; first line of the statement.
350 (icon-backward-to-start-of-continued-exp containing-sexp)
351 (+ icon-continued-statement-offset (current-column)
352 (if (save-excursion (goto-char indent-point)
353 (skip-chars-forward " \t")
354 (eq (following-char) ?{))
355 icon-continued-brace-offset 0)))
356 ;; This line starts a new statement.
357 ;; Position following last unclosed open.
358 (goto-char containing-sexp)
359 ;; Is line first statement after an open-brace?
361 ;; If no, find that first statement and indent like it.
363 (if (looking-at "procedure\\s ")
366 (while (progn (skip-chars-forward " \t\n")
368 ;; Skip over comments following openbrace.
370 ;; The first following code counts
371 ;; if it is before the line we want to indent.
372 (and (< (point) indent-point)
374 ;; If no previous statement,
375 ;; indent it relative to line brace is on.
376 ;; For open brace in column zero, don't let statement
377 ;; start there too. If icon-indent-level is zero,
378 ;; use icon-brace-offset + icon-continued-statement-offset
380 ;; For open-braces not the first thing in a line,
381 ;; add in icon-brace-imaginary-offset.
382 (+ (if (and (bolp) (zerop icon-indent-level))
384 icon-continued-statement-offset)
386 ;; Move back over whitespace before the openbrace.
387 ;; If openbrace is not first nonwhite thing on the line,
388 ;; add the icon-brace-imaginary-offset.
389 (progn (skip-chars-backward " \t")
390 (if (bolp) 0 icon-brace-imaginary-offset))
391 ;; Get initial indentation of the line we are on.
392 (current-indentation))))))))))
394 ;; List of words to check for as the last thing on a line.
395 ;; If cdr is t, next line is a continuation of the same statement,
396 ;; if cdr is nil, next line starts a new (possibly indented) statement.
398 (defconst icon-resword-alist
399 '(("by" . t) ("case" . t) ("create") ("do") ("dynamic" . t) ("else")
400 ("every" . t) ("if" . t) ("global" . t) ("initial" . t)
401 ("link" . t) ("local" . t) ("of") ("record" . t) ("repeat" . t)
402 ("static" . t) ("then") ("to" . t) ("until" . t) ("while" . t)))
404 (defun icon-is-continuation-line ()
405 (let* ((ch (preceding-char))
406 (ch-syntax (char-syntax ch)))
407 (if (eq ch-syntax ?w)
408 (assoc (buffer-substring
409 (progn (forward-word -1) (point))
410 (progn (forward-word 1) (point)))
412 (not (memq ch '(0 ?\; ?\} ?\{ ?\) ?\] ?\" ?\' ?\n))))))
414 (defun icon-backward-to-noncomment (lim)
417 (skip-chars-backward " \t\n\f" lim)
418 (setq opoint (point))
420 (if (and (nth 5 (parse-partial-sexp (point) opoint))
422 (search-backward "#")
425 (defun icon-backward-to-start-of-continued-exp (lim)
426 (if (memq (preceding-char) '(?\) ?\]))
429 (skip-chars-forward " \t")
431 ((<= (point) lim) (goto-char (1+ lim)))
432 ((not (icon-is-continued-line)) 0)
433 ((and (eq (char-syntax (following-char)) ?w)
435 (assoc (buffer-substring (point)
436 (save-excursion (forward-word 1) (point)))
437 icon-resword-alist))) 0)
438 (t (end-of-line 0) (icon-backward-to-start-of-continued-exp lim))))
440 (defun icon-is-continued-line ()
443 (icon-is-continuation-line)))
445 (defun icon-backward-to-start-of-if (&optional limit)
446 "Move to the start of the last \"unbalanced\" if."
447 (or limit (setq limit (save-excursion (beginning-of-icon-defun) (point))))
449 (case-fold-search nil))
450 (while (not (zerop if-level))
452 (cond ((looking-at "else\\b")
453 (setq if-level (1+ if-level)))
454 ((looking-at "if\\b")
455 (setq if-level (1- if-level)))
458 (goto-char limit))))))
460 (defun mark-icon-function ()
461 "Put mark at end of Icon function, point at beginning."
466 (beginning-of-line 0)
467 (beginning-of-icon-defun))
469 (defun beginning-of-icon-defun ()
470 "Go to the start of the enclosing procedure; return t if at top level."
472 (if (re-search-backward "^procedure\\s \\|^end[ \t\n]" (point-min) 'move)
476 (defun end-of-icon-defun ()
478 (if (not (bobp)) (forward-char -1))
479 (re-search-forward "\\(\\s \\|^\\)end\\(\\s \\|$\\)" (point-max) 'move)
483 (defun indent-icon-exp ()
484 "Indent each line of the Icon grouping following point."
486 (let ((indent-stack (list nil))
487 (contain-stack (list (point)))
488 (case-fold-search nil)
489 restart outer-loop-done inner-loop-done state ostate
490 this-indent last-sexp
491 at-else at-brace at-do
497 (setq outer-loop-done nil)
498 (while (and (not (eobp)) (not outer-loop-done))
499 (setq last-depth next-depth)
500 ;; Compute how depth changes over this line
501 ;; plus enough other lines to get to one that
502 ;; does not end inside a comment or string.
503 ;; Meanwhile, do appropriate indentation on comment lines.
504 (setq innerloop-done nil)
505 (while (and (not innerloop-done)
506 (not (and (eobp) (setq outer-loop-done t))))
508 (setq state (parse-partial-sexp (point) (progn (end-of-line) (point))
510 (setq next-depth (car state))
511 (if (and (car (cdr (cdr state)))
512 (>= (car (cdr (cdr state))) 0))
513 (setq last-sexp (car (cdr (cdr state)))))
514 (if (or (nth 4 ostate))
516 (if (or (nth 3 state))
518 (setq innerloop-done t)))
519 (if (<= next-depth 0)
520 (setq outer-loop-done t))
523 (if (/= last-depth next-depth)
524 (setq last-sexp nil))
525 (while (> last-depth next-depth)
526 (setq indent-stack (cdr indent-stack)
527 contain-stack (cdr contain-stack)
528 last-depth (1- last-depth)))
529 (while (< last-depth next-depth)
530 (setq indent-stack (cons nil indent-stack)
531 contain-stack (cons nil contain-stack)
532 last-depth (1+ last-depth)))
533 (if (null (car contain-stack))
534 (setcar contain-stack (or (car (cdr state))
535 (save-excursion (forward-sexp -1)
538 (skip-chars-forward " \t")
541 (if (and (car indent-stack)
542 (>= (car indent-stack) 0))
543 ;; Line is on an existing nesting level.
544 ;; Lines inside parens are handled specially.
545 (if (/= (char-after (car contain-stack)) ?{)
546 (setq this-indent (car indent-stack))
547 ;; Line is at statement level.
548 ;; Is it a new statement? Is it an else?
549 ;; Find last non-comment character before this line
551 (setq at-else (looking-at "else\\W"))
552 (setq at-brace (= (following-char) ?{))
553 (icon-backward-to-noncomment opoint)
554 (if (icon-is-continuation-line)
555 ;; Preceding line did not end in comma or semi;
556 ;; indent this line icon-continued-statement-offset
557 ;; more than previous.
559 (icon-backward-to-start-of-continued-exp (car contain-stack))
561 (+ icon-continued-statement-offset (current-column)
562 (if at-brace icon-continued-brace-offset 0))))
563 ;; Preceding line ended in comma or semi;
564 ;; use the standard indent for this level.
566 (progn (icon-backward-to-start-of-if opoint)
567 (setq this-indent (current-indentation)))
568 (setq this-indent (car indent-stack))))))
569 ;; Just started a new nesting level.
570 ;; Compute the standard indent for this level.
571 (let ((val (calculate-icon-indent
572 (if (car indent-stack)
573 (- (car indent-stack))))))
575 (setq this-indent val))))
576 ;; Adjust line indentation according to its contents
577 (if (or (= (following-char) ?})
578 (looking-at "end\\b"))
579 (setq this-indent (- this-indent icon-indent-level)))
580 (if (= (following-char) ?{)
581 (setq this-indent (+ this-indent icon-brace-offset)))
582 ;; Put chosen indentation into effect.
583 (or (= (current-column) this-indent)
585 (delete-region (point) (progn (beginning-of-line) (point)))
586 (indent-to this-indent)))
587 ;; Indent any comment following the text.
588 (or (looking-at comment-start-skip)
589 (if (re-search-forward comment-start-skip (save-excursion (end-of-line) (point)) t)
590 (progn (indent-for-comment) (beginning-of-line))))))))))
592 (defconst icon-font-lock-keywords-1
595 ;; Fontify procedure name definitions.
596 '("^[ \t]*\\(procedure\\)[ \t]*\\(\\sw+\\)[ \t]*("
597 (1 font-lock-builtin-face) (2 font-lock-function-name-face nil t))))
598 "Subdued level highlighting for `icon-mode'.")
600 (defconst icon-font-lock-keywords-2
602 icon-font-lock-keywords-1
605 ;; Fontify all type specifiers.
606 ;;"null" "string" "co-expression" "table" "integer" "cset" "set" "real" "file" "list"
607 (cons "\\<\\(c\\(o-expression\\|set\\)\\|file\\|integer\\|list\\|null\\|real\\|s\\(et\\|tring\\)\\|table\\)\\>"'font-lock-type-face)
608 ;; Fontify all keywords.
609 ;;"break" "do" "next" "repeat" "to" "by" "else" "if" "not" "return" "until" "case" "of" "while" "create" "every" "suspend" "default" "fail" "record" "then"
610 (cons "\\<\\(b\\(reak\\|y\\)\\|c\\(ase\\|reate\\)\\|d\\(efault\\|o\\)\\|e\\(lse\\|very\\)\\|fail\\|if\\|n\\(ext\\|ot\\)\\|of\\|re\\(cord\\|peat\\|turn\\)\\|suspend\\|t\\(hen\\|o\\)\\|until\\|while\\)\\>" 'font-lock-keyword-face)
612 (cons (concat "\\<\\(end\\|initial\\)\\>") 'font-lock-builtin-face)
613 ;; Fontify all system variables.
614 ;;"&allocated" "&ascii" "&clock" "&col" "&collections" "&column" "&control" "&cset" "¤t" "&date" "&dateline" "&digits" "&dump" "&error" "&errornumber" "&errortext" "&errorvalue" "&errout" "&eventcode" "&eventsource" "&eventvalue" "&fail" "&features" "&file" "&host" "&input" "&interval" "&lcase" "&ldrag" "&letters" "&level" "&line" "&lpress" "&lrelease" "&main" "&mdrag" "&meta" "&mpress" "&mrelease" "&null" "&output" "&phi" "&pi" "&pos" "&progname" "&random" "&rdrag" "®ions" "&resize" "&row" "&rpress" "&rrelease" "&shift" "&source" "&storage" "&subject" "&time" "&trace" "&ucase" "&version" "&window" "&x" "&y"
615 (cons (concat "\\(&\\(a\\(llocated\\|scii\\)\\|c\\(lock\\|o\\(l\\(\\|lections\\|umn\\)\\|ntrol\\)\\|set\\|urrent\\)\\|d\\(ate\\(\\|line\\)\\|igits\\|ump\\)\\|e\\(rro\\(r\\(\\|number\\|text\\|value\\)\\|ut\\)\\|vent\\(code\\|source\\|value\\)\\)\\|f\\(ail\\|eatures\\|ile\\)\\|host\\|in\\(put\\|terval\\)\\|l\\(case\\|drag\\|e\\(tters\\|vel\\)\\|ine\\|press\\|release\\)\\|m\\(ain\\|drag\\|eta\\|press\\|release\\)\\|null\\|output\\|p\\(hi\\|i\\|os\\|rogname\\)\\|r\\(andom\\|drag\\|e\\(gions\\|size\\)\\|ow\\|press\\|release\\)\\|s\\(hift\\|ource\\|torage\\|ubject\\)\\|t\\(ime\\|race\\)\\|ucase\\|version\\|window\\|[exy]\\)\\)") 'font-lock-reference-face)
616 ;; global local static declarations and link files
617 (cons "^[ \t]*\\(global\\|link\\|local\\|static\\)\\(\\sw+\\>\\)*"
618 '((1 font-lock-builtin-face)
619 (font-lock-match-c-style-declaration-item-and-skip-to-next
620 (goto-char (or (match-beginning 2) (match-end 1))) nil
621 (1 (if (match-beginning 2)
622 font-lock-function-name-face
623 font-lock-variable-name-face)))))
624 ;; $define $elif $ifdef $ifdef $ifndef
625 (cons "^\\(\\$\\(define\\|elif\\|if\\(\\|def\\|ndef\\)\\|undef\\)\\)[ \t]+\\([^ \t\n]+\\)"
626 '((1 font-lock-builtin-face) (4 font-lock-variable-name-face nil t)))
627 ;; $dump $endif $else $include
628 (cons "^\\(\\$\\(dump\\|e\\(lse\\|ndif\\)\\|include\\)\\)\\>" 'font-lock-builtin-face)
630 (cons "^\\(\\$\\(warning\\|error\\)\\)[ \t]+\\([^\n]+\\)"
631 '((1 font-lock-builtin-face) (3 font-lock-warning-face nil t)))
633 "Gaudy level highlighting for `icon-mode'.")
635 (defvar icon-font-lock-keywords icon-font-lock-keywords-1
636 "Default expressions to highlight in `icon-mode'.")
638 ;;;used by hs-minor-mode
639 (defun icon-forward-sexp-function (arg)
641 (re-search-forward "^[ \t]*end")
642 (re-search-backward "^[ \t]procedure")))
645 ;;; icon.el ends here