Commit graph

434 commits

Author SHA1 Message Date
Paul Eggert
91af3942e9 Spelling fixes. 2011-11-14 15:59:56 -08:00
Alan Mackenzie
93b5b3bdc8 Boring merge from savannah. 2011-10-28 14:35:39 +00:00
Alan Mackenzie
020716e178 DTRT for c-beginning/end-of-defun in nested declaration scopes. 2011-10-28 14:34:39 +00:00
Alan Mackenzie
536610a433 Amend to indent and fontify macros "which include their own semicolon"
correctly, using the "virtual semicolon" mechanism.

cc-defs.el: Update "virtual semicolon" comments.

cc-engine.el (c-crosses-statement-barrier-p): Recoded to scan one line at
at time rather than having \n and \r explicitly in c-stmt-delim-chars
(for some modes, e.g. AWK).
(c-forward-label): Amend for virtual semicolons.
(c-at-macro-vsemi-p, c-macro-vsemi-status-unknown-p): New functions

cc-fonts.el (c-font-lock-declarations): Take account of the new C macros.

cc-langs.el (c-at-vsemi-p-fn, c-vsemi-status-unknown-p-fn): move to
earlier in the file.
(c-opt-cpp-symbol, c-line-comment-start-regexp): New language variables.
(c-opt-cpp-macro-define): Make into a full language variable.
(c-stmt-delim-chars, c-stmt-delim-chars-with-comma): Special value for
AWK Mode (including \n, \r) removed, no longer needed.

cc-mode.el (c-mode, c++-mode, objc-mode): Invoke
c-make-macro-with-semi-re.

cc-vars.el (c-macro-with-semi-re, c-macro-names-with-semicolon): New
variables.
(c-make-macro-with-semi-re): New function

cc-mode.texi (Indentation Commands): Mention "macros with semicolons".
(Other Special Indentations): Add an xref to "Macros with ;".
(Customizing Macros): Add stuff about syntax in macros.  Add an xref to
"Macros with ;".
(Macros with ;): New page.
2011-10-27 20:34:23 +00:00
Alan Mackenzie
cd5495ffba Fix bug #9560, sporadic wrong indentation; improve instrumentation of
c-parse-state.
cc-engine.el (c-append-lower-brace-pair-to-state-cache): correct faulty
logical expression.

(c-parse-state-state, c-record-parse-state-state):
(c-replay-parse-state-state): New defvar/defuns.
(c-debug-parse-state): Use new functions.
2011-10-22 10:17:25 +00:00
Alan Mackenzie
e371503373 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 22:02:25 +00:00
Alan Mackenzie
9c4aeabf55 progmodes/cc-engine.el (c-state-cache-non-literal-place): Correct to
avoid the insides of macros.
2011-08-16 20:10:40 +00:00
Alan Mackenzie
b248a85d10 Fontify bitfield declarations properly.
cc-langs.el (c-has-bitfields): New lang variable.
(c-symbol-chars): Now exported as a lang variable.
(c-not-primitive-type-keywords): New lang variable.

cc-fonts.el (c-font-lock-declarations): Jump over the QT keyword "more"
to prevent "more slots: ...." being spuriously parsed as a bitfield
declaraion.

