Mercurial > emacs
annotate lisp/progmodes/awk-mode.el @ 20892:18f3cb26243f before-miles-orphaned-changes gcc-2_8_1-980401 gcc-2_8_1-980407 gcc-2_8_1-980412 gcc-2_8_1-980413 gcc-2_8_1-RELEASE gcc_2_8_1-980315 libc-980214 libc-980215 libc-980216 libc-980217 libc-980218 libc-980219 libc-980220 libc-980221 libc-980222 libc-980223 libc-980224 libc-980225 libc-980226 libc-980227 libc-980228 libc-980301 libc-980302 libc-980303 libc-980304 libc-980306 libc-980307 libc-980308 libc-980309 libc-980310 libc-980311 libc-980312 libc-980313 libc-980314 libc-980315 libc-980316 libc-980317 libc-980318 libc-980319 libc-980320 libc-980321 libc-980322 libc-980323 libc-980324 libc-980325 libc-980326 libc-980327 libc-980328 libc-980329 libc-980330 libc-980331 libc-980401 libc-980402 libc-980403 libc-980404 libc-980405 libc-980406 libc-980407 libc-980408 libc-980409 libc-980410 libc-980411 libc-980412 libc-980413 libc-980414 libc-980428 libc-980429 libc-980430 libc-980501 libc-980502 libc-980503 libc-980504 libc-980505 libc-980506 libc-980507 libc-980508 libc-980509 libc-980510 libc-980512 libc-980513 libc-980514 libc-980515 libc-980516 libc-980517 libc-980518 libc-980519 libc-980520 libc-980521 libc-980522 libc-980523 libc-980524 libc-980525 libc-980526 libc-980527 libc-980528 libc-980529 libc-980530 libc-980531 libc-980601 libc-980602 libc-980603 libc-980604 libc-980605 libc-980606 libc-980607 libc-980608 libc-980609 libc-980610 libc-980611 libc-980612 libc-980613
Add PentiumII (i786). Add '7' to all i[3456] entries.
Add AMD and Cyrix names for P5 and P6.
author | Richard Kenner <kenner@gnu.org> |
---|---|
date | Fri, 13 Feb 1998 12:16:46 +0000 |
parents | cc9e75f82cdb |
children | f3f9df46d008 |
rev | line source |
---|---|
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
257
diff
changeset
|
1 ;;; awk-mode.el --- AWK code editing commands for Emacs |
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
257
diff
changeset
|
2 |
16451
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
3 ;; Copyright (C) 1988, 1994, 1996 Free Software Foundation, Inc. |
845 | 4 |
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
5 ;; Maintainer: FSF |
2247
2c7997f249eb
Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
845
diff
changeset
|
6 ;; Keywords: unix, languages |
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
7 |
257 | 8 ;; This file is part of GNU Emacs. |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
12 ;; the Free Software Foundation; either version 2, or (at your option) |
257 | 13 ;; any later version. |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
14169 | 21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
257 | 24 |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
25 ;;; Commentary: |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
26 |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
27 ;; Sets up C-mode with support for awk-style #-comments and a lightly |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
28 ;; hacked syntax table. |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
29 |
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
30 ;;; Code: |
257 | 31 |
32 (defvar awk-mode-syntax-table nil | |
33 "Syntax table in use in Awk-mode buffers.") | |
34 | |
35 (if awk-mode-syntax-table | |
36 () | |
37 (setq awk-mode-syntax-table (make-syntax-table)) | |
38 (modify-syntax-entry ?\\ "\\" awk-mode-syntax-table) | |
5329
af96725f9e00
(awk-mode-syntax-table): Was mistakenly changing
Richard M. Stallman <rms@gnu.org>
parents:
5266
diff
changeset
|
39 (modify-syntax-entry ?\n "> " awk-mode-syntax-table) |
af96725f9e00
(awk-mode-syntax-table): Was mistakenly changing
Richard M. Stallman <rms@gnu.org>
parents:
5266
diff
changeset
|
40 (modify-syntax-entry ?\f "> " awk-mode-syntax-table) |
af96725f9e00
(awk-mode-syntax-table): Was mistakenly changing
Richard M. Stallman <rms@gnu.org>
parents:
5266
diff
changeset
|
41 (modify-syntax-entry ?\# "< " awk-mode-syntax-table) |
257 | 42 (modify-syntax-entry ?/ "." awk-mode-syntax-table) |
43 (modify-syntax-entry ?* "." awk-mode-syntax-table) | |
44 (modify-syntax-entry ?+ "." awk-mode-syntax-table) | |
45 (modify-syntax-entry ?- "." awk-mode-syntax-table) | |
46 (modify-syntax-entry ?= "." awk-mode-syntax-table) | |
47 (modify-syntax-entry ?% "." awk-mode-syntax-table) | |
48 (modify-syntax-entry ?< "." awk-mode-syntax-table) | |
49 (modify-syntax-entry ?> "." awk-mode-syntax-table) | |
50 (modify-syntax-entry ?& "." awk-mode-syntax-table) | |
51 (modify-syntax-entry ?| "." awk-mode-syntax-table) | |
16451
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
52 (modify-syntax-entry ?_ "_" awk-mode-syntax-table) |
257 | 53 (modify-syntax-entry ?\' "\"" awk-mode-syntax-table)) |
54 | |
55 (defvar awk-mode-abbrev-table nil | |
56 "Abbrev table in use in Awk-mode buffers.") | |
57 (define-abbrev-table 'awk-mode-abbrev-table ()) | |
58 | |
16451
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
59 ;; Regexps written with help from Peter Galbraith <galbraith@mixing.qc.dfo.ca>. |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
60 (defconst awk-font-lock-keywords |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
61 (eval-when-compile |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
62 (list |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
63 ;; |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
64 ;; Function names. |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
65 '("^[ \t]*\\(function\\)\\>[ \t]*\\(\\sw+\\)?" |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
66 (1 font-lock-keyword-face) (2 font-lock-function-name-face nil t)) |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
67 ;; |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
68 ;; Variable names. |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
69 (cons (concat "\\<\\(" |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
70 ; ("ARGC" "ARGIND" "ARGV" "CONVFMT" "ENVIRON" "ERRNO" |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
71 ; "FIELDWIDTHS" "FILENAME" "FNR" "FS" "IGNORECASE" "NF" "NR" |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
72 ; "OFMT" "OFS" "ORS" "RLENGTH" "RS" "RSTART" "SUBSEP") |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
73 "ARG\\([CV]\\|IND\\)\\|CONVFMT\\|E\\(NVIRON\\|RRNO\\)\\|" |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
74 "F\\(I\\(ELDWIDTHS\\|LENAME\\)\\|NR\\|S\\)\\|IGNORECASE\\|" |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
75 "N[FR]\\|O\\(F\\(MT\\|S\\)\\|RS\\)\\|" |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
76 "R\\(LENGTH\\|S\\(\\|TART\\)\\)\\|SUBSEP" |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
77 "\\)\\>") |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
78 'font-lock-variable-name-face) |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
79 ;; |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
80 ;; Keywords. |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
81 (concat "\\<\\(" |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
82 ; ("BEGIN" "END" "break" "continue" "delete" "exit" "for" |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
83 ; "getline" "if" "next" "print" "printf" "return" "while") |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
84 "BEGIN\\|END\\|break\\|continue\\|delete\\|exit\\|for\\|" |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
85 "getline\\|if\\|next\\|printf?\\|return\\|while" |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
86 "\\)\\>") |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
87 ;; |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
88 ;; Builtins. |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
89 (list (concat "\\<\\(" |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
90 ; ("atan2" "close" "cos" "ctime" "exp" "gsub" "index" "int" |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
91 ; "length" "log" "match" "rand" "sin" "split" "sprintf" |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
92 ; "sqrt" "srand" "sub" "substr" "system" "time" |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
93 ; "tolower" "toupper") |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
94 "atan2\\|c\\(lose\\|os\\|time\\)\\|exp\\|gsub\\|" |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
95 "in\\(dex\\|t\\)\\|l\\(ength\\|og\\)\\|match\\|rand\\|" |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
96 "s\\(in\\|p\\(lit\\|rintf\\)\\|qrt\\|rand\\|" |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
97 "ub\\(\\|str\\)\\|ystem\\)\\|" |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
98 "t\\(ime\\|o\\(lower\\|upper\\)\\)" |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
99 "\\)(") |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
100 1 'font-lock-builtin-face) |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
101 ;; |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
102 ;; Operators. Is this too much? |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
103 (cons (mapconcat 'identity |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
104 '("&&" "||" "<=" "<" ">=" ">" "==" "!=" "!~" "~") |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
105 "\\|") |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
106 'font-lock-reference-face) |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
107 )) |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
108 "Default expressions to highlight in AWK mode.") |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
109 |
257 | 110 ;;;###autoload |
111 (defun awk-mode () | |
112 "Major mode for editing AWK code. | |
113 This is much like C mode except for the syntax of comments. It uses | |
114 the same keymap as C mode and has the same variables for customizing | |
115 indentation. It has its own abbrev table and its own syntax table. | |
116 | |
117 Turning on AWK mode calls the value of the variable `awk-mode-hook' | |
118 with no args, if that value is non-nil." | |
119 (interactive) | |
120 (kill-all-local-variables) | |
19322
cc9e75f82cdb
(awk-mode): Require cc-mode, not cc-langs.
Richard M. Stallman <rms@gnu.org>
parents:
18988
diff
changeset
|
121 (require 'cc-mode) |
18988
35c373c1f925
(awk-mode): Call c-initialize-cc-mode.
Richard M. Stallman <rms@gnu.org>
parents:
18773
diff
changeset
|
122 (c-initialize-cc-mode) |
257 | 123 (use-local-map c-mode-map) |
124 (setq major-mode 'awk-mode) | |
125 (setq mode-name "AWK") | |
126 (setq local-abbrev-table awk-mode-abbrev-table) | |
127 (set-syntax-table awk-mode-syntax-table) | |
128 (make-local-variable 'paragraph-start) | |
10868
276209d90df9
(awk-mode): Remove ^ from paragraph-start & paragraph-separate.
Boris Goldowsky <boris@gnu.org>
parents:
7300
diff
changeset
|
129 (setq paragraph-start (concat "$\\|" page-delimiter)) |
257 | 130 (make-local-variable 'paragraph-separate) |
131 (setq paragraph-separate paragraph-start) | |
132 (make-local-variable 'paragraph-ignore-fill-prefix) | |
133 (setq paragraph-ignore-fill-prefix t) | |
134 (make-local-variable 'indent-line-function) | |
5266
0581b0d428e9
(awk-mode): Use c-indent-line.
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
135 (setq indent-line-function 'c-indent-line) |
257 | 136 (make-local-variable 'require-final-newline) |
137 (setq require-final-newline t) | |
138 (make-local-variable 'comment-start) | |
139 (setq comment-start "# ") | |
140 (make-local-variable 'comment-end) | |
141 (setq comment-end "") | |
142 (make-local-variable 'comment-column) | |
143 (setq comment-column 32) | |
144 (make-local-variable 'comment-start-skip) | |
145 (setq comment-start-skip "#+ *") | |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
146 (make-local-variable 'comment-indent-function) |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
147 (setq comment-indent-function 'c-comment-indent) |
17913
c0e681b163ce
(awk-mode): Set parse-sexp-ignore-comments.
Richard M. Stallman <rms@gnu.org>
parents:
16451
diff
changeset
|
148 (make-local-variable 'parse-sexp-ignore-comments) |
c0e681b163ce
(awk-mode): Set parse-sexp-ignore-comments.
Richard M. Stallman <rms@gnu.org>
parents:
16451
diff
changeset
|
149 (setq parse-sexp-ignore-comments t) |
16451
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
150 (make-local-variable 'font-lock-defaults) |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
151 (setq font-lock-defaults '(awk-font-lock-keywords nil nil ((?_ . "w")))) |
257 | 152 (run-hooks 'awk-mode-hook)) |
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
257
diff
changeset
|
153 |
16451
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
154 (provide 'awk-mode) |
0e181c85b17e
Add Font Lock support. Provide when loaded.
Simon Marshall <simon@gnu.org>
parents:
14169
diff
changeset
|
155 |
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
257
diff
changeset
|
156 ;;; awk-mode.el ends here |