From e371503373b87716827e2ed0f3ba5b2d89981ef4 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Sat, 20 Aug 2011 22:02:25 +0000 Subject: [PATCH] Resolve invalid use of a regexp in regexp-opt. cc-fonts.el (c-complex-decl-matchers): Add in special detection for a java annotation. cc-engine.el (c-forward-decl-or-cast-1): Add in special detection for a java annotation. cc-langs.el (c-prefix-spec-kwds-re): Remove the special handling for java. (c-modifier-kwds): Remove the regexp "@[A-za-z0-9]+". --- lisp/ChangeLog | 14 ++++++++++++++ lisp/progmodes/cc-engine.el | 4 +++- lisp/progmodes/cc-fonts.el | 4 +++- lisp/progmodes/cc-langs.el | 7 ++----- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cab26924041..efacb110d1b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,17 @@ +2011-08-20 Alan Mackenzie + + Resolve invalid use of a regexp in regexp-opt. + + * cc-fonts.el (c-complex-decl-matchers): Add in special detection + for a java annotation. + + * cc-engine.el (c-forward-decl-or-cast-1): Add in special + detection for a java annotation. + + * cc-langs.el (c-prefix-spec-kwds-re): Remove the special handling + for java. + (c-modifier-kwds): Remove the regexp "@[A-za-z0-9]+". + 2011-08-20 Chong Yidong * startup.el (normal-top-level-add-subdirs-to-load-path): Doc fix diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 0d88f85d263..a1cbdc16560 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -6325,7 +6325,9 @@ comment at the start of cc-engine.el for more info." (let* ((start (point)) kwd-sym kwd-clause-end found-type) ;; Look for a specifier keyword clause. - (when (looking-at c-prefix-spec-kwds-re) + (when (or (looking-at c-prefix-spec-kwds-re) + (and (c-major-mode-is 'java-mode) + (looking-at "@[A-Za-z0-9]+"))) (if (looking-at c-typedef-key) (setq at-typedef t)) (setq kwd-sym (c-keyword-sym (match-string 1))) diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index dea205221c9..3d5dc30d823 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -1666,7 +1666,9 @@ on level 2 only and so aren't combined with `c-complex-decl-matchers'." (unless (c-skip-comments-and-strings limit) (c-forward-syntactic-ws) ;; Handle prefix declaration specifiers. - (when (looking-at c-prefix-spec-kwds-re) + (when (or (looking-at c-prefix-spec-kwds-re) + (and (c-major-mode-is 'java-mode) + (looking-at "@[A-Za-z0-9]+"))) (c-forward-keyword-clause 1)) ,(if (c-major-mode-is 'c++-mode) `(when (and (c-forward-type) diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 153ef0880c7..279c5e46c46 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -1823,7 +1823,7 @@ will be handled." "bindsTo" "delegatesTo" "implements" "proxy" "storedOn") ;; Note: "const" is not used in Java, but it's still a reserved keyword. java '("abstract" "const" "final" "native" "private" "protected" "public" - "static" "strictfp" "synchronized" "transient" "volatile" "@[A-Za-z0-9]+") + "static" "strictfp" "synchronized" "transient" "volatile") pike '("final" "inline" "local" "nomask" "optional" "private" "protected" "public" "static" "variant")) @@ -1909,10 +1909,7 @@ one of `c-type-list-kwds', `c-ref-list-kwds', (c-lang-defconst c-prefix-spec-kwds-re ;; Adorned regexp of `c-prefix-spec-kwds'. - t (c-make-keywords-re t (c-lang-const c-prefix-spec-kwds)) - java (replace-regexp-in-string - "\\\\\\[" "[" - (replace-regexp-in-string "\\\\\\+" "+" (c-make-keywords-re t (c-lang-const c-prefix-spec-kwds))))) + t (c-make-keywords-re t (c-lang-const c-prefix-spec-kwds))) (c-lang-defvar c-prefix-spec-kwds-re (c-lang-const c-prefix-spec-kwds-re)) -- 2.39.2