DIRECTORY Rope, TextFind; TextReplace: CEDAR DEFINITIONS = { ROPE: TYPE = Rope.ROPE; RopeMap: TYPE = REF RopeMapRep; RopeMapRep: TYPE = RECORD [ Map: PROC [REF ANY, ROPE] RETURNS [ROPE], data: REF ANY _ NIL]; Apply: PROC [s: RopeMap, r: ROPE] RETURNS [mapped: ROPE]; id: RopeMap; addBrackets: RopeMap; Constant: PROC [result: ROPE] RETURNS [rm: RopeMap]; Cat: PROC [first, second: RopeMap] RETURNS [catted: RopeMap]; Layer: PROC [first, later: RopeMap] RETURNS [layered: RopeMap]; RopeMapFromPairs: PROC [PairList] RETURNS [RopeMap]; PairList: TYPE = LIST OF Pair; Pair: TYPE = RECORD [match, replace: ROPE, literal, addBounds: BOOL _ FALSE]; MapNamedSubfieldToMatch: PROC [finder: TextFind.Finder, lastMatchedRope: ROPE] RETURNS [rm: RopeMap]; MapByMatchToTemplate: PROC [finder: TextFind.Finder, template: ROPE] RETURNS [rm: RopeMap]; Nest: PROC [rm: RopeMap] RETURNS [nested: RopeMap]; SyntaxError: ERROR; NoMapping: SIGNAL [rm: RopeMap, from: ROPE] RETURNS [to: ROPE]; MatchAndSubstitute: PROC [pattern, against, template: ROPE] RETURNS [ROPE]; }. ²TextReplace.Mesa Copyright c 1986 by Xerox Corporation. All rights reserved. Last Edited by: Spreitzer, January 10, 1986 10:17:05 pm PST = {mapped _ s.Map[s.data, r]}; Map through first, then second. IF first declines (i.e., returns NIL), later is consulted. Returns a RopeMap that replaces every occurance of a match by its corresponding replace. If lastMatchedRope is what finder was last matched against (i.e., TextFind.SearchRope[rope: lastMatchedRope, ...]), this returns a RopeMap that maps the name of a named subpattern in the finder to the rope it matched in lastMatchedRope. Returns a mapper which: matches input against finder; if that succeeds, the mapper returns the template modified as if it were the Replacement field of the EditTool; otherwise, the mapper returns NIL. A thusly nested RopeMap parses its argument like the Replacement field of the EditTool. Where is found, it is replaced by what rm has for name. No metachars in name please. Quote character is single quote. May be raised from a nested RopeMapper (e.g., when last char of arg is quote, or arg has < without matching >). Raised from a nested RopeMapper if mapping is NIL. RESUME if you have a good idea. Κb– "cedar" style˜code™Kšœ Οmœ1™Kšœ‘œ™K™ —K˜šΠbl œžœ˜K™o—K˜š ’ œžœžœžœžœ˜?K™S—K˜Kš  œžœžœžœžœ˜KK˜K˜——…—. B