(defun c-populate-syntax-table (table)
"Populate the given syntax table as necessary for a C-like language.
-This includes setting ' and \" as string delimiters, and setting up
+This includes setting \\=' and \" as string delimiters, and setting up
the comment syntax to handle both line style \"//\" and block style
\"/*\" \"*/\" comments."
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
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
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
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
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))
"\\)\\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.
"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)
;; 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
(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)
;; 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)
;; 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))
;; 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)
"\\|"
;; 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
"\\|"
"\\>")
"")
"\\)")
- java "\\([\[\(\)]\\)"
- idl "\\([\[\(]\\)")
+ java "\\([[()]\\)"
+ idl "\\([[(]\\)")
(c-lang-defvar c-type-decl-suffix-key (c-lang-const c-type-decl-suffix-key)
'dont-doc)
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))
;; 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
"\\([+-]\\)"
(c-lang-const c-simple-ws) "*"
(concat "\\(" ; Return type.
- "([^\)]*)"
+ "([^)]*)"
(c-lang-const c-simple-ws) "*"
"\\)?")
"\\(" (c-lang-const c-symbol-key) "\\)"))
(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
(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