CharOpsImpl.mesa
Copyright Ó 1991, 1992 by Xerox Corporation. All rights reserved.
Doug Wyatt, October 17, 1991 4:01 pm PDT
DIRECTORY
CharOps USING [CharPropertyTable],
Rope USING [ROPE, Map, ActionType];
CharOpsImpl: CEDAR PROGRAM
IMPORTS Rope
EXPORTS CharOps
= BEGIN
punctuationString: Rope.ROPE ~ "!@#$%~&*()-—`=+[{]};:'\",.<>/?\\|←^¬­";
CharPropertyTable: TYPE ~ CharOps.CharPropertyTable;
charPropertyTable: PUBLIC REF READONLY CharPropertyTable ¬ InitCharPropertyTable[];
InitCharPropertyTable: PROC RETURNS [REF CharPropertyTable] = {
cpt: REF CharPropertyTable ¬ NEW[CharPropertyTable ¬ ALL[other]];
punctuationChar: Rope.ActionType ~ { cpt[c] ¬ punctuation };
cpt[' ] ¬ blank;
cpt['\t] ¬ blank;
cpt['\r] ¬ blank;
cpt['\l] ¬ blank;
FOR c: CHAR IN ['A..'Z] DO cpt[c] ¬ alphaNumeric ENDLOOP;
FOR c: CHAR IN ['a..'z] DO cpt[c] ¬ alphaNumeric ENDLOOP;
FOR c: CHAR IN ['0..'9] DO cpt[c] ¬ alphaNumeric ENDLOOP;
[] ¬ Rope.Map[base: punctuationString, action: punctuationChar];
RETURN[cpt];
};
END.