Next: Multiline Macro Symbols, Previous: Paren List Symbols, Up: Syntactic Symbols

#### 10.2.8 Comment String Label and Macro Symbols

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:

- Line 2 is assigned the `func-decl-cont` syntax.
- Line 4 is assigned both `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.
- Line 5 is assigned `c` syntax.
- Line 6 which, even though it contains nothing but whitespace, is assigned `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.
- Line 8 is assigned `string` syntax.
- Line 10 is assigned `label` syntax.
- Line 11 is assigned `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.
- Lines 12 and 14 are assigned `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.
- Line 17 is assigned `stream-op` syntax.