cc-engine.el (c-beginning-of-statement-1): Refactor and enhance to handle
bitfield declarations.
(c-punctuation-in): New function.
(c-forward-decl-or-cast-1): Enhance CASE 3 to handle bitfield
declarations properly.
2011-07-26 19:18:40 +00:00
Alan Mackenzie
bf2c1571f4 CC Mode: Fontify declarators properly when, e.g., a jit-lock chunk begins
inside a declaration.  Changed cc-engine.el, cc-langs.el, cc-fonts.el.
2011-07-18 17:15:24 +00:00
Alan Mackenzie
e6597158c0 progmodes/cc-engine.el (c-guess-continued-construct): Correct the
handling of template-args-cont, particularly for when font lock is
disabled.  Name this case as "CASE G".
2011-06-30 15:12:59 +00:00
Daniel Colascione
05842630f9 * progmodes/cc-engine.el (c-forward-decl-or-cast-1): Use
correct match group (bug#8438).
2011-04-24 17:31:41 -07:00
Alan Mackenzie
804a116c9d (c-guess-basic-syntax): Move CASE 19 to a different place, correctly to
process template-args-cont lines.
2011-03-06 17:03:45 +00:00
Alan Mackenzie
9d1f0f559d progmodes/cc-engine.el (c-guess-basic-syntax): Reindent. 2011-03-06 16:57:31 +00:00
Alan Mackenzie
e84efb7078 (c-state-literal-at): Prevent positions in macros finding their way into
c-state-nonlit-pos-cache.  Strengthen the comments.

(c-state-dump): New commented out diagnostic routine.
2011-02-21 21:25:35 +00:00
Alan Mackenzie
abfc152b45 Proper fix for CC mode Bug#7722.
* lisp/progmodes/cc-fonts.el (c-font-lock-declarations): Remove a
narrow-to-region call that cuts context off the end (Bug#7722).

* lisp/progmodes/cc-engine.el (c-forward-<>-arglist-recur): Refactor
nested if-forms with a simple cond.
(c-forward-<>-arglist): Revert 2011-01-31 change.
2011-02-13 15:25:15 -05:00
Chong Yidong
14beddf471 Merge changes from emacs-23 branch 2011-01-31 18:54:50 -05:00
Chong Yidong
af7c5700ca Limit recursion depth of c-forward-<>-arglist-recur (Bug#7722).
* progmodes/cc-engine.el (c-forward-<>-arglist-recur): Set a limit
to the recursion depth.
2011-01-26 19:51:41 -05:00
Glenn Morris
73b0cd5003 Convert consecutive FSF copyright years to ranges. 2011-01-24 20:08:28 -08:00
Glenn Morris
e9bffc61f2 Refill some copyright headers. 2011-01-15 18:21:30 -08:00
Glenn Morris
0d9f702fd0 Nuke arch-tags. 2011-01-15 15:16:57 -08:00
Stefan Monnier
77ab81d054 Merge from emacs-23 2011-01-14 12:18:41 -05:00
Glenn Morris
5df4f04cd3 Add 2011 to FSF/AIST copyright years. 2011-01-02 15:50:46 -08:00
Alan Mackenzie
0e5cf2b8a5 (c-forward-type): Before scanning a template arglist, check that the
current language supports this.
2010-12-12 12:24:56 +00:00
Alan Mackenzie
e15f8aaa0e Enhance fontification of declarators to take account of the
presence/absence of "typedef".

cc-engine.el (c-forward-type): New &optional param "brace-block-too".
(c-forward-decl-or-cast-1): cdr of return value now indicates the
presence of either or both of a "struct"-like keyword and "typedef".

cc-fonts.el (c-complex-decl-matchers): Remove the heuristic fontification
of declarators which follow a "}".
(c-font-lock-declarations): Fontify declarators according to the
presence/absence of "typedef".

cc-langs.el (c-typedef-kwds c-typedef-key): New lang variable for
"typedef".
(c-typedef-decl-key): New lang variable built from c-typedef-decl-kwds.
2010-10-09 19:58:28 +00:00
Alan Mackenzie
a4ee83ccd4 (c-forward-<>-arglist-recur): Fix an infinite recursion. 2010-09-15 18:03:25 +00:00
Alan Mackenzie
22c3ce9729 (c-forward-<>-arglist-recur): Correct the indentation. 2010-09-15 17:51:15 +00:00
Chong Yidong
bd78fa1d54 Add "Package:" file headers to denote built-in packages. 2010-08-29 12:17:13 -04:00
Glenn Morris
f3b554af9d Silence some cc-mode compiler warnings.
* lisp/progmodes/cc-engine.el (c-new-BEG, c-new-END)
(c-fontify-recorded-types-and-refs): Define for compiler.
* lisp/progmodes/cc-mode.el (c-new-BEG, c-new-END): Move definitions
before use.
2010-08-16 23:54:03 -07:00
Alan Mackenzie
452ea85502 Enhance Java Mode to handle Java 5.0 (Tiger) and Java 6 (Mustang).
Contributed by Nathaniel Flath.
2010-07-31 20:01:08 +00:00
Alan Mackenzie
43a91810d3 Fix an indentation bug:
progmodes/cc-mode.el (c-common-init): Initialise c-new-BEG/END.
(c-neutralize-syntax-in-and-mark-CPP): c-new-BEG/END: Take account
of existing values.

progmodes/cc-engine.el (c-clear-<-pair-props-if-match-after)
(c-clear->-pair-props-if-match-before): now return t when they've cleared
properties, nil otherwise.
(c-before-change-check-<>-operators): Set c-new-beg/end correctly by
taking account of the existing value.

progmodes/cc-defs.el (c-clear-char-property-with-value-function): Fix
this to clear the property rather than overwriting it with nil.
2010-06-21 21:08:26 +00:00
Alan Mackenzie
c0209c2c68 Fix a bug which happens when doing (c-parse-state) in a CPP construct:
Exclude any "new" CPP construct from taking part in the scanning.
2010-05-21 19:51:48 +00:00
Alan Mackenzie
e42a330165 Reverse 2009-12-03T16:02:10Z!acm@muc.de "Enhance `c-parse-state' to run efficiently in
\"brace desserts\".".
2010-04-12 18:58:52 +00:00
Alan Mackenzie
7af4bf3aea Reverse change 2010-02-04T21:15:37Z!acm@muc.de: "Change strategy for marking < and > as template
delimiters: mark them strictly in matching pairs."
2010-04-12 15:15:07 +00:00
Alan Mackenzie
e2387bdba2 Reverse 2010-02-25T21:21:25Z!acm@muc.de:
"  (i) Remove any hard syntax-table properties for <, > inserted by C-y.
  (ii) Remove category text props, not syntax-table ones in unmarking <, >.
".
2010-04-12 14:59:56 +00:00
Alan Mackenzie
a1c7301e31 Reverse 2010-03-01T11:31:42Z!acm@muc.de: "Fix bug #5649: 23.1.92; Indentation problems in C mode.". 2010-04-12 14:55:18 +00:00
Alan Mackenzie
2811df2c90 Reverse 2010-03-01T17:46:36Z!acm@muc.de "Correct buggy patch 2010-03-01T11:31:42Z!acm@muc.de to cc-engine.el.". 2010-04-12 14:48:07 +00:00
Alan Mackenzie
db00cb3ae4 Undo 2010-03-15T01:38:28Z!yamaoka@jpl.org "Fix off-by-one error. Fixes bug #5747." 2010-04-12 14:34:09 +00:00
Alan Mackenzie
657071fc07 cc-engine.el (c-remove-stale-state-cache): Fix off-by-one error. Fixes
bug #5747.
2010-03-22 17:21:22 +00:00
Alan Mackenzie
eb2f6eeb39 Correct buggy patch 2010-03-01T11:31:42Z!acm@muc.de to cc-engine.el. 2010-03-01 17:46:36 +00:00
Alan Mackenzie
dd21b6216d Fix bug #5649: 23.1.92; Indentation problems in C mode. 2010-03-01 11:31:42 +00:00
Alan Mackenzie
8a249abc87 (i) Remove any hard syntax-table properties for <, > inserted by C-y.
(ii) Remove category text props, not syntax-table ones in unmarking <, >.
2010-02-25 21:21:25 +00:00
Alan Mackenzie
dd969a56a5 Change strategy for marking < and > as template delimiters: mark them
strictly in matching pairs.
2010-02-04 21:15:37 +00:00
Alan Mackenzie
3e8f7d9196 Fix a situation where deletion of a cpp construct throws an error. 2010-01-21 21:45:01 +00:00
Juanma Barranquero
5a89f0a793 Fix typos in comments. 2010-01-14 19:37:23 +01:00
Glenn Morris
114f9c9679 Add 2010 to copyright years. 2010-01-13 00:35:10 -08:00
Glenn Morris
47641aacc1 (safe-pos-list): Define for compiler. 2009-12-11 01:46:24 +00:00
Alan Mackenzie
d0fcee6698 Fix bug#5091: indentation in c++-mode.
* cc-mode.el (c-basic-common-init): make text property `category' rear
non-sticky.

* cc-engine.el (c-ssb-lit-begin): New defsubst, extracted from ....
(c-syntactic-skip-backward): Refactor, extracting the above.
(c-guess-basic-syntax CASEs 5D.3, 5L): Add extra anchor point;
(c-guess-basic-syntax CASE 19): New CASE to handle template construct
continued over line boundary.
(c-guess-basic-syntax CASE 7): don't trigger on '<'.
2009-12-10 14:29:11 +00:00
Alan Mackenzie
0ec1d2c5bb Enhance `c-parse-state' to run efficiently in "brace desserts".
* progmodes/cc-mode.el (c-basic-common-init): Call
c-state-cache-init.
(c-neutralize-syntax-in-and-mark-CPP):  Renamed from
c-extend-and-neutralize-syntax-in-CPP.  Mark each CPP construct by
placing `category' properties value 'c-cpp-delimiter at its
boundaries.

* progmodes/cc-langs.el (c-before-font-lock-function):
c-extend-and-neutralize-syntax-in-CPP has been renamed
c-neutralize-syntax-in-and-mark-CPP.

* progmodes/cc-fonts.el (c-cpp-matchers): Mark template brackets
with `category' properties now, not `syntax-table' ones.

* progmodes/cc-engine.el (c-syntactic-end-of-macro): A new
enhanced (but slower) version of c-end-of-macro that won't land
inside a literal or on another awkward character.
(c-state-cache-too-far, c-state-cache-start)
(c-state-nonlit-pos-interval, c-state-nonlit-pos-cache)
(c-state-nonlit-pos-cache-limit, c-state-point-min)
(c-state-point-min-lit-type, c-state-point-min-lit-start)
(c-state-min-scan-pos, c-state-brace-pair-desert)
(c-state-old-cpp-beg, c-state-old-cpp-end): New constants and
buffer local variables.
(c-state-literal-at, c-state-lit-beg)
(c-state-cache-non-literal-place, c-state-get-min-scan-pos)
(c-state-mark-point-min-literal, c-state-cache-top-lparen)
(c-state-cache-top-paren, c-state-cache-after-top-paren)
(c-get-cache-scan-pos, c-get-fallback-scan-pos)
(c-state-balance-parens-backwards, c-parse-state-get-strategy)
(c-renarrow-state-cache)
(c-append-lower-brace-pair-to-state-cache)
(c-state-push-any-brace-pair, c-append-to-state-cache)
(c-remove-stale-state-cache)
(c-remove-stale-state-cache-backwards, c-state-cache-init)
(c-invalidate-state-cache-1, c-parse-state-1)
(c-invalidate-state-cache): New defuns/defmacros/defsubsts.
(c-parse-state): Enhanced and refactored.
(c-debug-parse-state): Amended to deal with all the new variables.

* progmodes/cc-defs.el (c-<-as-paren-syntax, c-mark-<-as-paren)
(c->-as-paren-syntax, c-mark->-as-paren, c-unmark-<->-as-paren):
modify to use category text properties rather than syntax-table
ones.
(c-suppress-<->-as-parens, c-restore-<->-as-parens): new defsubsts
to switch off/on the syntactic paren property of C++ template
delimiters using the category property.
(c-with-<->-as-parens-suppressed): Macro to invoke code with
template delims suppressed.
(c-cpp-delimiter, c-set-cpp-delimiters, c-clear-cpp-delimiters):
New constant/macros which apply category properties to the start
and end of preprocessor constructs.
(c-comment-out-cpps, c-uncomment-out-cpps): defsubsts which
"comment out" the syntactic value of characters in preprocessor
constructs.
(c-with-cpps-commented-out)
(c-with-all-but-one-cpps-commented-out): Macros to invoke code
with characters in all or all but one preprocessor constructs
"commented out".
2009-12-03 16:02:10 +00:00
Juanma Barranquero
b4dc7d9888 Fix typos in comments. 2009-10-04 02:11:57 +00:00
Alan Mackenzie
0000ee90eb cc-langs.el (c-nonlabel-token-key): Allow quoted character constants (as
case labels).

cc-engine.el (c-beginning-of-statement-1): Correct buggy bracketing.
2009-09-26 09:18:41 +00:00