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; 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]; 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 Last Edited by: Spreitzer, December 18, 1984 6:25:56 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. 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. Κ– "cedar" style˜Icode™J™;K˜KšΟk œ˜K˜šΠbx œœ œ˜"K˜Kšœœœ˜K˜Kšœ œœ ˜šœ œœ˜KšΟnœœœœœœœ˜)Kšœœœœ˜—K˜š Ÿœœœœ œ˜9Kšœ™—K˜K˜ K˜K˜šŸœœœ˜=K™—K˜šŸœœœ˜?K™:—K˜šŸœœ œ ˜4Kšœ œœœ˜Kš œœœœœœ˜MK™X—K˜šŸœœ,œœ˜eKšœμ™μ—K˜šŸœœœ˜3K™WKšœΟbœ. œ™>Kšœ œ™K™ —K˜šΠbl œœ˜K™o—K˜š ‘ œœœœœ˜?K™S—K˜Kš Ÿœœœœœ˜KK˜K˜——…—œ ^