Commit graph

168 commits

Author SHA1 Message Date
Alan Mackenzie
267eacb5e3 Fix a bug in the state cache mechanism. Refactor this a bit.
cc-engine.el (c-parse-state-get-strategy): Remove the `cache-pos' element
from the return value.
(c-append-lower-brace-pair-to-state-cache): "Narrow" to end of buffer to
enable proper searching from beyond HERE.
Amend the test for detecting the sought brace pair.  Amend the value
written to the "brace desert cache" when the brace isn't found.
(c-remove-stale-state-cache): Rename `good-pos' to `start-point', and
several other variables analogously.
(c-remove-stale-state-cache-backwards): Change `cache-pos' from a
parameter to a locally calculated variable.
(c-parse-state-1): Change the calling conventions to the two defuns
involving `cache-pos'.
2013-01-23 18:58:11 +00:00
Alan Mackenzie
8cff5febae Fix bugs in the c-parse-state mechanism. Reuse some markers instead of
continually generating new ones.

cc-engine.el (c-state-old-cpp-beg-marker, c-state-old-cpp-end-marker):
New variables.
(c-append-lower-brace-pair-to-state-cache): Start a backward search for
"}" definitively outside CPP constructs.
(c-remove-stale-state-cache): Inform the caller of a need to search back
for a brace pair in certain circumstances.
(c-state-maybe-marker): New macro.
(c-parse-state): Reuse markers when appropriate.
2013-01-09 21:33:00 +00:00
Paul Eggert
ab422c4d68 Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
Alan Mackenzie
14b8c3d926 Make CC Mode not hang when _some_ lines end in CRLF. Bug #11841.
cc-engine.el (c-backward-comments): Add code to work around
`forward-comment' not recognizing ^M as whitespace.
2012-12-11 19:06:57 +00:00
Alan Mackenzie
b03aabdac5 Fix bugs in the CC Mode state cache. Enhance a debugging mechanism. 2012-11-21 20:41:03 +00:00
Alan Mackenzie
8ed43f1548 Correct the handling of two c-state-cache state variables.
cc-engine.el (c-state-cache-init): Initialise
c-state-semi-nonlit-pos-cache\(-limit\)? properly.
(c-record-parse-state-state): record
c-state-semi-nonlit-pos-cache\(-limit\)?.
2012-09-09 11:03:37 +00:00
Alan Mackenzie
ace2989a84 AWK Mode: make auto-newline work when there's "==" in the pattern.
cc-cmds.el (c-point-syntax): Handle virtual semicolons correctly.
cc-engine.el (c-guess-basic-syntax CASE 5A.3): Test more rigorously for
"=" token.
2012-09-08 20:00:13 +00:00
Stefan Monnier
2143fa3267 * lisp/progmodes/cc-engine.el (c-forward-sws, c-backward-sws):
Avoid spuriously marking the buffer as modified because of c-is-sws.
2012-07-17 07:40:23 -04:00
Alan Mackenzie
583e23bd57 CC Mode. Adding a ) can hide the resulting (..) from searches. Fix it. 2012-04-22 11:13:09 +00:00
Alan Mackenzie
0de3da9f2f Correct two search limits in c-before-change-check_<>-operators. 2012-04-11 15:32:30 +00:00
Alan Mackenzie
2e492df3cd Further optimise the handling of large macros. 2012-03-16 14:10:54 +00:00
Paul Eggert
f003f29445 Spelling fixes. 2012-03-12 15:35:55 -07:00
Alan Mackenzie
56d093a9c8 Depessimize the handling of very large macros. 2012-03-02 22:16:21 +00:00
Alan Mackenzie
0bc5886ace Fix infinite loop with long macros. 2012-02-12 11:06:42 +00:00
Alan Mackenzie
98d7371e7a Fix spurious recognition of c-in-knr-argdecl. 2012-02-07 15:19:52 +00:00
Alan Mackenzie
667ced3a2d cc-engine.el (c-forward-objc-directive): Prevent looping in "#pragma mark
@implementation".
2012-02-07 12:01:42 +00:00
Alan Mackenzie
abbceb009c Fix an off by one error in c-guess-basic-syntax CASE 5B.1. 2012-01-31 21:59:58 +00:00
Alan Mackenzie
9657183b6f Eliminate sluggishness and hangs in fontification of "semicolon deserts".
cc-engine.el (c-state-nonlit-pos-interval): change value 10000 -> 3000.
(c-state-safe-place): Reformulate so it doesn't stack up an infinite
number of wrong entries in c-state-nonlit-pos-cache.
(c-determine-limit-get-base, c-determine-limit): New functions to
determine backward search limits disregarding literals.
(c-find-decl-spots): Amend commenting.
(c-cheap-inside-bracelist-p): New function which detects "={".

cc-fonts.el (c-make-font-lock-BO-decl-search-function): Give a limit to a
backward search.
(c-font-lock-declarations): Fix an occurrence of point being undefined.
Check additionally for point being in a bracelist or near a macro
invocation without a semicolon so as to avoid a fruitless time consuming
search for a declarator.  Give a more precise search limit for
declarators using the new c-determine-limit.
2012-01-18 13:19:31 +00:00
Alan Mackenzie
2cc769a8c3 Fix Emacs bug #10463 - put `widen's around the critical spots. 2012-01-11 22:21:44 +00:00
Glenn Morris
acaf905b11 Add 2012 to FSF copyright years for Emacs files 2012-01-05 01:46:05 -08:00
Paul Eggert
22bcf20469 Spelling fixes. 2011-12-30 17:27:15 -08:00
Paul Eggert
9858f6c326 Spelling fixes. 2011-12-29 18:52:49 -08:00
Alan Mackenzie
13d49cbb26 Large brace-block initialisation makes CC Mode slow: Fix.
Tidy up and accelerate c-in-literal, etc. by using the c-parse-state
routines.  Limit backward searching in c-font-lock-enclosing.decl.

