emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r106675: Add the switch statement to


From: Alan Mackenzie
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106675: Add the switch statement to AWK Mode.
Date: Tue, 13 Dec 2011 21:13:51 +0000
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106675
committer: Alan Mackenzie <address@hidden>
branch nick: trunk
timestamp: Tue 2011-12-13 21:13:51 +0000
message:
  Add the switch statement to AWK Mode.
modified:
  lisp/ChangeLog
  lisp/progmodes/cc-awk.el
  lisp/progmodes/cc-langs.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-12-13 18:47:08 +0000
+++ b/lisp/ChangeLog    2011-12-13 21:13:51 +0000
@@ -1,5 +1,15 @@
 2011-12-13  Alan Mackenzie  <address@hidden>
 
+       Add the switch statement to AWK Mode.
+
+       * progmodes/cc-awk (awk-font-lock-keywords): Add "switch", "case",
+       "default" to the keywords regexp.
+
+       * progmodes/cc-langs (c-label-kwds): Let AWK take the same
+       expression as the rest.
+       (c-nonlabel-token-key): Allow string literals for AWK.  Refactor
+       for the other modes.
+
        Large brace-block initialisation makes CC Mode slow: Fix.
        Tidy up and accelerate c-in-literal, etc. by using the
        c-parse-state

=== modified file 'lisp/progmodes/cc-awk.el'
--- a/lisp/progmodes/cc-awk.el  2011-12-12 05:32:49 +0000
+++ b/lisp/progmodes/cc-awk.el  2011-12-13 21:13:51 +0000
@@ -894,9 +894,9 @@
      ;; Keywords.
      (concat "\\<"
             (regexp-opt
-             '("BEGIN" "END" "break" "continue" "delete" "do" "else"
-               "exit" "for" "getline" "if" "in" "next" "nextfile"
-               "return" "while")
+             '("BEGIN" "END" "break" "case" "continue" "default" "delete"
+               "do" "else" "exit" "for" "getline" "if" "in" "next"
+               "nextfile" "return" "switch" "while")
              t) "\\>")
 
      ;; Builtins.

=== modified file 'lisp/progmodes/cc-langs.el'
--- a/lisp/progmodes/cc-langs.el        2011-12-12 05:32:49 +0000
+++ b/lisp/progmodes/cc-langs.el        2011-12-13 21:13:51 +0000
@@ -2242,8 +2242,7 @@
 
 (c-lang-defconst c-label-kwds
   "Keywords introducing colon terminated labels in blocks."
-  t '("case" "default")
-  awk nil)
+  t '("case" "default"))
 
 (c-lang-defconst c-label-kwds-regexp
   ;; Adorned regexp matching any keyword that introduces a label.
@@ -2998,18 +2997,19 @@
 tested at the beginning of every sexp in a suspected label,
 i.e. before \":\".  Only used if `c-recognize-colon-labels' is set."
   t (concat
-     ;; Don't allow string literals.
-     "\"\\|"
      ;; All keywords except `c-label-kwds' and `c-protection-kwds'.
      (c-make-keywords-re t
        (set-difference (c-lang-const c-keywords)
                       (append (c-lang-const c-label-kwds)
                               (c-lang-const c-protection-kwds))
                       :test 'string-equal)))
+  ;; Don't allow string literals, except in AWK.  Character constants are OK.
+  (c objc java pike idl) (concat "\"\\|"
+                                (c-lang-const c-nonlabel-token-key))
   ;; Also check for open parens in C++, to catch member init lists in
   ;; constructors.  We normally allow it so that macros with arguments
   ;; work in labels.
-  c++ (concat "\\s\(\\|" (c-lang-const c-nonlabel-token-key)))
+  c++ (concat "\\s\(\\|\"\\|" (c-lang-const c-nonlabel-token-key)))
 (c-lang-defvar c-nonlabel-token-key (c-lang-const c-nonlabel-token-key))
 
 (c-lang-defconst c-nonlabel-token-2-key


reply via email to

[Prev in Thread] Current Thread [Next in Thread]