mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-27 07:37:33 +00:00
c417f08b16
Or, more clearly, when something looks like a function declaration and it's inside a function, fontify it as a direct initialization. For this purpose, introduce a "brace stack" for each buffer, where an entry on the brace stack states how deeply nested a particular position is inside braces inside a "top level", which includes classes and namespaces. Also introduce a new "context", "top", with which c-font-lock-declarations signals to c-forward-decl-or-cast-1 that point is at the top level. * lisp/progmodes/cc-langs.el (c-get-state-before-change-functions): add c-truncate-bs-cache. (c-flat-decl-block-kwds, c-brace-stack-thing-key, c-brace-stack-no-semi-key) (c-type-decl-operator-prefix-key): new language constants/variables. * lisp/progmodes/cc-engine.el (c-bs-interval, c-bs-cache, c-bs-cache-limit) (c-bs-prev-pos, c-bs-prev-stack): New mostly local variables for the brace stack cache. (c-init-bs-cache, c-truncate-bs-cache, c-truncate-bs-cache, c-brace-stack-at) (c-bs-at-toplevel-p): New functions which manipulate the brace stack (cache). (c-find-decl-prefix-search): Keep track of whether we're at top level. (c-find-decl-spots): New local variable cfd-top-level which records what it says. On calling cfd-fun, pass cfd-top-level as an additional argument. (c-forward-declarator): Add new element DECORATED to the result list. Set it to non-nil when a match for c-type-decl-operator-prefix-key is found. (c-forward-decl-or-cast-1): Handle the newly introduced context "top". Introduce "CASE 9.5", which recognizes direct initializations. * lisp/progmodes/cc-fonts.el (c-font-lock-complex-decl-prepare) (c-font-lock-enum-tail, c-font-lock-cut-off-declarators) (c-font-lock-enclosing-decls, c-simple-decl-matchers, c-basic-matchers-after): Add appropriate `not-top' argument to calls to c-font-lock-declarators. (c-font-lock-declarators): Additional parameter `not-top'. Use not-top to participate in the decision whether to fontify an identifier as a function or a variable. (c-font-lock-declarations): The internal lambda function takes an additional argument `toplev' from c-find-decl-spots, which it uses in determining the "context" of a declaration. Add appropriate `not-top' argument to calls to c-font-lock-declarators. (c-font-lock-objc-methods): Add extra parameter to internal lambda function, like for c-font-lock-declarators. * lisp/progmodes/cc-mode.el (c-basic-common-init): Initialize the brace stack cache. |
||
---|---|---|
.. | ||
ada-mode.el | ||
ada-prj.el | ||
ada-stmt.el | ||
ada-xref.el | ||
antlr-mode.el | ||
asm-mode.el | ||
autoconf.el | ||
bat-mode.el | ||
bug-reference.el | ||
cc-align.el | ||
cc-awk.el | ||
cc-bytecomp.el | ||
cc-cmds.el | ||
cc-defs.el | ||
cc-engine.el | ||
cc-fonts.el | ||
cc-guess.el | ||
cc-langs.el | ||
cc-menus.el | ||
cc-mode.el | ||
cc-styles.el | ||
cc-vars.el | ||
cfengine.el | ||
cmacexp.el | ||
compile.el | ||
cperl-mode.el | ||
cpp.el | ||
cwarn.el | ||
dcl-mode.el | ||
ebnf2ps.el | ||
ebnf-abn.el | ||
ebnf-bnf.el | ||
ebnf-dtd.el | ||
ebnf-ebx.el | ||
ebnf-iso.el | ||
ebnf-otz.el | ||
ebnf-yac.el | ||
ebrowse.el | ||
elisp-mode.el | ||
etags.el | ||
executable.el | ||
f90.el | ||
flymake.el | ||
fortran.el | ||
gdb-mi.el | ||
glasses.el | ||
grep.el | ||
gud.el | ||
hideif.el | ||
hideshow.el | ||
icon.el | ||
idlw-complete-structtag.el | ||
idlw-help.el | ||
idlw-shell.el | ||
idlw-toolbar.el | ||
idlwave.el | ||
inf-lisp.el | ||
js.el | ||
ld-script.el | ||
m4-mode.el | ||
make-mode.el | ||
mantemp.el | ||
meta-mode.el | ||
mixal-mode.el | ||
modula2.el | ||
octave.el | ||
opascal.el | ||
pascal.el | ||
perl-mode.el | ||
prog-mode.el | ||
project.el | ||
prolog.el | ||
ps-mode.el | ||
python.el | ||
ruby-mode.el | ||
scheme.el | ||
sh-script.el | ||
simula.el | ||
sql.el | ||
subword.el | ||
tcl.el | ||
vera-mode.el | ||
verilog-mode.el | ||
vhdl-mode.el | ||
which-func.el | ||
xref.el | ||
xscheme.el |