diff options
| author | Stefan Monnier | 2001-10-12 01:31:01 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2001-10-12 01:31:01 +0000 |
| commit | 45493fb79eeeaf4ed11ccdbec09ce12222735b50 (patch) | |
| tree | f2179a05eaa918364df7efbbcf740e51012a6816 | |
| parent | 138399e684c1d14a3bcf09bbe9cdedb7610e54cf (diff) | |
| download | emacs-45493fb79eeeaf4ed11ccdbec09ce12222735b50.tar.gz emacs-45493fb79eeeaf4ed11ccdbec09ce12222735b50.zip | |
Try to explain syntax-tables a little bit more.
| -rw-r--r-- | lispref/syntax.texi | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lispref/syntax.texi b/lispref/syntax.texi index 6cf42f9454e..e4c0384ccff 100644 --- a/lispref/syntax.texi +++ b/lispref/syntax.texi | |||
| @@ -600,6 +600,30 @@ these functions can be used for Lisp expressions when in Lisp mode and | |||
| 600 | for C expressions when in C mode. @xref{List Motion}, for convenient | 600 | for C expressions when in C mode. @xref{List Motion}, for convenient |
| 601 | higher-level functions for moving over balanced expressions. | 601 | higher-level functions for moving over balanced expressions. |
| 602 | 602 | ||
| 603 | A syntax table only describes how each character changes the state of | ||
| 604 | the parser, rather than describing the state itself. For example, a string | ||
| 605 | delimiter character toggles the parser state between ``in-string'' and | ||
| 606 | ``in-code'' but the characters inside the string do not have any particular | ||
| 607 | syntax to identify them as such. | ||
| 608 | |||
| 609 | For example (note: 15 is the syntax-code of generic string delimiters): | ||
| 610 | |||
| 611 | @example | ||
| 612 | (put-text-property 1 9 'syntax-table '(15 . nil)) | ||
| 613 | @end example | ||
| 614 | |||
| 615 | does not tell Emacs that the first eight chars of the current buffer | ||
| 616 | are a string, but rather that they are all string delimiters and thus | ||
| 617 | Emacs should treat them as four adjacent empty strings. | ||
| 618 | |||
| 619 | The state of the parser is transient (i.e. not stored in the buffer for | ||
| 620 | example). Instead, every time the parser is used, it is given not just | ||
| 621 | a starting position but a starting state. If the starting state is not | ||
| 622 | specified explicitly, Emacs assumes we are at the top level of parenthesis | ||
| 623 | structure, such as the beginning of a function definition (this is the case | ||
| 624 | for @code{forward-sexp} which blindly assumes that the starting point is in | ||
| 625 | such a state.) | ||
| 626 | |||
| 603 | @defun parse-partial-sexp start limit &optional target-depth stop-before state stop-comment | 627 | @defun parse-partial-sexp start limit &optional target-depth stop-before state stop-comment |
| 604 | This function parses a sexp in the current buffer starting at | 628 | This function parses a sexp in the current buffer starting at |
| 605 | @var{start}, not scanning past @var{limit}. It stops at position | 629 | @var{start}, not scanning past @var{limit}. It stops at position |