RegExpFind3Impl.mesa
Last Edited by: Nix, December 21, 1983 12:45 pm
DIRECTORY
TextFind,
RegExpFindPrivate USING [FinderRecord, Search],
TextEdit USING [GetRope, GetRuns],
TextNode USING [RefTextNode, Offset],
Rope USING [ROPE];
RegExpFind3Impl: CEDAR PROGRAM
IMPORTS TextEdit, RegExpFindPrivate
EXPORTS TextFind = {
OPEN RegExpFindPrivate;
Finder: TYPE = REF FinderRec;
FinderRec: PUBLIC TYPE = FinderRecord;
ROPE: TYPE = Rope.ROPE;
Offset: TYPE = TextNode.Offset;
RefTextNode: TYPE = TextNode.RefTextNode;
UnImplemented: ERROR = CODE;
SearchRopeBackwards:
PUBLIC
PROC [finder: Finder, rope:
ROPE,
start: Offset, len: Offset, interrupt: REF BOOL ← NIL]
RETURNS [found:
BOOLEAN, at, atEnd, before, after: Offset] = {
[found, at, atEnd, before, after] ←
RegExpFindPrivate.Search[finder, rope, NIL, start, len, FALSE, interrupt] };
TryBackwards:
PUBLIC
PROC [finder: Finder, text: RefTextNode,
start: Offset, len: Offset,
looksExact: BOOLEAN ← FALSE, interrupt: REF BOOL ← NIL]
RETURNS [found:
BOOLEAN, at, atEnd, before, after: Offset] = {
[found, at, atEnd, before, after] ←
RegExpFindPrivate.Search[finder, TextEdit.GetRope[text], TextEdit.GetRuns[text],
start, len, looksExact, interrupt] };
}.