aboutsummaryrefslogtreecommitdiffstats
path: root/doc/lispref/syntax.texi
diff options
context:
space:
mode:
Diffstat (limited to 'doc/lispref/syntax.texi')
-rw-r--r--doc/lispref/syntax.texi91
1 files changed, 46 insertions, 45 deletions
diff --git a/doc/lispref/syntax.texi b/doc/lispref/syntax.texi
index 9add9b76e79..a608db16f89 100644
--- a/doc/lispref/syntax.texi
+++ b/doc/lispref/syntax.texi
@@ -292,19 +292,21 @@ identifying them as generic string delimiters.
292@cindex syntax flags 292@cindex syntax flags
293 293
294 In addition to the classes, entries for characters in a syntax table 294 In addition to the classes, entries for characters in a syntax table
295can specify flags. There are seven possible flags, represented by the 295can specify flags. There are eight possible flags, represented by the
296characters @samp{1}, @samp{2}, @samp{3}, @samp{4}, @samp{b}, @samp{n}, 296characters @samp{1}, @samp{2}, @samp{3}, @samp{4}, @samp{b}, @samp{c},
297and @samp{p}. 297@samp{n}, and @samp{p}.
298 298
299 All the flags except @samp{n} and @samp{p} are used to describe 299 All the flags except @samp{p} are used to describe comment
300multi-character comment delimiters. The digit flags indicate that a 300delimiters. The digit flags are used for comment delimiters made up
301character can @emph{also} be part of a comment sequence, in addition to 301of 2 characters. They indicate that a character can @emph{also} be
302the syntactic properties associated with its character class. The flags 302part of a comment sequence, in addition to the syntactic properties
303are independent of the class and each other for the sake of characters 303associated with its character class. The flags are independent of the
304such as @samp{*} in C mode, which is a punctuation character, @emph{and} 304class and each other for the sake of characters such as @samp{*} in
305the second character of a start-of-comment sequence (@samp{/*}), 305C mode, which is a punctuation character, @emph{and} the second
306@emph{and} the first character of an end-of-comment sequence 306character of a start-of-comment sequence (@samp{/*}), @emph{and} the
307(@samp{*/}). 307first character of an end-of-comment sequence (@samp{*/}). The flags
308@samp{b}, @samp{c}, and @samp{n} are used to qualify the corresponding
309comment delimiter.
308 310
309 Here is a table of the possible flags for a character @var{c}, 311 Here is a table of the possible flags for a character @var{c},
310and what they mean: 312and what they mean:
@@ -325,63 +327,62 @@ sequence.
325@samp{4} means @var{c} is the second character of such a sequence. 327@samp{4} means @var{c} is the second character of such a sequence.
326 328
327@item 329@item
328@c Emacs 19 feature
329@samp{b} means that @var{c} as a comment delimiter belongs to the 330@samp{b} means that @var{c} as a comment delimiter belongs to the
330alternative ``b'' comment style. 331alternative ``b'' comment style. For a two-character comment starter,
332this flag is only significant on the second char, and for a 2-character
333comment ender it is only significant on the first char.
331 334
332Emacs supports two comment styles simultaneously in any one syntax 335@item
333table. This is for the sake of C++. Each style of comment syntax has 336@samp{c} means that @var{c} as a comment delimiter belongs to the
334its own comment-start sequence and its own comment-end sequence. Each 337alternative ``c'' comment style. For a two-character comment
335comment must stick to one style or the other; thus, if it starts with 338delimiter, @samp{c} on either character makes it of style ``c''.
336the comment-start sequence of style ``b,'' it must also end with the
337comment-end sequence of style ``b.''
338 339
339The two comment-start sequences must begin with the same character; only 340@item
340the second character may differ. Mark the second character of the 341@samp{n} on a comment delimiter character specifies
341``b''-style comment-start sequence with the @samp{b} flag. 342that this kind of comment can be nested. For a two-character
343comment delimiter, @samp{n} on either character makes it
344nestable.
342 345
343A comment-end sequence (one or two characters) applies to the ``b'' 346Emacs supports several comment styles simultaneously in any one syntax
344style if its first character has the @samp{b} flag set; otherwise, it 347table. A comment style is a set of flags @samp{b}, @samp{c}, and
345applies to the ``a'' style. 348@samp{n}, so there can be up to 8 different comment styles.
349Each comment delimiter has a style and only matches comment delimiters
350of the same style. Thus if a comment starts with the comment-start
351sequence of style ``bn'', it will extend until the next matching
352comment-end sequence of style ``bn''.
346 353
347The appropriate comment syntax settings for C++ are as follows: 354The appropriate comment syntax settings for C++ can be as follows:
348 355
349@table @asis 356@table @asis
350@item @samp{/} 357@item @samp{/}
351@samp{124b} 358@samp{124}
352@item @samp{*} 359@item @samp{*}
353@samp{23} 360@samp{23b}
354@item newline 361@item newline
355@samp{>b} 362@samp{>}
356@end table 363@end table
357 364
358This defines four comment-delimiting sequences: 365This defines four comment-delimiting sequences:
359 366
360@table @asis 367@table @asis
361@item @samp{/*} 368@item @samp{/*}
362This is a comment-start sequence for ``a'' style because the 369This is a comment-start sequence for ``b'' style because the
363second character, @samp{*}, does not have the @samp{b} flag. 370second character, @samp{*}, has the @samp{b} flag.
364 371
365@item @samp{//} 372@item @samp{//}
366This is a comment-start sequence for ``b'' style because the second 373This is a comment-start sequence for ``a'' style because the second
367character, @samp{/}, does have the @samp{b} flag. 374character, @samp{/}, does not have the @samp{b} flag.
368 375
369@item @samp{*/} 376@item @samp{*/}
370This is a comment-end sequence for ``a'' style because the first 377This is a comment-end sequence for ``b'' style because the first
371character, @samp{*}, does not have the @samp{b} flag. 378character, @samp{*}, does have the @samp{b} flag.
372 379
373@item newline 380@item newline
374This is a comment-end sequence for ``b'' style, because the newline 381This is a comment-end sequence for ``a'' style, because the newline
375character has the @samp{b} flag. 382character does not have the @samp{b} flag.
376@end table 383@end table
377 384
378@item 385@item
379@samp{n} on a comment delimiter character specifies
380that this kind of comment can be nested. For a two-character
381comment delimiter, @samp{n} on either character makes it
382nestable.
383
384@item
385@c Emacs 19 feature 386@c Emacs 19 feature
386@samp{p} identifies an additional ``prefix character'' for Lisp syntax. 387@samp{p} identifies an additional ``prefix character'' for Lisp syntax.
387These characters are treated as whitespace when they appear between 388These characters are treated as whitespace when they appear between