/[emacs]/emacs/lispref/syntax.texi
ViewVC logotype

Diff of /emacs/lispref/syntax.texi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.24 by rms, Mon Dec 24 18:01:56 2001 UTC revision 1.24.4.1 by miles, Fri Apr 4 06:20:42 2003 UTC
# Line 1  Line 1 
1  @c -*-texinfo-*-  @c -*-texinfo-*-
2  @c This is part of the GNU Emacs Lisp Reference Manual.  @c This is part of the GNU Emacs Lisp Reference Manual.
3  @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999  @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999
4  @c   Free Software Foundation, Inc.  @c   Free Software Foundation, Inc.
5  @c See the file elisp.texi for copying conditions.  @c See the file elisp.texi for copying conditions.
6  @setfilename ../info/syntax  @setfilename ../info/syntax
7  @node Syntax Tables, Abbrevs, Searching and Matching, Top  @node Syntax Tables, Abbrevs, Searching and Matching, Top
# Line 594  expression prefix syntax class, and char Line 594  expression prefix syntax class, and char
594  @section Parsing Balanced Expressions  @section Parsing Balanced Expressions
595    
596    Here are several functions for parsing and scanning balanced    Here are several functions for parsing and scanning balanced
597  expressions, also known as @dfn{sexps}, in which parentheses match in  expressions, also known as @dfn{sexps}.  Basically, a sexp is either a
598  pairs.  The syntax table controls the interpretation of characters, so  balanced parenthetical grouping, or a symbol name (a sequence of
599  these functions can be used for Lisp expressions when in Lisp mode and  characters whose syntax is either word constituent or symbol
600  for C expressions when in C mode.  @xref{List Motion}, for convenient  constituent).  However, characters whose syntax is expression prefix
601    are treated as part of the sexp if they appear next to it.
602    
603      The syntax table controls the interpretation of characters, so these
604    functions can be used for Lisp expressions when in Lisp mode and for C
605    expressions when in C mode.  @xref{List Motion}, for convenient
606  higher-level functions for moving over balanced expressions.  higher-level functions for moving over balanced expressions.
607    
608  A syntax table only describes how each character changes the state of    A syntax table only describes how each character changes the state
609  the parser, rather than describing the state itself.  For example, a string  of the parser, rather than describing the state itself.  For example,
610  delimiter character toggles the parser state between ``in-string'' and  a string delimiter character toggles the parser state between
611  ``in-code'' but the characters inside the string do not have any particular  ``in-string'' and ``in-code'' but the characters inside the string do
612  syntax to identify them as such.  not have any particular syntax to identify them as such.  For example
613    (note that 15 is the syntax code for generic string delimiters),
 For example (note: 15 is the syntax-code of generic string delimiters):  
614    
615  @example  @example
616  (put-text-property 1 9 'syntax-table '(15 . nil))  (put-text-property 1 9 'syntax-table '(15 . nil))
617  @end example  @end example
618    
619    @noindent
620  does not tell Emacs that the first eight chars of the current buffer  does not tell Emacs that the first eight chars of the current buffer
621  are a string, but rather that they are all string delimiters and thus  are a string, but rather that they are all string delimiters.  As a
622  Emacs should treat them as four adjacent empty strings.  result, Emacs treats them as four consecutive empty string constants.
623    
624  The state of the parser is transient (i.e. not stored in the buffer for    Every time you use the parser, you specify it a starting state as
625  example).  Instead, every time the parser is used, it is given not just  well as a starting position.  If you omit the starting state, the
626  a starting position but a starting state.  If the starting state is not  default is ``top level in parenthesis structure,'' as it would be at
627  specified explicitly, Emacs assumes we are at the top level of parenthesis  the beginning of a function definition.  (This is the case for
628  structure, such as the beginning of a function definition (this is the case  @code{forward-sexp}, which blindly assumes that the starting point is
629  for @code{forward-sexp} which blindly assumes that the starting point is in  in such a state.)
 such a state.)  
630    
631  @defun parse-partial-sexp start limit &optional target-depth stop-before state stop-comment  @defun parse-partial-sexp start limit &optional target-depth stop-before state stop-comment
632  This function parses a sexp in the current buffer starting at  This function parses a sexp in the current buffer starting at
# Line 660  The result is a list of nine elements de Line 664  The result is a list of nine elements de
664  the parse:  the parse:
665    
666  @enumerate 0  @enumerate 0
667  @item  @item
668  The depth in parentheses, counting from 0.  The depth in parentheses, counting from 0.
669    
670  @item  @item
671  @cindex innermost containing parentheses  @cindex innermost containing parentheses
672  The character position of the start of the innermost parenthetical  The character position of the start of the innermost parenthetical
673  grouping containing the stopping point; @code{nil} if none.  grouping containing the stopping point; @code{nil} if none.
674    
675  @item  @item
676  @cindex previous complete subexpression  @cindex previous complete subexpression
677  The character position of the start of the last complete subexpression  The character position of the start of the last complete subexpression
678  terminated; @code{nil} if none.  terminated; @code{nil} if none.
679    
680  @item  @item
681  @cindex inside string  @cindex inside string
682  Non-@code{nil} if inside a string.  More precisely, this is the  Non-@code{nil} if inside a string.  More precisely, this is the
683  character that will terminate the string, or @code{t} if a generic  character that will terminate the string, or @code{t} if a generic
684  string delimiter character should terminate it.  string delimiter character should terminate it.
685    
686  @item  @item
687  @cindex inside comment  @cindex inside comment
688  @code{t} if inside a comment (of either style),  @code{t} if inside a comment (of either style),
689  or the comment nesting level if inside a kind of comment  or the comment nesting level if inside a kind of comment
690  that can be nested.  that can be nested.
691    
692  @item  @item
693  @cindex quote character  @cindex quote character
694  @code{t} if point is just after a quote character.  @code{t} if point is just after a quote character.
695    
696  @item  @item
697  The minimum parenthesis depth encountered during this scan.  The minimum parenthesis depth encountered during this scan.
698    
699  @item  @item

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.24.4.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26