]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/cc-langs.el
Remove function wrongly on AWK Mode value of context fontification hook.
[gnu-emacs] / lisp / progmodes / cc-langs.el
index 0e904d23c5b264766b52b38dc28187d8a20df364..08d84fbb625911ecd5505ab24aab2a2cff4f0d76 100644 (file)
@@ -1,6 +1,6 @@
 ;;; cc-langs.el --- language specific settings for CC Mode -*- coding: utf-8 -*-
 
-;; Copyright (C) 1985, 1987, 1992-2015 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2016 Free Software Foundation, Inc.
 
 ;; Authors:    2002- Alan Mackenzie
 ;;             1998- Martin Stjernholm
@@ -403,7 +403,9 @@ The syntax tables aren't stored directly since they're quite large."
           table)))
 (c-lang-defvar c++-template-syntax-table
   (and (c-lang-const c++-make-template-syntax-table)
-       (funcall (c-lang-const c++-make-template-syntax-table))))
+       ;; The next eval remove a superfluous ' from '(lambda.  This
+       ;; gets rid of compilation warnings.
+       (funcall (eval (c-lang-const c++-make-template-syntax-table)))))
 
 (c-lang-defconst c-make-no-parens-syntax-table
   ;; A variant of the standard syntax table which is used to find matching
@@ -426,7 +428,8 @@ The syntax tables aren't stored directly since they're quite large."
          table))))
 (c-lang-defvar c-no-parens-syntax-table
   (and (c-lang-const c-make-no-parens-syntax-table)
-       (funcall (c-lang-const c-make-no-parens-syntax-table))))
+       ;; See comment in `c++template-syntax-table' about the next `eval'.
+       (funcall (eval (c-lang-const c-make-no-parens-syntax-table)))))
 
 (c-lang-defconst c-identifier-syntax-modifications
   "A list that describes the modifications that should be done to the
@@ -496,8 +499,13 @@ parameters \(point-min) and \(point-max).")
   ;; For documentation see the following c-lang-defvar of the same name.
   ;; The value here may be a list of functions or a single function.
   t 'c-change-expand-fl-region
-  (c c++ objc) '(c-neutralize-syntax-in-and-mark-CPP
-                c-change-expand-fl-region)
+  (c objc) '(c-neutralize-syntax-in-and-mark-CPP
+            c-change-expand-fl-region)
+  c++ '(c-neutralize-syntax-in-and-mark-CPP
+       c-restore-<>-properties
+       c-change-expand-fl-region)
+  java '(c-restore-<>-properties
+        c-change-expand-fl-region)
   awk 'c-awk-extend-and-syntax-tablify-region)
 (c-lang-defvar c-before-font-lock-functions
               (let ((fs (c-lang-const c-before-font-lock-functions)))
@@ -523,8 +531,8 @@ When the mode is initialized, these functions are called with
 parameters \(point-min), \(point-max) and <buffer size>.")
 
 (c-lang-defconst c-before-context-fontification-functions
-  awk nil
-  t 'c-context-expand-fl-region)
+  t 'c-context-expand-fl-region
+  awk nil)
   ;; For documentation see the following c-lang-defvar of the same name.
   ;; The value here may be a list of functions or a single function.
 (c-lang-defvar c-before-context-fontification-functions
@@ -870,7 +878,7 @@ definition, or nil if the language doesn't have any."
   t (if (c-lang-const c-opt-cpp-macro-define)
        (concat (c-lang-const c-opt-cpp-prefix)
                (c-lang-const c-opt-cpp-macro-define)
-               "[ \t]+\\(\\(\\sw\\|_\\)+\\)\\(\([^\)]*\)\\)?"
+               "[ \t]+\\(\\(\\sw\\|_\\)+\\)\\(([^)]*)\\)?"
                ;;       ^                 ^ #defined name
                "\\([ \t]\\|\\\\\n\\)*")))
 (c-lang-defvar c-opt-cpp-macro-define-start
@@ -926,14 +934,14 @@ following elements.  The car of each element describes the type of the
 operator group, and the cdr is a list of the operator tokens in it.
 The operator group types are:
 
-'prefix         Unary prefix operators.
-'postfix        Unary postfix operators.
-'postfix-if-paren
+`prefix'        Unary prefix operators.
+`postfix'       Unary postfix operators.
+`postfix-if-paren'
                Unary postfix operators if and only if the chars have
                parenthesis syntax.
-'left-assoc     Binary left associative operators (i.e. a+b+c means (a+b)+c).
-'right-assoc    Binary right associative operators (i.e. a=b=c means a=(b=c)).
-'right-assoc-sequence
+`left-assoc'    Binary left associative operators (i.e. a+b+c means (a+b)+c).
+`right-assoc'   Binary right associative operators (i.e. a=b=c means a=(b=c)).
+`right-assoc-sequence'
                 Right associative operator that constitutes of a
                 sequence of tokens that separate expressions.  All the
                 tokens in the group are in this case taken as
@@ -1190,7 +1198,7 @@ operators."
   t (c-make-keywords-re nil
       (c-filter-ops (c-lang-const c-all-op-syntax-tokens)
                    t
-                   "\\`\\(\\s.\\|\\s\(\\|\\s\)\\)+\\'")))
+                   "\\`\\(\\s.\\)+\\'")))
 (c-lang-defvar c-nonsymbol-token-regexp
   (c-lang-const c-nonsymbol-token-regexp))
 
