Next: Multiline Macro Symbols, Previous: Paren List Symbols, Up: Syntactic Symbols [Index]
A few miscellaneous syntactic symbols that haven’t been previously covered are illustrated by this C++ example:
1: void Bass::play( int volume ) 2: const 3: { 4: /* this line starts a multiline 5: * comment. This line should get `c' syntax */ 6: 7: char* a_multiline_string = "This line starts a multiline \ 8: string. This line should get `string' syntax."; 9: 10: note: 11: { 12: #ifdef LOCK 13: Lock acquire(); 14: #endif // LOCK 15: slap_pop(); 16: cout << "I played " 17: << "a note\n"; 18: } 19: }
The lines to note in this example include:
func-decl-cont
syntax.
defun-block-intro
and
comment-intro
syntax. A syntactic element with
comment-intro
has no anchor point — It is always accompanied
by another syntactic element which does have one.
c
syntax.
defun-block-intro
. Note that the appearance of the
comment on lines 4 and 5 do not cause line 6 to be assigned
statement
syntax because comments are considered to be
syntactic whitespace, which are ignored when analyzing
code.
string
syntax.
label
syntax.
block-open
as well as statement
syntax. A block-open
syntactic element doesn’t have an anchor
position, since it always appears with another syntactic element which
does have one.
cpp-macro
syntax in addition to the
normal syntactic symbols (statement-block-intro
and
statement
, respectively). Normally cpp-macro
is
configured to cancel out the normal syntactic context to make all
preprocessor directives stick to the first column, but that’s easily
changed if you want preprocessor directives to be indented like the rest
of the code. Like comment-intro
, a syntactic element with
cpp-macro
doesn’t contain an anchor position.
stream-op
syntax.
Next: Multiline Macro Symbols, Previous: Paren List Symbols, Up: Syntactic Symbols [Index]