File: cc-engine.el.html

The functions which have docstring documentation can be considered part of an API which other packages can use in CC Mode buffers. Otoh, undocumented functions and functions with the documentation in comments are considered purely internal and can change semantics or even disappear in the future.

(This policy applies to CC Mode as a whole, not just this file. It
probably also applies to many other Emacs packages, but here it's clearly spelled out.)

Hidden buffer changes

Various functions in CC Mode use text properties for caching and syntactic markup purposes, and those of them that might modify such properties but still don't modify the buffer in a visible way are said to do "hidden buffer changes". They should be used within c-save-buffer-state or a similar function that saves and restores buffer modifiedness, disables buffer change hooks, etc.

Interactive functions are assumed to not do hidden buffer changes, except in the specific parts of them that do real changes.

Lineup functions are assumed to do hidden buffer changes. They must not do real changes, though.

All other functions that do hidden buffer changes have that noted in their doc string or comment.

The intention with this system is to avoid wrapping every leaf function that do hidden buffer changes inside c-save-buffer-state. It should be used as near the top of the interactive functions as possible.

Functions called during font locking are allowed to do hidden buffer changes since the font-lock package run them in a context similar to c-save-buffer-state (in fact, that function is heavily inspired by save-buffer-state in the font-lock package).

Use of text properties

CC Mode uses several text properties internally to mark up various positions, e.g. to improve speed and to eliminate glitches in interactive refontification.

Note: This doc is for internal use only. Other packages should not assume that these text properties are used as described here.

'category
  Used for "indirection". With its help, some other property can
  be cheaply and easily switched on or off everywhere it occurs.

'syntax-table
  Used to modify the syntax of some characters. It is used to
  mark the "<" and ">" of angle bracket parens with paren syntax, to
  "hide" obtrusive characters in preprocessor lines, and to mark C++
  raw strings to enable their fontification.

  This property is used on single characters and is therefore
  always treated as front and rear nonsticky (or start and end open
  in XEmacs vocabulary). It's therefore installed on
  text-property-default-nonsticky if that variable exists (Emacs
  >= 21).

'c-fl-syn-tab
  Saves the value of syntax-table properties which have been
  temporarily removed from certain buffer positions. The syntax-table
  properties are restored during c-before-change, c-after-change, and
  font locking. The purpose of the temporary removal is to enable
  C-M-* key sequences to operate over bogus pairs of string delimiters
  which are "adjacent", yet do not delimit a string.

'c-is-sws and 'c-in-sws
  Used by c-forward-syntactic-ws and c-backward-syntactic-ws to
  speed them up. See the comment blurb before c-put-is-sws
  below for further details.

'c-type
  This property is used on single characters to mark positions with
  special syntactic relevance of various sorts. Its primary use is
  to avoid glitches when multiline constructs are refontified
  interactively (on font lock decoration level 3). It's cleared in
  a region before it's fontified and is then put on relevant chars
  in that region as they are encountered during the fontification.
  The value specifies the kind of position:

    'c-decl-arg-start
         Put on the last char of the token preceding each declaration
         inside a declaration style arglist (typically in a function
         prototype).

    'c-decl-end
         Put on the last char of the token preceding a declaration.
         This is used in cases where declaration boundaries can't be
         recognized simply by looking for a token like ";" or "}".
         c-type-decl-end-used must be set if this is used (see also
         c-find-decl-spots).

    'c-<>-arg-sep
         Put on the commas that separate arguments in angle bracket
         arglists like C++ template arglists.

    'c-decl-id-start and 'c-decl-type-start
         Put on the last char of the token preceding each declarator
         in the declarator list of a declaration. They are also used
         between the identifiers cases like enum declarations.
         'c-decl-type-start is used when the declarators are types,
         'c-decl-id-start otherwise.

    'c-not-decl
      Put on the brace which introduces a brace list and on the commas
      which separate the elements within it.

'c-typedef This property is applied to the first character of a
  "typedef" keyword. It's value is a list of the identifiers that
  the "typedef" declares as types.

'c-<>-c-types-set
  This property is set on an opening angle bracket, and indicates that
  any "," separators within the template/generic expression have been
  marked with a 'c-type property value 'c-<>-arg-sep (see above).

'c-awk-NL-prop
  Used in AWK mode to mark the various kinds of newlines. See
  cc-awk.el.

Defined variables (78)

c-<-pseudo-digraph-cont-lenThe maximum length of the main bit of a ‘c-<-pseudo-digraph-cont-regexp’ match.
c-<-pseudo-digraph-cont-regexpRegexp matching the continuation of a pseudo digraph starting "<".
c-<>-notable-chars-reA regexp matching any single character notable inside a <...> construct.
c-anchored-cpp-prefixRegexp matching the prefix of a cpp directive anchored to BOL,
c-at-vsemi-p-fnContains a function "Is there a virtual semicolon at POS or point?".
c-before-context-fontification-functionsIf non-nil, a list of functions called just before context (or
c-before-font-lock-functionsIf non-nil, a list of functions called just before font locking.
c-block-comment-awkward-charsList of characters which, inside a block comment, could be the first
c-block-comment-enderString that ends block comments, or nil if such don’t exist.
c-block-comment-is-defaultNon-nil when the default comment style is block comment.
c-block-comment-starterString that starts block comments, or nil if such don’t exist.
c-colon-type-list-reRegexp matched after the keywords in ‘c-colon-type-list-kwds’ to skip
c-cpp-expr-intro-reRegexp which matches the start of a CPP directive which contains an
c-decl-start-colon-kwd-reRegexp matching a keyword that is followed by a colon, where
c-decl-start-reRegexp matching the start of any declaration, cast or label.
c-doc-comment-start-regexpRegexp to match the start of documentation comments.
c-enums-contain-declsNon-nil means that an enum structure can contain declarations.
c-get-state-before-change-functionsIf non-nil, a list of functions called from c-before-change-hook.
c-has-bitfieldsWhether the language has bitfield declarations.
c-has-compound-literalsWhether literal initializers {...} are used other than in initializations.
c-has-quoted-numbersWhether the language has numbers quoted like 4’294’967’295.
c-identifier-keyRegexp matching a fully qualified identifier, like "A::B::c" in
c-identifier-startRegexp that matches the start of an (optionally qualified) identifier.
c-identifier-syntax-modificationsA list that describes the modifications that should be done to the
c-identifier-syntax-tableSyntax table built on the mode syntax table but additionally
c-label-prefix-reRegexp like ‘c-decl-prefix-re’ that matches any token that can precede
c-last-c-comment-end-on-line-reRegexp which matches the last block comment ender on the
c-line-comment-starterString that starts line comments, or nil if such don’t exist.
c-make-ml-string-closer-re-functionIf non-nil, a function which creates a closer regexp matching an opener.
c-make-ml-string-opener-re-functionIf non-nil, a function which creates an opener regexp matching a closer.
c-maybe-decl-facesList of faces that might be put at the start of a type when
c-maybe-typeless-specifier-reRegexp matching keywords which might, but needn’t, declare variables with
c-ml-string-any-closer-reIf non-nil, a regexp that matches any multi-line string closer.
c-ml-string-back-closer-reA regexp to move back out of a putative ml closer point is in.
c-ml-string-max-closer-lenIf non-nil, the maximum length of a multi-line string closer.
c-ml-string-max-closer-len-no-leaderIf non-nil, the maximum length of a ml string closer without its leader.
c-ml-string-max-opener-lenIf non-nil, the maximum length of a multi-line string opener.
c-ml-string-opener-reIf non-nil, a regexp that matches a multi-line string opener.
c-modified-constantRegexp that matches a “modified” constant literal such as "L'a'",
c-module-name-reThis regexp matches (a component of) a module name.
c-multiline-string-start-charSet if the language supports multiline string literals without escaped
c-nonlabel-nonparen-token-keyRegexp matching things that can’t occur in generic colon labels,
c-nonlabel-token-2-keyRegexp matching things that can’t occur two symbols before a colon in
c-nonlabel-token-keyRegexp matching things that can’t occur in generic colon labels,
c-nonsymbol-charsThis is the set of chars that can’t be part of a symbol, i.e. the
c-nonsymbol-keyRegexp that matches any character that can’t be part of a symbol.
c-opt-cpp-macro-defineCpp directive (without the prefix) that is followed by a macro
c-opt-cpp-prefixRegexp matching the prefix of a cpp directive in the languages that
c-opt-cpp-startRegexp matching the prefix of a cpp directive including the directive
c-opt-cpp-symbolThe symbol which starts preprocessor constructs when in the margin.
c-opt-extra-label-keyOptional regexp matching labels.
c-opt-op-identifier-prefixRegexp matching the token before the ones in
c-opt-type-suffix-keyRegexp matching operators that might follow after a type, or nil in
c-other-decl-block-key-in-symbols-alistAlist associating keywords in c-other-decl-block-decl-kwds with
c-paragraph-separateRegexp to append to ‘paragraph-separate’.
c-paragraph-startRegexp to append to ‘paragraph-start’.
c-post-protection-tokenThe token which (may) follow a protection keyword,
c-pre-brace-non-bracelist-keyA regexp matching tokens which, preceding a brace, make it a non-bracelist.
c-pre-start-tokensList of operators following which an apparent declaration (e.g.
c-recognize-<>-arglistsNon-nil means C++ style template arglists should be handled. More
c-recognize-bare-brace-initsNon-nil means that brace initializers without "=" exist,
c-recognize-colon-labelsNon-nil if generic labels ending with ":" should be recognized.
c-recognize-knr-pNon-nil means K&R style argument declarations are valid.
c-recognize-paren-inexpr-blocksNon-nil to recognize gcc style in-expression blocks,
c-recognize-paren-initsNon-nil means that parenthesis style initializers exist,
c-recognize-post-brace-list-type-pSet to t when we recognize a colon and then a type after an enum,
c-recognize-typeless-declsNon-nil means function declarations without return type should be
c-single-quotes-quote-stringsWhether the language uses single quotes for multi-char strings.
c-special-brace-listsList of open- and close-chars that makes up a pike-style brace list,
c-std-abbrev-keywordsList of keywords which may need to cause electric indentation.
c-string-escaped-newlinesSet if the language support backslash escaped newlines inside string
c-sub-colon-type-list-reRegexp matching buffer content that may come between a keyword in
c-symbol-char-keyRegexp matching a sequence of at least one identifier character.
c-symbol-charsSet of characters that can be part of a symbol.
c-symbol-keyRegexp matching identifiers and keywords (with submatch 0). Assumed
c-symbol-startRegexp that matches the start of a symbol, i.e. any identifier or
c-type-decl-operator-prefix-keyRegexp matching any declarator operator which isn’t a keyword,
c-vsemi-status-unknown-p-fnA function "are we unsure whether there is a virtual semicolon on this line?".

Defined functions (198)

c-add-class-syntax(SYMBOL CONTAINING-DECL-OPEN CONTAINING-DECL-START CONTAINING-DECL-KWD)
c-add-stmt-syntax(SYNTAX-SYMBOL SYNTAX-EXTRA-ARGS STOP-AT-BOI-ONLY CONTAINING-SEXP PAREN-STATE &optional FIXED-ANCHOR)
c-add-syntax(SYMBOL &rest ARGS)
c-add-type(FROM TO)
c-add-type-1(FROM TO)
c-after-change-check-<>-operators(BEG END)
c-after-change-unmark-ml-strings(BEG END OLD-LEN)
c-after-conditional(&optional LIM)
c-after-special-operator-id(&optional LIM)
c-append-lower-brace-pair-to-state-cache(FROM HERE &optional UPPER-LIM)
c-append-syntax(SYMBOL &rest ARGS)
c-append-to-state-cache(FROM HERE)
c-at-expression-start-p()
c-at-macro-vsemi-p(&optional POS)
c-at-statement-start-p()
c-at-toplevel-p()
c-back-over-list-of-member-inits(LIMIT)
c-back-over-member-initializers(&optional LIMIT)
c-backward-<>-arglist(ALL-TYPES &optional LIMIT)
c-backward-comments()
c-backward-single-comment()
c-backward-sws()
c-backward-to-block-anchor(&optional LIM)
c-backward-to-decl-anchor(&optional LIM)
c-backward-token-1(&optional COUNT BALANCED LIMIT)
c-backward-token-2(&optional COUNT BALANCED LIMIT)
c-before-after-change-check-c++-modules(BEG END &optional OLD_LEN)
c-before-change-check-<>-operators(BEG END)
c-before-change-check-ml-strings(BEG END)
c-beginning-of-current-token(&optional BACK-LIMIT)
c-beginning-of-decl-1(&optional LIM)
c-beginning-of-inheritance-list(&optional LIM)
c-beginning-of-macro(&optional LIM)
c-beginning-of-statement-1(&optional LIM IGNORE-LABELS NOERROR COMMA-DELIM HIT-LIM)
c-bos-pop-state(&optional DO-IF-DONE)
c-bos-save-error-info(MISSING GOT)
c-brace-anchor-point(BRACEPOS)
c-brace-stack-at(HERE)
c-bs-at-toplevel-p(HERE)
c-c++-make-ml-string-closer-re(OPENER)
c-c++-make-ml-string-opener-re(CLOSER)
c-cache-to-parse-ps-state(ELT)
c-calc-offset(LANGELEM)
c-calculate-state(ARG PREVSTATE)
c-cheap-inside-bracelist-p(PAREN-STATE)
c-check-qualified-type(FROM)
c-check-type(FROM TO)
c-clear-<-pair-props(&optional POS)
c-clear-<-pair-props-if-match-after(LIM &optional POS)
c-clear-<>-pair-props(&optional POS)
c-clear->-pair-props(&optional POS)
c-clear->-pair-props-if-match-before(LIM &optional POS)
c-clear-c-type-property(FROM TO VALUE)
c-collect-line-comments(RANGE)
c-crosses-statement-barrier-p(FROM TO)
c-debug-add-face(BEG END FACE)
c-debug-parse-state-double-cons(STATE)
c-debug-put-decl-spot-faces(MATCH-POS DECL-POS)
c-debug-remove-decl-spot-faces(BEG END)
c-debug-remove-face(BEG END FACE)
c-debug-sws-msg(&rest ARGS)
c-delq-from-dotted-list(ELT DLIST)
c-depropertize-ml-string(STRING-DELIMS BOUND)
c-depropertize-ml-string-delims(STRING-DELIMS)
c-depropertize-ml-strings-in-region(START FINISH)
c-determine-+ve-limit(HOW-FAR &optional START-POS)
c-determine-limit(HOW-FAR-BACK &optional START TRY-SIZE ORG-START)
c-determine-limit-get-base(START TRY-SIZE)
c-determine-limit-no-macro(HERE ORG-START)
c-directly-in-class-called-p(NAME)
c-do-declarators(CDD-LIMIT CDD-LIST CDD-NOT-TOP CDD-COMMA-PROP CDD-FUNCTION &optional CDD-ACCEPT-ANON)
c-echo-parsing-error(&optional QUIET)
c-end-of-current-token(&optional BACK-LIMIT)
c-end-of-macro(&optional LIM)
c-end-of-token(&optional BACK-LIMIT)
c-evaluate-offset(OFFSET LANGELEM SYMBOL)
c-fdoc-shift-type-backward(&optional SHORT)
c-find-decl-spots(CFD-LIMIT CFD-DECL-RE CFD-FACE-CHECKLIST CFD-FUN)
c-foreign-init-lit-pos-cache()
c-foreign-truncate-lit-pos-cache(BEG END)
c-forward-<>-arglist(ALL-TYPES)
c-forward-<>-arglist-recur(ALL-TYPES)
c-forward-c++-requires-clause(&optional LIMIT)
c-forward-class-decl()
c-forward-comment-minus-1()
c-forward-comments()
c-forward-decl-arglist(NOT-TOP ID-IN-PARENS &optional LIMIT)
c-forward-decl-or-cast-1(PRECEDING-TOKEN-END CONTEXT LAST-CAST-END &optional INSIDE-MACRO)
c-forward-declarator(&optional LIMIT ACCEPT-ANON NOT-TOP)
c-forward-id-comma-list(TYPE UPDATE-SAFE-POS)
c-forward-keyword-clause(MATCH)
c-forward-keyword-prefixed-id(TYPE)
c-forward-label(&optional ASSUME-MARKUP PRECEDING-TOKEN-END LIMIT)
c-forward-noise-clause-not-macro-decl(MAYBE-PARENS)
c-forward-over-token(&optional BALANCED LIMIT)
c-forward-over-token-and-ws(&optional BALANCED)
c-forward-primary-expression(&optional LIMIT)
c-forward-single-comment()
c-forward-sws()
c-forward-token-1(&optional COUNT BALANCED LIMIT)
c-forward-token-2(&optional COUNT BALANCED LIMIT)
c-forward-type(&optional BRACE-BLOCK-TOO)
c-full-get-near-cache-entry(HERE)
c-full-pp-to-literal(HERE &optional NOT-IN-DELIMITER)
c-full-put-near-cache-entry(HERE STATE END)
c-get-cache-scan-pos(HERE)
c-get-fallback-scan-pos(HERE)
c-get-ml-closer(OPEN-DELIM)
c-get-offset(LANGELEM)
c-get-syntactic-indentation(LANGELEMS)
c-guess-basic-syntax()
c-guess-continued-construct(INDENT-POINT CHAR-AFTER-IP BEG-OF-SAME-OR-CONTAINING-STMT CONTAINING-SEXP PAREN-STATE)
c-in-knr-argdecl(&optional LIM)
c-in-literal(&optional LIM DETECT-CPP)
c-inside-bracelist-p(CONTAINING-SEXP PAREN-STATE ACCEPT-IN-PAREN)
c-invalidate-find-decl-cache(CHANGE-MIN-POS)
c-invalidate-macro-cache(BEG END)
c-invalidate-state-cache(HERE)
c-invalidate-state-cache-1(HERE)
c-invalidate-sws-region-after(BEG END OLD-LEN)
c-invalidate-sws-region-after-del(BEG END OLD-LEN)
c-invalidate-sws-region-after-ins(END)
c-invalidate-sws-region-before(BEG END)
c-just-after-func-arglist-p(&optional LIM)
c-keyword-member(KEYWORD-SYM LANG-CONSTANT)
c-keyword-sym(KEYWORD)
c-laomib-fix-elt(LWM ELT PAREN-STATE)
c-laomib-get-cache(CONTAINING-SEXP)
c-laomib-invalidate-cache(BEG END)
c-laomib-loop(LIM)
c-laomib-put-cache(LIM START END RESULT)
c-least-enclosing-brace(PAREN-STATE)
c-literal-limits(&optional LIM NEAR NOT-IN-DELIMITER)
c-literal-limits-fast(&optional LIM NEAR NOT-IN-DELIMITER)
c-literal-start(&optional SAFE-POS)
c-literal-type(RANGE)
c-looking-at-decl-block(GOTO-START &optional LIMIT)
c-looking-at-inexpr-block(LIM CONTAINING-SEXP &optional CHECK-AT-END)
c-looking-at-inexpr-block-backward(PAREN-STATE)
c-looking-at-or-maybe-in-bracelist(&optional CONTAINING-SEXP LIM)
c-ml-string-back-to-neutral(OPENING-POINT)
c-ml-string-in-end-delim(BEG END OPEN-DELIM)
c-ml-string-make-closer-re(OPENER)
c-ml-string-make-opener-re(CLOSER)
c-ml-string-opener-at-or-around-point(&optional POSITION)
c-ml-string-opener-intersects-region(&optional START FINISH)
c-most-enclosing-brace(PAREN-STATE &optional BUFPOS)
c-most-enclosing-decl-block(PAREN-STATE)
c-on-identifier()
c-parse-ps-state-below(HERE)
c-parse-ps-state-to-cache(STATE)
c-parse-state-get-strategy(HERE GOOD-POS)
c-partial-ws-p(BEG END)
c-position-wrt-ml-delims(ML-STRING-DELIMS)
c-propertize-ml-string-id(DELIM)
c-propertize-ml-string-opener(DELIM BOUND)
c-ps-state-cache-pos(ELT)
c-pull-open-brace(PS)
c-punctuation-in(FROM TO)
c-put-c-type-property(POS VALUE)
c-put-in-sws(BEG END)
c-put-is-sws(BEG END)
c-record-ref-id(RANGE)
c-record-type-id(RANGE)
c-remove-in-sws(BEG END)
c-remove-is-and-in-sws(BEG END)
c-remove-is-sws(BEG END)
c-remove-stale-state-cache(START-POINT HERE PPS-POINT)
c-remove-stale-state-cache-backwards(HERE)
c-restore-<>-properties(BEG END OLD-LEN)
c-safe-position(BUFPOS PAREN-STATE)
c-search-uplist-for-classkey(PAREN-STATE)
c-semi-get-near-cache-entry(HERE)
c-semi-pp-to-literal(HERE &optional NOT-IN-DELIMITER)
c-semi-put-near-cache-entry(HERE STATE)
c-shift-line-indentation(SHIFT-AMT)
c-state-balance-parens-backwards(HERE- HERE+ TOP)
c-state-cache-after-top-paren(&optional CACHE)
c-state-cache-lower-good-pos(HERE POS STATE)
c-state-cache-top-lparen(&optional CACHE)
c-state-cache-top-paren(&optional CACHE)
c-state-lit-beg(POS)
c-state-literal-at(HERE)
c-state-maybe-marker(PLACE MARKER)
c-state-pp-to-literal(FROM TO &optional NOT-IN-DELIMITER)
c-state-push-any-brace-pair(BRA+1 MACRO-START-OR-HERE)
c-state-safe-place(HERE)
c-syntactic-content(FROM TO PAREN-LEVEL)
c-syntactic-re-search-forward(REGEXP &optional BOUND NOERROR PAREN-LEVEL NOT-INSIDE-TOKEN LOOKBEHIND-SUBMATCH)
c-syntactic-skip-backward(SKIP-CHARS &optional LIMIT PAREN-LEVEL)
c-toggle-parse-state-debug(&optional ARG)
c-trim-found-types(BEG END OLD-LEN)
c-truncate-bs-cache(POS &rest IGNORE)
c-truncate-lit-pos-cache(POS)
c-unfind-type(NAME)
c-update-brace-stack(STACK FROM TO)
c-whack-state-after(BUFPOS PAREN-STATE)
c-whack-state-before(BUFPOS PAREN-STATE)

Defined faces (0)