@@ -1430,6 +1438,14 @@ properly."
            "\\)\\s *"))
 (c-lang-setvar comment-start-skip (c-lang-const comment-start-skip))
 
+(c-lang-defconst comment-end-can-be-escaped
+  "When non-nil, escaped EOLs inside comments are valid.
+This works in Emacs >= 25.1."
+  t nil
+  (c c++ objc) t)
+(c-lang-setvar comment-end-can-be-escaped
+              (c-lang-const comment-end-can-be-escaped))
+
 (c-lang-defconst c-syntactic-ws-start
   ;; Regexp matching any sequence that can start syntactic whitespace.
   ;; The only uncertain case is '#' when there are cpp directives.
@@ -1694,7 +1710,7 @@ be a subset of `c-primitive-type-kwds'."
            "strong"))
 
 (c-lang-defconst c-typedef-kwds
-  "Prefix keyword\(s\) like \"typedef\" which make a type declaration out
+  "Prefix keyword(s) like \"typedef\" which make a type declaration out
 of a variable declaration."
   t        '("typedef")
   (awk idl java) nil)
@@ -2202,7 +2218,7 @@ regexp if `c-colon-type-list-kwds' isn't nil."
        ;; before the ":" that starts the inherit list after "class"
        ;; or "struct" in C++.  (Also used as default for other
        ;; languages.)
-       "[^\]\[{}();,/#=:]*:"))
+       "[^][{}();,/#=:]*:"))
 (c-lang-defvar c-colon-type-list-re (c-lang-const c-colon-type-list-re))
 
 (c-lang-defconst c-paren-nontype-kwds
@@ -2366,7 +2382,7 @@ nevertheless contains a list separated with `;' and not `,'."
 (c-lang-defvar c-opt-asm-stmt-key (c-lang-const c-opt-asm-stmt-key))
 
 (c-lang-defconst c-case-kwds
-  "The keyword\(s) which introduce a \"case\" like construct.
+  "The keyword(s) which introduce a \"case\" like construct.
 This construct is \"<keyword> <expression> :\"."
   t '("case")
   awk nil)
@@ -2729,25 +2745,25 @@ more info."
   ;; more quickly.  We match ")" in C for K&R region declarations, and
   ;; in all languages except Java for when a cpp macro definition
   ;; begins with a declaration.
-  t "\\([\{\}\(\);,]+\\)"
-  java "\\([\{\}\(;,<]+\\)"
+  t "\\([{}();,]+\\)"
+  java "\\([{}(;,<]+\\)"
   ;; Match "<" in C++ to get the first argument in a template arglist.
   ;; In that case there's an additional check in `c-find-decl-spots'
   ;; that it got open paren syntax.  Match ":" to aid in picking up
   ;; "public:", etc.  This involves additional checks in
   ;; `c-find-decl-prefix-search' to prevent a match of identifiers
   ;; or labels.
-  c++ "\\([\{\}\(\);:,<]+\\)"
+  c++ "\\([{}();:,<]+\\)"
   ;; Additionally match the protection directives in Objective-C.
   ;; Note that this doesn't cope with the longer directives, which we
   ;; would have to match from start to end since they don't end with
   ;; any easily recognized characters.
-  objc (concat "\\([\{\}\(\);,]+\\|"
+  objc (concat "\\([{}();,]+\\|"
               (c-make-keywords-re nil (c-lang-const c-protection-kwds))
               "\\)")
   ;; Pike is like C but we also match "[" for multiple value
   ;; assignments and type casts.
-  pike "\\([\{\}\(\)\[;,]+\\)")
+  pike "\\([{}()[;,]+\\)")
 (c-lang-defvar c-decl-prefix-re (c-lang-const c-decl-prefix-re)
   'dont-doc)
 
@@ -2792,7 +2808,7 @@ constructs."
   ;; languages without casts.
   t (c-filter-ops (c-lang-const c-operators)
                  '(prefix)
-                 "\\`\\s\(\\'"
+                 "\\`\\s(\\'"
                  (lambda (op) (elt op 0))))
 (c-lang-defvar c-cast-parens (c-lang-const c-cast-parens))
 
