This section is a complete list of the syntactic symbols which appear
in the c-offsets-alist
style variable, along with brief
descriptions. The previous section (see Syntactic Analysis)
states what syntactic symbols are and how the indentation engine uses
them.
More detailed descriptions of these symbols, together with snippets of source code to which they apply, appear in the examples in the subsections below. Note that, in the interests of brevity, the anchor position associated with most syntactic symbols is not specified. In cases of doubt, type C-c C-s on a pertinent line—this highlights the anchor position.
The syntactic symbols which indicate brace constructs follow a general
naming convention. When a line begins with an open or close brace,
its syntactic symbol will contain the suffix -open
or
-close
respectively. The first line within the brace block
construct will contain the suffix -block-intro
.
In constructs which can span several lines, a distinction is usually
made between the first line that introduces the construct and the
lines that continue it. The syntactic symbols that indicate these
lines will contain the suffixes -intro
or -cont
respectively.
The best way to understand how all this works is by looking at some examples. Remember that you can see the syntax of any source code line by using C-c C-s.
string
Inside a multiline string. Comment String Label and Macro Symbols.
c
Inside a multiline C style block comment. Comment String Label and Macro Symbols.
defun-open
Brace that opens a top-level function definition. Function Symbols.
defun-close
Brace that closes a top-level function definition. Function Symbols.
defun-block-intro
The first line in a top-level defun. Function Symbols.
class-open
Brace that opens a class definition. Class related Symbols.
class-close
Brace that closes a class definition. Class related Symbols.
inline-open
Brace that opens an in-class inline method. Class related Symbols.
inline-close
Brace that closes an in-class inline method. Class related Symbols.
func-decl-cont
The region between a function definition’s argument list and the
function opening brace (excluding K&R argument declarations). In C,
you cannot put anything but whitespace and comments in this region,
however in C++ and Java, throws
declarations and other things
can appear here. Comment String Label and Macro Symbols.
knr-argdecl-intro
First line of a K&R C argument declaration. K&R Symbols.
knr-argdecl
Subsequent lines in a K&R C argument declaration. K&R Symbols.
topmost-intro
The first line in a “topmost” definition. Function Symbols.
topmost-intro-cont
Topmost definition continuation lines. This is only used in the parts
that aren’t covered by other symbols such as func-decl-cont
and
knr-argdecl
. Function Symbols.
constraint-cont
Continuation line of a topmost C++20 concept or requires clause. C++ Constraint Symbols.
annotation-top-cont
Topmost definition continuation lines where all previous items are annotations. Java Symbols.
member-init-intro
First line in a member initialization list. Class related Symbols.
member-init-cont
Subsequent member initialization list lines. Class related Symbols.
inher-intro
First line of a multiple inheritance list. Class related Symbols.
inher-cont
Subsequent multiple inheritance lines. Class related Symbols.
block-open
Statement block open brace. Comment String Label and Macro Symbols.
block-close
Statement block close brace. Conditional Construct Symbols.
brace-list-open
Open brace of an enum or static array list. Brace List Symbols.
brace-list-close
Close brace of an enum or static array list. Brace List Symbols.
brace-list-intro
First line after the opening ‘{’ in an enum or static array list. Brace List Symbols.
brace-list-entry
Subsequent lines in an enum or static array list. Brace List Symbols.
brace-entry-open
Subsequent lines in an enum or static array list where the line begins with an open brace. Brace List Symbols.
statement
A statement. Function Symbols.
statement-cont
A continuation of a statement. Function Symbols.
annotation-var-cont
A continuation of a statement where all previous items are annotations. Java Symbols.
statement-block-intro
The first line in a new statement block. Conditional Construct Symbols.
statement-case-intro
The first line in a case block. Switch Statement Symbols.
statement-case-open
The first line in a case block that starts with a brace. Switch Statement Symbols.
substatement
The first line after a conditional or loop construct. Conditional Construct Symbols.
substatement-open
The brace that opens a substatement block. Conditional Construct Symbols.
substatement-label
The first line after a conditional or loop construct if it’s a label. Conditional Construct Symbols.
case-label
A label in a switch
block. Switch Statement Symbols.
access-label
C++ access control label. Class related Symbols.
label
Any other label. Comment String Label and Macro Symbols.
do-while-closure
The while
line that ends a do
-while
construct.
Conditional Construct Symbols.
else-clause
The else
line of an if
-else
construct.
Conditional Construct Symbols.
catch-clause
The catch
or finally
(in Java) line of a
try
-catch
construct. Conditional Construct Symbols.
comment-intro
A line containing only a comment introduction. Comment String Label and Macro Symbols.
arglist-intro
The first line in an argument list. Parenthesis (Argument) List Symbols.
arglist-cont
Subsequent argument list lines when no arguments follow on the same line as the arglist opening paren. Parenthesis (Argument) List Symbols.
arglist-cont-nonempty
Subsequent argument list lines when at least one argument follows on the same line as the arglist opening paren. Parenthesis (Argument) List Symbols.
arglist-close
The solo close paren of an argument list. Parenthesis (Argument) List Symbols.
stream-op
Lines continuing a stream operator (C++ only). Comment String Label and Macro Symbols.
inclass
The line is nested inside a class definition. Class related Symbols.
cpp-macro
The start of a preprocessor macro definition. Comment String Label and Macro Symbols.
cpp-define-intro
The first line inside a multiline preprocessor macro if
c-syntactic-indentation-in-macros
is set. Multiline Macro Symbols.
cpp-macro-cont
All lines inside multiline preprocessor macros if
c-syntactic-indentation-in-macros
is nil
.
Multiline Macro Symbols.
friend
A C++ friend declaration. Class related Symbols.
objc-method-intro
The first line of an Objective-C method definition. Objective-C Method Symbols.
objc-method-args-cont
Lines continuing an Objective-C method definition. Objective-C Method Symbols.
objc-method-call-cont
Lines continuing an Objective-C method call. Objective-C Method Symbols.
extern-lang-open
Brace that opens an extern
block (e.g. extern "C"
{...}
). External Scope Symbols.
extern-lang-close
Brace that closes an extern
block. External Scope Symbols.
inextern-lang
Analogous to inclass
syntactic symbol, but used inside
extern
blocks. External Scope Symbols.
namespace-open
namespace-close
innamespace
These are analogous to the three extern-lang
symbols above, but
are returned for C++ namespace blocks. External Scope Symbols.
module-open
module-close
inmodule
Analogous to the above, but for CORBA IDL module
blocks.
External Scope Symbols.
composition-open
composition-close
incomposition
Analogous to the above, but for CORBA CIDL composition
blocks.
External Scope Symbols.
template-args-cont
C++ template argument list continuations. Class related Symbols.
inlambda
Analogous to inclass
syntactic symbol, but used inside lambda
(i.e. anonymous) functions. Used in C++ and Pike modes.
Statement Block Symbols.
lambda-intro-cont
Lines continuing the header of a lambda function, i.e. between the
lambda
keyword and the function body. Only used in Pike mode.
Statement Block Symbols.
inexpr-statement
A statement block inside an expression. The gcc C and C++ extension for this is recognized. It’s also used for the special functions that take a statement block as an argument in Pike. Statement Block Symbols.
inexpr-class
A class definition inside an expression. This is used for anonymous classes in Java. It’s also used for anonymous array initializers in Java. Java Symbols.