MrEd provides general-purpose ``parenthesis''-matching utilities that work on buffers. The utilities are paramerized with respect to:
A backslash (
) is assumed to be the (only) method for
escaping parenthesis, quote, and comment markers. The
parenthesis-balancing utilities are only guaranteed to act
meaningfully when the starting position is outside quoted and commented
expressions. When a pair of opening and closing brackets are not distinct,
the actions on these brackets are only meaningful for searches
starting outside the brackets.
Spaces immediately following start are skipped. If the text at start is an open parenthesis or open quote, then the matching position is the closing parenthesis or quote. If a comment immediately follows start, then the matching position is the end of the comment. If a closing parenthesis immediately follows start, then the matching position is start + 1. Otherwise, the matching position is the first whitespace or parenthesis character after start.
If cache is not #f, it must be an instance of
mred:match-cache%. A cache
object can be used to speed up successive calls to
mred:forwardward-match. However, a buffer using a cache
must call the cache's forward-invalidate method when the buffer is
modified. Different caches should be used for forward and backward
matching. See section
for more information.
The cache parameter is optional. It defaults to #f.
Spaces immediately preceding start are skipped. If the text at start is an close parenthesis or close quote, then the matching position is the openng parenthesis or quote. If a comment immediately precedes start, then the matching position is the start of the comment. If an opening parenthesis immediately precedes start, then the matching position is start - 1. Otherwise, the matching position is the first whitespace or parenthesis character before start.
If containing? is not #f, then the matching procedure is modified as follows:
If cache is not #f, it must be an instance of
mred:match-cache%. A cache
object can be used to speed up successive calls to
mred:backward-match. However, a buffer using a cache
must call the cache's invalidate method when the buffer is
modified. Different caches should be used for forward and backward
matching. See section
for more information.
The containg? and cache parameters are optional. They both default to #f.
The standard parenthesis, quote, and comment parameters for Scheme are defined in mred:scheme-paren-pairs, mred:scheme-quote-pairs, and mred:scheme-paren-comments. These lists are used to define Scheme-specific matching function: