[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r113568: Make Java try-with-resources statement pars
From: |
Alan Mackenzie |
Subject: |
[Emacs-diffs] trunk r113568: Make Java try-with-resources statement parse properly. |
Date: |
Sat, 27 Jul 2013 12:10:08 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 113568
revision-id: address@hidden
parent: address@hidden
committer: Alan Mackenzie <address@hidden>
branch nick: trunk
timestamp: Sat 2013-07-27 12:07:43 +0000
message:
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.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/progmodes/cc-engine.el
ccengine.el-20091113204419-o5vbwnq5f7feedwu-1227
lisp/progmodes/cc-fonts.el ccfonts.el-20091113204419-o5vbwnq5f7feedwu-2930
lisp/progmodes/cc-langs.el cclangs.el-20091113204419-o5vbwnq5f7feedwu-1228
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-07-27 01:02:00 +0000
+++ b/lisp/ChangeLog 2013-07-27 12:07:43 +0000
@@ -1,3 +1,13 @@
+2013-07-27 Alan Mackenzie <address@hidden>
+
+ 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-stmet-1-2-key.
+
2013-07-27 Juanma Barranquero <address@hidden>
* desktop.el (desktop--make-frame): Apply most frame parameters after
=== modified file 'lisp/progmodes/cc-engine.el'
--- a/lisp/progmodes/cc-engine.el 2013-07-14 05:18:48 +0000
+++ b/lisp/progmodes/cc-engine.el 2013-07-27 12:07:43 +0000
@@ -1135,9 +1135,13 @@
(not (memq sym '(boundary ignore nil))))
;; Need to investigate closer whether we've crossed
;; between a substatement and its containing statement.
- (if (setq saved (if (looking-at c-block-stmt-1-key)
- ptok
- pptok))
+ (if (setq saved
+ (cond ((and (looking-at c-block-stmt-1-2-key)
+ (eq (char-after ptok) ?\())
+ pptok)
+ ((looking-at c-block-stmt-1-key)
+ ptok)
+ (t pptok)))
(cond ((> start saved) (setq pos saved))
((= start saved) (setq ret 'up)))))
@@ -7988,7 +7992,8 @@
(or (looking-at c-block-stmt-1-key)
(and (eq (char-after) ?\()
(zerop (c-backward-token-2 1 t lim))
- (looking-at c-block-stmt-2-key)))
+ (or (looking-at c-block-stmt-2-key)
+ (looking-at c-block-stmt-1-2-key))))
(point))))
(defun c-after-special-operator-id (&optional lim)
=== modified file 'lisp/progmodes/cc-fonts.el'
--- a/lisp/progmodes/cc-fonts.el 2013-06-01 18:19:29 +0000
+++ b/lisp/progmodes/cc-fonts.el 2013-07-27 12:07:43 +0000
@@ -1307,7 +1307,8 @@
(goto-char match-pos)
(backward-char)
(c-backward-token-2)
- (looking-at c-block-stmt-2-key)))
+ (or (looking-at c-block-stmt-2-key)
+ (looking-at c-block-stmt-1-2-key))))
(setq context nil
c-restricted-<>-arglists t))
;; Near BOB.
=== modified file 'lisp/progmodes/cc-langs.el'
--- a/lisp/progmodes/cc-langs.el 2013-04-15 16:10:24 +0000
+++ b/lisp/progmodes/cc-langs.el 2013-07-27 12:07:43 +0000
@@ -2187,6 +2187,18 @@
t (c-make-keywords-re t (c-lang-const c-block-stmt-1-kwds)))
(c-lang-defvar c-block-stmt-1-key (c-lang-const c-block-stmt-1-key))
+(c-lang-defconst c-block-stmt-1-2-kwds
+ "Statement keywords optionally followed by a paren sexp.
+Keywords here should also be in `c-block-stmt-1-kwds'."
+ t nil
+ java '("try"))
+
+(c-lang-defconst c-block-stmt-1-2-key
+ ;; Regexp matching the start of a statement which may be followed by a
+ ;; paren sexp and will then be followed by a substatement.
+ t (c-make-keywords-re t (c-lang-const c-block-stmt-1-2-kwds)))
+(c-lang-defvar c-block-stmt-1-2-key (c-lang-const c-block-stmt-1-2-key))
+
(c-lang-defconst c-block-stmt-2-kwds
"Statement keywords followed by a paren sexp and then by a substatement."
t '("for" "if" "switch" "while")
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r113568: Make Java try-with-resources statement parse properly.,
Alan Mackenzie <=