TextFindPrivate.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
last edit by Bill Paxton, February 23, 1983 3:46 pm
Doug Wyatt, March 2, 1985 5:19:19 pm PST
Michael Plass, March 21, 1985 2:39:08 pm PST
DIRECTORY
LooksReader USING [Ref],
Rope USING [ROPE],
RopeReader USING [Ref],
RunReader USING [Ref],
TextLooks USING [Looks];
TextFindPrivate: CEDAR DEFINITIONS
= BEGIN
ROPE: TYPE = Rope.ROPE;
EightBit: CHAR = 200C;
CharMask: CHAR = 177C;
LegalCharacters: TYPE = CHAR[0C .. 177C];
anyStringPattern: CHAR = EightBit;
oneCharPattern: CHAR = EightBit + 1;
oneBlankPattern: CHAR = EightBit + 2;
oneNonBlankPattern: CHAR = EightBit + 3;
anyBlankPattern: CHAR = EightBit + 4;
anyNonBlankPattern: CHAR = EightBit + 5;
oneAlphaPattern: CHAR = EightBit + 6;
oneNonAlphaPattern: CHAR = EightBit + 7;
anyAlphaPattern: CHAR = EightBit + 8;
anyNonAlphaPattern: CHAR = EightBit + 9;
leftBracketPattern: CHAR = EightBit + 10;
rightBracketPattern: CHAR = EightBit + 11;
leftBoundaryPattern: CHAR = EightBit + 12;
rightBoundaryPattern: CHAR = EightBit + 13;
maxStringPattern: CHAR = EightBit + 14;
maxBlankPattern: CHAR = EightBit + 15;
maxNonBlankPattern: CHAR = EightBit + 16;
maxAlphaPattern: CHAR = EightBit + 17;
maxNonAlphaPattern: CHAR = EightBit + 18;
nopPattern: CHAR = EightBit+19;
MaxPatternLength: NAT = 1024;
TextStackArray: TYPE = RECORD[stack: SEQUENCE length: NAT OF INT];
PatternStackArray: TYPE = RECORD[stack: SEQUENCE length: NAT OF NAT];
LooksArray: TYPE = RECORD[looks: SEQUENCE length: NAT OF TextLooks.Looks];
NameArray: TYPE = RECORD [array: SEQUENCE length: NAT OF NameRec];
NameRec: TYPE = RECORD [name: ROPE, at, atEnd: INT, looks: TextLooks.Looks];
PatternArray: TYPE = RECORD [pat: SEQUENCE length: NAT OF PatRec];
PatRec: TYPE = RECORD [SELECT tag:* FROM
pattern => [char: CHAR],
not => [char: CHAR],
startname => [index: NAT],
endname => [index: NAT],
ENDCASE
];
anyStringPat: pattern PatRec = [pattern[anyStringPattern]];
anyAlphaPat: pattern PatRec = [pattern[anyAlphaPattern]];
anyNonAlphaPat: pattern PatRec = [pattern[anyNonAlphaPattern]];
anyBlankPat: pattern PatRec = [pattern[anyBlankPattern]];
anyNonBlankPat: pattern PatRec = [pattern[anyNonBlankPattern]];
leftBoundaryPat: pattern PatRec = [pattern[leftBoundaryPattern]];
rightBoundaryPat: pattern PatRec = [pattern[rightBoundaryPattern]];
nonPat: pattern PatRec = [pattern[0C]];
IsWord: PROC [rope: ROPE, at, atEnd: INT] RETURNS [BOOL];
Boundary: PROC [char: CHAR] RETURNS [BOOL]
= INLINE { RETURN [char = leftBoundaryPattern OR char = rightBoundaryPattern] };
Pat: PROC [p:PatRec] RETURNS [pp: pattern PatRec]
= INLINE { WITH p: p SELECT FROM pattern => pp ← p; ENDCASE => pp ← nonPat; };
FinderRecord: TYPE = RECORD [
stackSize: NAT ← 0,
patternPosStack: REF PatternStackArray,
textPosStack: REF TextStackArray,
textLenStack: REF TextStackArray,
patternArray: REF PatternArray,
length: NAT ← 0,
patternLooks: REF LooksArray,
nameArray: REF NameArray,
firstPatChar1, firstPatChar2, lastPatChar1, lastPatChar2: CHAR ← 377C,
ropeReader: RopeReader.Ref,
lksReader: LooksReader.Ref,
runReader: RunReader.Ref,
looks: TextLooks.Looks,
looksOnly: BOOLFALSE,
wordSearch: BOOLFALSE,
leftBracketSeen, rightBracketSeen: BOOLFALSE,
firstPatternCharIsNormal, lastPatternCharIsNormal: BOOLFALSE
];
END.