StructuredStreamsTest.Mesa
last edited by Spreitzer September 19, 1985 5:16:06 pm PDT
Mike Spreitzer July 30, 1986 7:27:12 pm PDT
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.