+ outward to the current buffer.
+
+ sjt sez:
+ This implementation has to rather inefficient, since it looks at
+ next-extent-change, and a heavily font-locked buffer will be rife
+ with irrelevant extents. We could do a sledgehammer check on this
+ by looking at the distribution of extent lengths. Also count up
+ cache hits and misses.
+
+ If we assume that syntax-table is a _text_ property (which also
+ deals with the issue of overlapping syntax-table properties), then
+ the following strategy recommends itself
+ o give the syntax cache a `valid' flag, to be reset whenever a
+ syntax-table property is added, changed, or removed; this could
+ be done by setting syntax_cache's prev_change > next_change
+ (but not compatible with using extents/markers here); if it's a
+ Lisp variable, doing it in Lisp shouldn't be too inefficient
+ o lazily initialize the cache whenever the object being examined
+ differs from the object the cache currently refers to
+ o by using {previous,next-single-property-change} we should be
+ able to get much bigger cache intervals (in most cases, the
+ whole buffer)
+ o cache markers instead of positions so the mere insertion or
+ deletion of text doesn't invalidate the cache, only if it
+ involves a syntax-table property (we could also cache the
+ extents carrying the syntax-table text-property; that gives us
+ another check for invalid cache).
+
+ If I understand this correctly, we need to invalidate the cache in the
+ following cases:
+ o If the referenced object changes (it's a global cache)
+ o If there are insertions or deletions of text (the positions are
+ absolute; fix: use markers or an extent instead?)
+ o If the syntax-table property is altered == added and different or
+ removed and the same (fix: probably computable from range overlap,
+ but is it worth it? would interact with ins/del); this includes
+ detachment of extents with the same value (but only the boundary
+ extents, as otherwise the range coalesces across the deletion point)
+ and attachment of extents with a different value
+ Note: the above looks a lot like what Ben has implemented in 21.5, but
+ he goes one better by making the cache buffer-local.
+
+ Note: cperl mode uses the text property API, not extents/overlays.
+*/
+
+#ifdef SYNTAX_CACHE_STATISTICS
+struct syntax_cache_statistics scs_statistics =
+ { 0, 0, 0, 0, -1, -1, 0.0, 0.0, scs_no_function};
+
+char* syntax_cache_statistics_function_names[scs_number_of_functions] = {
+ "find_context",
+ "find_defun_start",
+ "scan_words",
+ "Fforward_comment",
+ "scan_lists",
+ "Fbackward_prefix_characters",
+ "scan_sexps_forward"
+};
+#endif /* SYNTAX_CACHE_STATISTICS */