diff options
Diffstat (limited to 'doc/lispref/syntax.texi')
| -rw-r--r-- | doc/lispref/syntax.texi | 91 |
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 |
| 295 | can specify flags. There are seven possible flags, represented by the | 295 | can specify flags. There are eight possible flags, represented by the |
| 296 | characters @samp{1}, @samp{2}, @samp{3}, @samp{4}, @samp{b}, @samp{n}, | 296 | characters @samp{1}, @samp{2}, @samp{3}, @samp{4}, @samp{b}, @samp{c}, |
| 297 | and @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 |
| 300 | multi-character comment delimiters. The digit flags indicate that a | 300 | delimiters. The digit flags are used for comment delimiters made up |
| 301 | character can @emph{also} be part of a comment sequence, in addition to | 301 | of 2 characters. They indicate that a character can @emph{also} be |
| 302 | the syntactic properties associated with its character class. The flags | 302 | part of a comment sequence, in addition to the syntactic properties |
| 303 | are independent of the class and each other for the sake of characters | 303 | associated with its character class. The flags are independent of the |
| 304 | such as @samp{*} in C mode, which is a punctuation character, @emph{and} | 304 | class and each other for the sake of characters such as @samp{*} in |
| 305 | the second character of a start-of-comment sequence (@samp{/*}), | 305 | C mode, which is a punctuation character, @emph{and} the second |
| 306 | @emph{and} the first character of an end-of-comment sequence | 306 | character of a start-of-comment sequence (@samp{/*}), @emph{and} the |
| 307 | (@samp{*/}). | 307 | first character of an end-of-comment sequence (@samp{*/}). The flags |
| 308 | @samp{b}, @samp{c}, and @samp{n} are used to qualify the corresponding | ||
| 309 | comment 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}, |
| 310 | and what they mean: | 312 | and 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 |
| 330 | alternative ``b'' comment style. | 331 | alternative ``b'' comment style. For a two-character comment starter, |
| 332 | this flag is only significant on the second char, and for a 2-character | ||
| 333 | comment ender it is only significant on the first char. | ||
| 331 | 334 | ||
| 332 | Emacs supports two comment styles simultaneously in any one syntax | 335 | @item |
| 333 | table. 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 |
| 334 | its own comment-start sequence and its own comment-end sequence. Each | 337 | alternative ``c'' comment style. For a two-character comment |
| 335 | comment must stick to one style or the other; thus, if it starts with | 338 | delimiter, @samp{c} on either character makes it of style ``c''. |
| 336 | the comment-start sequence of style ``b,'' it must also end with the | ||
| 337 | comment-end sequence of style ``b.'' | ||
| 338 | 339 | ||
| 339 | The two comment-start sequences must begin with the same character; only | 340 | @item |
| 340 | the 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. | 342 | that this kind of comment can be nested. For a two-character |
| 343 | comment delimiter, @samp{n} on either character makes it | ||
| 344 | nestable. | ||
| 342 | 345 | ||
| 343 | A comment-end sequence (one or two characters) applies to the ``b'' | 346 | Emacs supports several comment styles simultaneously in any one syntax |
| 344 | style if its first character has the @samp{b} flag set; otherwise, it | 347 | table. A comment style is a set of flags @samp{b}, @samp{c}, and |
| 345 | applies to the ``a'' style. | 348 | @samp{n}, so there can be up to 8 different comment styles. |
| 349 | Each comment delimiter has a style and only matches comment delimiters | ||
| 350 | of the same style. Thus if a comment starts with the comment-start | ||
| 351 | sequence of style ``bn'', it will extend until the next matching | ||
| 352 | comment-end sequence of style ``bn''. | ||
| 346 | 353 | ||
| 347 | The appropriate comment syntax settings for C++ are as follows: | 354 | The 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 | ||
| 358 | This defines four comment-delimiting sequences: | 365 | This defines four comment-delimiting sequences: |
| 359 | 366 | ||
| 360 | @table @asis | 367 | @table @asis |
| 361 | @item @samp{/*} | 368 | @item @samp{/*} |
| 362 | This is a comment-start sequence for ``a'' style because the | 369 | This is a comment-start sequence for ``b'' style because the |
| 363 | second character, @samp{*}, does not have the @samp{b} flag. | 370 | second character, @samp{*}, has the @samp{b} flag. |
| 364 | 371 | ||
| 365 | @item @samp{//} | 372 | @item @samp{//} |
| 366 | This is a comment-start sequence for ``b'' style because the second | 373 | This is a comment-start sequence for ``a'' style because the second |
| 367 | character, @samp{/}, does have the @samp{b} flag. | 374 | character, @samp{/}, does not have the @samp{b} flag. |
| 368 | 375 | ||
| 369 | @item @samp{*/} | 376 | @item @samp{*/} |
| 370 | This is a comment-end sequence for ``a'' style because the first | 377 | This is a comment-end sequence for ``b'' style because the first |
| 371 | character, @samp{*}, does not have the @samp{b} flag. | 378 | character, @samp{*}, does have the @samp{b} flag. |
| 372 | 379 | ||
| 373 | @item newline | 380 | @item newline |
| 374 | This is a comment-end sequence for ``b'' style, because the newline | 381 | This is a comment-end sequence for ``a'' style, because the newline |
| 375 | character has the @samp{b} flag. | 382 | character 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 | ||
| 380 | that this kind of comment can be nested. For a two-character | ||
| 381 | comment delimiter, @samp{n} on either character makes it | ||
| 382 | nestable. | ||
| 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. |
| 387 | These characters are treated as whitespace when they appear between | 388 | These characters are treated as whitespace when they appear between |