Mercurial > hg > xemacs-beta
comparison man/lispref/syntax.texi @ 444:576fb035e263 r21-2-37
Import from CVS: tag r21-2-37
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:36:19 +0200 |
parents | 376386a54a3c |
children | 1ccc32a20af4 |
comparison
equal
deleted
inserted
replaced
443:a8296e22da4e | 444:576fb035e263 |
---|---|
1 @c -*-texinfo-*- | 1 @c -*-texinfo-*- |
2 @c This is part of the XEmacs Lisp Reference Manual. | 2 @c This is part of the XEmacs Lisp Reference Manual. |
3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. | 3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. |
4 @c See the file lispref.texi for copying conditions. | 4 @c See the file lispref.texi for copying conditions. |
5 @setfilename ../../info/syntax.info | 5 @setfilename ../../info/syntax.info |
6 @node Syntax Tables, Abbrevs, Searching and Matching, Top | 6 @node Syntax Tables, Abbrevs, Searching and Matching, Top |
7 @chapter Syntax Tables | 7 @chapter Syntax Tables |
8 @cindex parsing | 8 @cindex parsing |
366 @section Syntax Table Functions | 366 @section Syntax Table Functions |
367 | 367 |
368 In this section we describe functions for creating, accessing and | 368 In this section we describe functions for creating, accessing and |
369 altering syntax tables. | 369 altering syntax tables. |
370 | 370 |
371 @defun make-syntax-table &optional table | 371 @defun make-syntax-table &optional oldtable |
372 This function creates a new syntax table. Character codes 0 through | 372 This function creates a new syntax table. Character codes 0 through |
373 31 and 128 through 255 are set up to inherit from the standard syntax | 373 31 and 128 through 255 are set up to inherit from the standard syntax |
374 table. The other character codes are set up by copying what the | 374 table. The other character codes are set up by copying what the |
375 standard syntax table says about them. | 375 standard syntax table says about them. |
376 | 376 |
377 Most major mode syntax tables are created in this way. | 377 Most major mode syntax tables are created in this way. |
378 @end defun | 378 @end defun |
379 | 379 |
380 @defun copy-syntax-table &optional table | 380 @defun copy-syntax-table &optional syntax-table |
381 This function constructs a copy of @var{table} and returns it. If | 381 This function constructs a copy of @var{syntax-table} and returns it. |
382 @var{table} is not supplied (or is @code{nil}), it returns a copy of the | 382 If @var{syntax-table} is not supplied (or is @code{nil}), it returns a |
383 current syntax table. Otherwise, an error is signaled if @var{table} is | 383 copy of the current syntax table. Otherwise, an error is signaled if |
384 not a syntax table. | 384 @var{syntax-table} is not a syntax table. |
385 @end defun | 385 @end defun |
386 | 386 |
387 @deffn Command modify-syntax-entry char syntax-descriptor &optional table | 387 @deffn Command modify-syntax-entry char-range syntax-descriptor &optional syntax-table |
388 This function sets the syntax entry for @var{char} according to | 388 This function sets the syntax entry for @var{char-range} according to |
389 @var{syntax-descriptor}. The syntax is changed only for @var{table}, | 389 @var{syntax-descriptor}. @var{char-range} is either a single character |
390 which defaults to the current buffer's syntax table, and not in any | 390 or a range of characters, as used with @code{put-char-table}. The syntax |
391 other syntax table. The argument @var{syntax-descriptor} specifies the | 391 is changed only for @var{syntax-table}, which defaults to the current |
392 desired syntax; this is a string beginning with a class designator | 392 buffer's syntax table, and not in any other syntax table. The argument |
393 character, and optionally containing a matching character and flags as | 393 @var{syntax-descriptor} specifies the desired syntax; this is a string |
394 well. @xref{Syntax Descriptors}. | 394 beginning with a class designator character, and optionally containing a |
395 matching character and flags as well. @xref{Syntax Descriptors}. | |
395 | 396 |
396 This function always returns @code{nil}. The old syntax information in | 397 This function always returns @code{nil}. The old syntax information in |
397 the table for this character is discarded. | 398 the table for @var{char-range} is discarded. |
398 | 399 |
399 An error is signaled if the first character of the syntax descriptor is not | 400 An error is signaled if the first character of the syntax descriptor is not |
400 one of the twelve syntax class designator characters. An error is also | 401 one of the twelve syntax class designator characters. |
401 signaled if @var{char} is not a character. | |
402 | 402 |
403 @example | 403 @example |
404 @group | 404 @group |
405 @exdent @r{Examples:} | 405 @exdent @r{Examples:} |
406 | 406 |
432 @result{} nil | 432 @result{} nil |
433 @end group | 433 @end group |
434 @end example | 434 @end example |
435 @end deffn | 435 @end deffn |
436 | 436 |
437 @defun char-syntax character | 437 @defun char-syntax character &optional syntax-table |
438 This function returns the syntax class of @var{character}, represented | 438 This function returns the syntax class of @var{character}, represented |
439 by its mnemonic designator character. This @emph{only} returns the | 439 by its mnemonic designator character. This @emph{only} returns the |
440 class, not any matching parenthesis or flags. | 440 class, not any matching parenthesis or flags. |
441 | 441 |
442 An error is signaled if @var{char} is not a character. | 442 An error is signaled if @var{character} is not a character. |
443 | |
444 The characters that correspond to various syntax codes | |
445 are listed in the documentation of @code{modify-syntax-entry}. | |
446 | |
447 Optional second argument @var{syntax-table} is the syntax table to be | |
448 used, and defaults to the current buffer's syntax table. | |
443 | 449 |
444 The following examples apply to C mode. The first example shows that | 450 The following examples apply to C mode. The first example shows that |
445 the syntax class of space is whitespace (represented by a space). The | 451 the syntax class of space is whitespace (represented by a space). The |
446 second example shows that the syntax of @samp{/} is punctuation. This | 452 second example shows that the syntax of @samp{/} is punctuation. This |
447 does not show the fact that it is also part of comment-start and -end | 453 does not show the fact that it is also part of comment-start and -end |
465 @result{} "(" | 471 @result{} "(" |
466 @end group | 472 @end group |
467 @end example | 473 @end example |
468 @end defun | 474 @end defun |
469 | 475 |
470 @defun set-syntax-table table &optional buffer | 476 @defun set-syntax-table syntax-table &optional buffer |
471 This function makes @var{table} the syntax table for @var{buffer}, which | 477 This function makes @var{syntax-table} the syntax table for @var{buffer}, which |
472 defaults to the current buffer if omitted. It returns @var{table}. | 478 defaults to the current buffer if omitted. It returns @var{syntax-table}. |
473 @end defun | 479 @end defun |
474 | 480 |
475 @defun syntax-table &optional buffer | 481 @defun syntax-table &optional buffer |
476 This function returns the syntax table for @var{buffer}, which defaults | 482 This function returns the syntax table for @var{buffer}, which defaults |
477 to the current buffer if omitted. | 483 to the current buffer if omitted. |
558 | 564 |
559 The result is a list of eight elements describing the final state of | 565 The result is a list of eight elements describing the final state of |
560 the parse: | 566 the parse: |
561 | 567 |
562 @enumerate 0 | 568 @enumerate 0 |
563 @item | 569 @item |
564 The depth in parentheses, counting from 0. | 570 The depth in parentheses, counting from 0. |
565 | 571 |
566 @item | 572 @item |
567 @cindex innermost containing parentheses | 573 @cindex innermost containing parentheses |
568 The character position of the start of the innermost parenthetical | 574 The character position of the start of the innermost parenthetical |
569 grouping containing the stopping point; @code{nil} if none. | 575 grouping containing the stopping point; @code{nil} if none. |
570 | 576 |
571 @item | 577 @item |
572 @cindex previous complete subexpression | 578 @cindex previous complete subexpression |
573 The character position of the start of the last complete subexpression | 579 The character position of the start of the last complete subexpression |
574 terminated; @code{nil} if none. | 580 terminated; @code{nil} if none. |
575 | 581 |
576 @item | 582 @item |
577 @cindex inside string | 583 @cindex inside string |
578 Non-@code{nil} if inside a string. More precisely, this is the | 584 Non-@code{nil} if inside a string. More precisely, this is the |
579 character that will terminate the string. | 585 character that will terminate the string. |
580 | 586 |
581 @item | 587 @item |
582 @cindex inside comment | 588 @cindex inside comment |
583 @code{t} if inside a comment (of either style). | 589 @code{t} if inside a comment (of either style). |
584 | 590 |
585 @item | 591 @item |
586 @cindex quote character | 592 @cindex quote character |
587 @code{t} if point is just after a quote character. | 593 @code{t} if point is just after a quote character. |
588 | 594 |
589 @item | 595 @item |
590 The minimum parenthesis depth encountered during this scan. | 596 The minimum parenthesis depth encountered during this scan. |
591 | 597 |
592 @item | 598 @item |
593 @code{t} if inside a comment of style ``b''. | 599 @code{t} if inside a comment of style ``b''. |
594 @end enumerate | 600 @end enumerate |