diff options
| author | Alan Mackenzie | 2011-12-13 21:13:51 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2011-12-13 21:13:51 +0000 |
| commit | 898169a2d88c3538cdfd41feb0b16267165065bd (patch) | |
| tree | cb1baea0c5c1232e07d49bbe54d0a4a333f19c4c | |
| parent | 13d49cbb266f0ead789944508ad0872129885609 (diff) | |
| download | emacs-898169a2d88c3538cdfd41feb0b16267165065bd.tar.gz emacs-898169a2d88c3538cdfd41feb0b16267165065bd.zip | |
Add the switch statement to AWK Mode.
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/progmodes/cc-awk.el | 6 | ||||
| -rw-r--r-- | lisp/progmodes/cc-langs.el | 10 |
3 files changed, 18 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f338462b2be..cf042ec6c82 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,15 @@ | |||
| 1 | 2011-12-13 Alan Mackenzie <acm@muc.de> | 1 | 2011-12-13 Alan Mackenzie <acm@muc.de> |
| 2 | 2 | ||
| 3 | Add the switch statement to AWK Mode. | ||
| 4 | |||
| 5 | * progmodes/cc-awk (awk-font-lock-keywords): Add "switch", "case", | ||
| 6 | "default" to the keywords regexp. | ||
| 7 | |||
| 8 | * progmodes/cc-langs (c-label-kwds): Let AWK take the same | ||
| 9 | expression as the rest. | ||
| 10 | (c-nonlabel-token-key): Allow string literals for AWK. Refactor | ||
| 11 | for the other modes. | ||
| 12 | |||
| 3 | Large brace-block initialisation makes CC Mode slow: Fix. | 13 | Large brace-block initialisation makes CC Mode slow: Fix. |
| 4 | Tidy up and accelerate c-in-literal, etc. by using the | 14 | Tidy up and accelerate c-in-literal, etc. by using the |
| 5 | c-parse-state | 15 | c-parse-state |
diff --git a/lisp/progmodes/cc-awk.el b/lisp/progmodes/cc-awk.el index f44b34ac351..ef67a18d807 100644 --- a/lisp/progmodes/cc-awk.el +++ b/lisp/progmodes/cc-awk.el | |||
| @@ -894,9 +894,9 @@ std\\(err\\|in\\|out\\)\\|user\\)\\)\\>\ | |||
| 894 | ;; Keywords. | 894 | ;; Keywords. |
| 895 | (concat "\\<" | 895 | (concat "\\<" |
| 896 | (regexp-opt | 896 | (regexp-opt |
| 897 | '("BEGIN" "END" "break" "continue" "delete" "do" "else" | 897 | '("BEGIN" "END" "break" "case" "continue" "default" "delete" |
| 898 | "exit" "for" "getline" "if" "in" "next" "nextfile" | 898 | "do" "else" "exit" "for" "getline" "if" "in" "next" |
| 899 | "return" "while") | 899 | "nextfile" "return" "switch" "while") |
| 900 | t) "\\>") | 900 | t) "\\>") |
| 901 | 901 | ||
| 902 | ;; Builtins. | 902 | ;; Builtins. |
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 0bfca84cd96..96f0887eec0 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el | |||
| @@ -2242,8 +2242,7 @@ This construct is \"<keyword> <expression> :\"." | |||
| 2242 | 2242 | ||
| 2243 | (c-lang-defconst c-label-kwds | 2243 | (c-lang-defconst c-label-kwds |
| 2244 | "Keywords introducing colon terminated labels in blocks." | 2244 | "Keywords introducing colon terminated labels in blocks." |
| 2245 | t '("case" "default") | 2245 | t '("case" "default")) |
| 2246 | awk nil) | ||
| 2247 | 2246 | ||
| 2248 | (c-lang-defconst c-label-kwds-regexp | 2247 | (c-lang-defconst c-label-kwds-regexp |
| 2249 | ;; Adorned regexp matching any keyword that introduces a label. | 2248 | ;; Adorned regexp matching any keyword that introduces a label. |
| @@ -2998,18 +2997,19 @@ neither in a statement nor in a declaration context. The regexp is | |||
| 2998 | tested at the beginning of every sexp in a suspected label, | 2997 | tested at the beginning of every sexp in a suspected label, |
| 2999 | i.e. before \":\". Only used if `c-recognize-colon-labels' is set." | 2998 | i.e. before \":\". Only used if `c-recognize-colon-labels' is set." |
| 3000 | t (concat | 2999 | t (concat |
| 3001 | ;; Don't allow string literals. | ||
| 3002 | "\"\\|" | ||
| 3003 | ;; All keywords except `c-label-kwds' and `c-protection-kwds'. | 3000 | ;; All keywords except `c-label-kwds' and `c-protection-kwds'. |
| 3004 | (c-make-keywords-re t | 3001 | (c-make-keywords-re t |
| 3005 | (set-difference (c-lang-const c-keywords) | 3002 | (set-difference (c-lang-const c-keywords) |
| 3006 | (append (c-lang-const c-label-kwds) | 3003 | (append (c-lang-const c-label-kwds) |
| 3007 | (c-lang-const c-protection-kwds)) | 3004 | (c-lang-const c-protection-kwds)) |
| 3008 | :test 'string-equal))) | 3005 | :test 'string-equal))) |
| 3006 | ;; Don't allow string literals, except in AWK. Character constants are OK. | ||
| 3007 | (c objc java pike idl) (concat "\"\\|" | ||
| 3008 | (c-lang-const c-nonlabel-token-key)) | ||
| 3009 | ;; Also check for open parens in C++, to catch member init lists in | 3009 | ;; Also check for open parens in C++, to catch member init lists in |
| 3010 | ;; constructors. We normally allow it so that macros with arguments | 3010 | ;; constructors. We normally allow it so that macros with arguments |
| 3011 | ;; work in labels. | 3011 | ;; work in labels. |
| 3012 | c++ (concat "\\s\(\\|" (c-lang-const c-nonlabel-token-key))) | 3012 | c++ (concat "\\s\(\\|\"\\|" (c-lang-const c-nonlabel-token-key))) |
| 3013 | (c-lang-defvar c-nonlabel-token-key (c-lang-const c-nonlabel-token-key)) | 3013 | (c-lang-defvar c-nonlabel-token-key (c-lang-const c-nonlabel-token-key)) |
| 3014 | 3014 | ||
| 3015 | (c-lang-defconst c-nonlabel-token-2-key | 3015 | (c-lang-defconst c-nonlabel-token-2-key |