cc-engine.el (c-state-pp-to-literal): Return the pp-state and literal
type in addition to the limits.
(c-state-safe-place): New defun, extracted from c-state-literal-at.
(c-state-literal-at): Use the above new defun.
(c-slow-in-literal, c-fast-in-literal): Removed.
(c-in-literal, c-literal-limits): Amended to use c-state-pp-to-literal.

cc-fonts.el (c-font-lock-enclosing-decls): Check for being in a literal.
Add a limit for backward searching.

cc-mode.el (awk-mode): Don't alias c-in-literal to c-slow-in-literal.
2011-12-13 18:47:08 +00:00
Paul Eggert
333f9019e2 Spelling fixes. 2011-12-11 21:32:49 -08:00
Paul Eggert
fa46310344 Spelling fixes. 2011-12-05 00:55:25 -08:00
Paul Eggert
ee7683ebb7 Spelling fixes. 2011-11-22 23:03:56 -08:00
Paul Eggert
40ba43b4b7 Spelling fixes. 2011-11-19 23:30:16 -08:00
Paul Eggert
e1dbe924b5 Spelling fixes. 2011-11-19 18:29:42 -08:00
Paul Eggert
5396468298 Spelling fixes. 2011-11-19 01:18:31 -08:00
Stefan Monnier
c400c4d798 * lisp/progmodes/cc-engine.el (c-remove-stale-state-cache-backwards):
Don't hardcode point-min==1.
2011-11-18 10:06:20 -05:00
Juanma Barranquero
58179ccebd Fix typos. 2011-11-16 13:34:47 +01:00
Juanma Barranquero
c701515351 Fix typos. 2011-11-15 18:37:37 +01:00
Paul Eggert
da6062e6ea Spelling fixes. 2011-11-14 23:55:13 -08:00
Juanma Barranquero
0d26e0b62b Fix typos. 2011-11-15 01:54:19 +01:00
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