aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2013-07-27 12:07:43 +0000
committerAlan Mackenzie2013-07-27 12:07:43 +0000
commit5ab78d3d6a7efcb49d2a9be5b4bdb8eaf78f7a14 (patch)
treed6c40344fb4e36d8bf069b624df9aa0087679e4a
parent9dabd86d4b2af464a25148321bebeadf6a8e53f3 (diff)
downloademacs-5ab78d3d6a7efcb49d2a9be5b4bdb8eaf78f7a14.tar.gz
emacs-5ab78d3d6a7efcb49d2a9be5b4bdb8eaf78f7a14.zip
Make Java try-with-resources statement parse properly.
progmodes/cc-langs.el (c-block-stmt-1-2-kwds, c-block-stmt-1-2-key): New language constants/variables. progmodes/cc-engine.el (c-beginning-of-statement-1, c-after-conditional): Adapt to deal with c-block-stmt-1-2-key. progmodes/cc-fonts.el (c-font-lock-declarations): Adapt to deal with c-block-stmt-1-2-key.
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/progmodes/cc-engine.el13
-rw-r--r--lisp/progmodes/cc-fonts.el3
-rw-r--r--lisp/progmodes/cc-langs.el12
4 files changed, 33 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 42ad403583b..e74c4ffe486 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12013-07-27 Alan Mackenzie <acm@muc.de>
2
3 Make Java try-with-resources statement parse properly.
4 * progmodes/cc-langs.el (c-block-stmt-1-2-kwds)
5 (c-block-stmt-1-2-key): New language constants/variables.
6 * progmodes/cc-engine.el (c-beginning-of-statement-1)
7 (c-after-conditional): Adapt to deal with c-block-stmt-1-2-key.
8 * progmodes/cc-fonts.el (c-font-lock-declarations): Adapt to deal
9 with c-block-stmet-1-2-key.
10
12013-07-27 Juanma Barranquero <lekktu@gmail.com> 112013-07-27 Juanma Barranquero <lekktu@gmail.com>
2 12
3 * desktop.el (desktop--make-frame): Apply most frame parameters after 13 * desktop.el (desktop--make-frame): Apply most frame parameters after
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index a3bd000a4f3..c2ff5011a0e 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -1135,9 +1135,13 @@ comment at the start of cc-engine.el for more info."
1135 (not (memq sym '(boundary ignore nil)))) 1135 (not (memq sym '(boundary ignore nil))))
1136 ;; Need to investigate closer whether we've crossed 1136 ;; Need to investigate closer whether we've crossed
1137 ;; between a substatement and its containing statement. 1137 ;; between a substatement and its containing statement.
1138 (if (setq saved (if (looking-at c-block-stmt-1-key) 1138 (if (setq saved
1139 ptok 1139 (cond ((and (looking-at c-block-stmt-1-2-key)
1140 pptok)) 1140 (eq (char-after ptok) ?\())
1141 pptok)
1142 ((looking-at c-block-stmt-1-key)
1143 ptok)
1144 (t pptok)))
1141 (cond ((> start saved) (setq pos saved)) 1145 (cond ((> start saved) (setq pos saved))
1142 ((= start saved) (setq ret 'up))))) 1146 ((= start saved) (setq ret 'up)))))
1143 1147
@@ -7988,7 +7992,8 @@ comment at the start of cc-engine.el for more info."
7988 (or (looking-at c-block-stmt-1-key) 7992 (or (looking-at c-block-stmt-1-key)
7989 (and (eq (char-after) ?\() 7993 (and (eq (char-after) ?\()
7990 (zerop (c-backward-token-2 1 t lim)) 7994 (zerop (c-backward-token-2 1 t lim))
7991 (looking-at c-block-stmt-2-key))) 7995 (or (looking-at c-block-stmt-2-key)
7996 (looking-at c-block-stmt-1-2-key))))
7992 (point)))) 7997 (point))))
7993 7998
7994(defun c-after-special-operator-id (&optional lim) 7999(defun c-after-special-operator-id (&optional lim)
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index 6a4bfd9e875..4e8ce6bac28 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -1307,7 +1307,8 @@ casts and declarations are fontified. Used on level 2 and higher."
1307 (goto-char match-pos) 1307 (goto-char match-pos)
1308 (backward-char) 1308 (backward-char)
1309 (c-backward-token-2) 1309 (c-backward-token-2)
1310 (looking-at c-block-stmt-2-key))) 1310 (or (looking-at c-block-stmt-2-key)
1311 (looking-at c-block-stmt-1-2-key))))
1311 (setq context nil 1312 (setq context nil
1312 c-restricted-<>-arglists t)) 1313 c-restricted-<>-arglists t))
1313 ;; Near BOB. 1314 ;; Near BOB.
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index af52ad53aad..4e488344e16 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -2187,6 +2187,18 @@ identifiers that follows the type in a normal declaration."
2187 t (c-make-keywords-re t (c-lang-const c-block-stmt-1-kwds))) 2187 t (c-make-keywords-re t (c-lang-const c-block-stmt-1-kwds)))
2188(c-lang-defvar c-block-stmt-1-key (c-lang-const c-block-stmt-1-key)) 2188(c-lang-defvar c-block-stmt-1-key (c-lang-const c-block-stmt-1-key))
2189 2189
2190(c-lang-defconst c-block-stmt-1-2-kwds
2191 "Statement keywords optionally followed by a paren sexp.
2192Keywords here should also be in `c-block-stmt-1-kwds'."
2193 t nil
2194 java '("try"))
2195
2196(c-lang-defconst c-block-stmt-1-2-key
2197 ;; Regexp matching the start of a statement which may be followed by a
2198 ;; paren sexp and will then be followed by a substatement.
2199 t (c-make-keywords-re t (c-lang-const c-block-stmt-1-2-kwds)))
2200(c-lang-defvar c-block-stmt-1-2-key (c-lang-const c-block-stmt-1-2-key))
2201
2190(c-lang-defconst c-block-stmt-2-kwds 2202(c-lang-defconst c-block-stmt-2-kwds
2191 "Statement keywords followed by a paren sexp and then by a substatement." 2203 "Statement keywords followed by a paren sexp and then by a substatement."
2192 t '("for" "if" "switch" "while") 2204 t '("for" "if" "switch" "while")