In addition to the classes, entries for characters in a syntax table can specify flags. There are seven possible flags, represented by the characters ‘1’, ‘2’, ‘3’, ‘4’, ‘b’, ‘n’, and ‘p’.
All the flags except ‘n’ and ‘p’ are used to describe multi-character comment delimiters. The digit flags indicate that a character can also be part of a comment sequence, in addition to the syntactic properties associated with its character class. The flags are independent of the class and each other for the sake of characters such as ‘*’ in C mode, which is a punctuation character, and the second character of a start-of-comment sequence (‘/*’), and the first character of an end-of-comment sequence (‘*/’).
Here is a table of the possible flags for a character c, and what they mean:
Emacs supports two comment styles simultaneously in any one syntax table. This is for the sake of C++. Each style of comment syntax has its own comment-start sequence and its own comment-end sequence. Each comment must stick to one style or the other; thus, if it starts with the comment-start sequence of style “b,” it must also end with the comment-end sequence of style “b.”
The two comment-start sequences must begin with the same character; only the second character may differ. Mark the second character of the “b”-style comment-start sequence with the ‘b’ flag.
A comment-end sequence (one or two characters) applies to the “b” style if its first character has the ‘b’ flag set; otherwise, it applies to the “a” style.
The appropriate comment syntax settings for C++ are as follows:
This defines four comment-delimiting sequences:
backward-prefix-chars moves back over these
characters, as well as over characters whose primary syntax class is
prefix (‘'’). See Motion and Syntax.