<> <> <> DIRECTORY IO, IOUtils, Rope, StructuredStreams; StructuredStreamsTest: CEDAR PROGRAM IMPORTS IO, SS:StructuredStreams = BEGIN Parse: PROC [from, to: IO.STREAM] RETURNS [level: INTEGER] = { level _ 0; WHILE NOT from.EndOf[] DO c: CHAR _ from.GetChar[]; SELECT c FROM '{ => {SS.Begin[to]; level _ level + 1}; '} => {SS.End[to]; level _ level - 1}; '< => { cond: SS.BreakCondition = SELECT from.GetChar[] FROM 'w => width, 'l => lookLeft, 'u => united, 'a => always, ENDCASE => ERROR; offset: INTEGER = from.GetInt[]; sep: Rope.ROPE = from.GetRopeLiteral[]; SS.Bp[to, cond, offset, sep]; WHILE from.GetChar[] # '> DO NULL ENDLOOP; }; ENDCASE => to.PutChar[c]; ENDLOOP; level _ level; }; END.