aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2001-10-12 01:31:01 +0000
committerStefan Monnier2001-10-12 01:31:01 +0000
commit45493fb79eeeaf4ed11ccdbec09ce12222735b50 (patch)
treef2179a05eaa918364df7efbbcf740e51012a6816
parent138399e684c1d14a3bcf09bbe9cdedb7610e54cf (diff)
downloademacs-45493fb79eeeaf4ed11ccdbec09ce12222735b50.tar.gz
emacs-45493fb79eeeaf4ed11ccdbec09ce12222735b50.zip
Try to explain syntax-tables a little bit more.
-rw-r--r--lispref/syntax.texi24
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
600for C expressions when in C mode. @xref{List Motion}, for convenient 600for C expressions when in C mode. @xref{List Motion}, for convenient
601higher-level functions for moving over balanced expressions. 601higher-level functions for moving over balanced expressions.
602 602
603A syntax table only describes how each character changes the state of
604the parser, rather than describing the state itself. For example, a string
605delimiter character toggles the parser state between ``in-string'' and
606``in-code'' but the characters inside the string do not have any particular
607syntax to identify them as such.
608
609For 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
615does not tell Emacs that the first eight chars of the current buffer
616are a string, but rather that they are all string delimiters and thus
617Emacs should treat them as four adjacent empty strings.
618
619The state of the parser is transient (i.e. not stored in the buffer for
620example). Instead, every time the parser is used, it is given not just
621a starting position but a starting state. If the starting state is not
622specified explicitly, Emacs assumes we are at the top level of parenthesis
623structure, such as the beginning of a function definition (this is the case
624for @code{forward-sexp} which blindly assumes that the starting point is in
625such 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
604This function parses a sexp in the current buffer starting at 628This 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