@@ -2875,13 +2891,13 @@ Identifier syntax is in effect when this is matched \(see
   ;; Check that there's no "=" afterwards to avoid matching tokens
   ;; like "*=".
   (c objc) (concat "\\("
-                  "[*\(]"
+                  "[*(]"
                   "\\|"
                   (c-lang-const c-type-decl-prefix-key)
                   "\\)"
                   "\\([^=]\\|$\\)")
   c++  (concat "\\("
-              "[*\(&]"
+              "[*(&]"
               "\\|"
               (c-lang-const c-type-decl-prefix-key)
               "\\|"
@@ -2909,13 +2925,13 @@ is in effect when this is matched (see `c-identifier-syntax-table')."
   ;; Default to a regexp that matches `c-type-modifier-kwds' and a
   ;; function argument list parenthesis.
   t    (if (c-lang-const c-type-modifier-kwds)
-          (concat "\\(\(\\|"
+          (concat "\\((\\|"
                   (regexp-opt (c-lang-const c-type-modifier-kwds) t) "\\>"
                   "\\)")
-        "\\(\(\\)")
+        "\\((\\)")
   (c c++ objc) (concat
                "\\("
-               "[\)\[\(]"
+               "[)[(]"
                (if (c-lang-const c-type-modifier-kwds)
                    (concat
                     "\\|"
@@ -2926,8 +2942,8 @@ is in effect when this is matched (see `c-identifier-syntax-table')."
                     "\\>")
                  "")
                "\\)")
-  java "\\([\[\(\)]\\)"
-  idl "\\([\[\(]\\)")
+  java "\\([[()]\\)"
+  idl "\\([[(]\\)")
 (c-lang-defvar c-type-decl-suffix-key (c-lang-const c-type-decl-suffix-key)
   'dont-doc)
 
@@ -3111,7 +3127,7 @@ i.e. compound statements surrounded by parentheses inside expressions."
   t (if (c-lang-const c-opt-<>-arglist-start)
        (concat "\\("
                (c-lang-const c-opt-<>-arglist-start)
-               "\\)\\|\\s\)")))
+               "\\)\\|\\s)")))
 (c-lang-defvar c-opt-<>-arglist-start-in-paren
   (c-lang-const c-opt-<>-arglist-start-in-paren))
 
@@ -3168,7 +3184,7 @@ i.e. before \":\".  Only used if `c-recognize-colon-labels' is set."
   ;; 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
@@ -3216,7 +3232,7 @@ way."
        "\\([+-]\\)"
        (c-lang-const c-simple-ws) "*"
        (concat "\\("                   ; Return type.
-               "([^\)]*)"
+               "([^)]*)"
                (c-lang-const c-simple-ws) "*"
                "\\)?")
        "\\(" (c-lang-const c-symbol-key) "\\)"))
@@ -3304,10 +3320,9 @@ accomplish that conveniently."
                 (setq source-eval t)
                 (let ((init ',(append (cdr c-emacs-variable-inits)
                                       (cdr c-lang-variable-inits))))
-                  (while init
-                    (setq current-var (caar init))
-                    (set (caar init) (eval (cadar init)))
-                    (setq init (cdr init)))))
+                  (dolist (var-init init)
+                    (setq current-var (car var-init))
+                    (set (car var-init) (eval (cadr var-init))))))
 
             (error
              (if current-var
@@ -3333,10 +3348,9 @@ accomplish that conveniently."
         (c-make-emacs-variables-local)
         (condition-case err
 
-            (while init
-              (setq current-var (caar init))
-              (set (caar init) (eval (cadar init)))
-              (setq init (cdr init)))
+            (dolist (var-init init)
+              (setq current-var (car var-init))
+              (set (car var-init) (eval (cadr var-init))))
 
           (error
            (if current-var