MesaParserImpl.mesa
Copyright
Ó 1991 by Xerox Corporation. All rights reserved.
Michael Plass, September 6, 1991 0:09 am PDT
DIRECTORY MesaParser, MPTreeOps,
MPP1, Rope,
IO;
MesaParserImpl:
CEDAR
PROGRAM
IMPORTS MPTreeOps,
MPP1
EXPORTS MesaParser
~
BEGIN
Note: Locking is done by the Initialize and Finalize routines.
Parse:
PUBLIC
PROC [program: Rope.
ROPE, errout:
IO.
STREAM]
RETURNS [root: MesaParser.Tree ¬
NIL, nTokens:
NAT ¬ 0, nErrors:
NAT ¬ 0] = {
complete:
BOOL ¬
FALSE;
MPTreeOps.Initialize[];
BEGIN
ENABLE
UNWIND => MPTreeOps.Finalize[];
[complete, nTokens, nErrors] ¬
MPP1.Parse[program, errout];
root ¬
IF complete
AND nErrors = 0
THEN MPTreeOps.PopTree[]
ELSE
NIL;
END;
MPTreeOps.Finalize[];
};
END.