StructuredStreamsTest.Mesa
last edited by Spreitzer September 19, 1985 5:16:06 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};
'< => {
united: BOOL ← from.GetBool[];
offset: INTEGER ← from.GetInt[];
SS.Bp[to, united, offset];
WHILE from.GetChar[] # '> DO NULL ENDLOOP;
};
ENDCASE => to.PutChar[c];
ENDLOOP;
level ← level;
};
END.