[ < ] | [ > ] | [ << ] | [Plus haut] | [ >> ] | [Top] | [Table des matières] | [Index] | [ ? ] |
For syntactic analysis, such as in indentation, often the useful thing is to compute the syntactic state corresponding to a given buffer position. This function does that conveniently.
This function returns the parser state (see next section) that the parser
would reach at position pos starting from the beginning of the
buffer. This is equivalent to (parse-partial-sexp (point-min)
pos)
, except that syntax-ppss
uses a cache to speed up the
computation. Due to this optimization, the 2nd value (previous complete
subexpression) and 6th value (minimum parenthesis depth) of the returned
parser state are not meaningful.
syntax-ppss
automatically hooks itself to
before-change-functions
to keep its cache consistent. But updating
can fail if syntax-ppss
is called while
before-change-functions
is temporarily let-bound, or if the buffer is
modified without obeying the hook, such as when using
inhibit-modification-hooks
. For this reason, it is sometimes
necessary to flush the cache manually.
This function flushes the cache used by syntax-ppss
, starting at
position beg.
Major modes can make syntax-ppss
run faster by specifying where it
needs to start parsing.
If this is non-nil
, it should be a function that moves to an earlier
buffer position where the parser state is equivalent to nil
—in
other words, a position outside of any comment, string, or parenthesis.
syntax-ppss
uses it to further optimize its computations, when the
cache gives no help.
Ce document a été généré par Eric Reinbold le 13 Octobre 2007 en utilisant texi2html 1.78.