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, it is skipped over as whitespace. If a closing parenthesis immediately follows start (after skipping whitespace), then #f is returned. Otherwise, the matching position is the position before the first whitespace, parenthesis, quote, or comment 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 the match cache 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 comment is skipped as whitespace. 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 the match cache 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: