<> <> <> <> <> DIRECTORY Commander USING [ CommandProc, Register ], IO USING [ GetTokenRope, IDProc, PutF, RIS, STREAM ], OneCasabaParser USING [ GetReportStream ], Rope USING [ ROPE ], SaffronATDef USING [ ModulePNode, ModulePVal ], SaffronBaseDef USING [ CreateEmptyEnvironment, EnvironmentNode, InterfaceValNode, ReadDefFile ], SaffronContext USING [ ErrorSignal, ShowEnvironment ], ThreeC4Support USING [ GetReportStream ]; SaffronDriver: CEDAR MONITOR IMPORTS SaffronATDef, SaffronBaseDef, Commander, IO, OneCasabaParser, SaffronContext, ThreeC4Support ~ { debugFlags: CARDINAL _ 0; SaffronCompiler: Commander.CommandProc ~ { ENABLE { ThreeC4Support.GetReportStream => RESUME[cmd.out]; OneCasabaParser.GetReportStream => { result _ $Failure; RESUME[cmd.out] }; }; <> args: IO.STREAM _ IO.RIS[cmd.commandLine]; fname: Rope.ROPE _ IO.GetTokenRope[args, IO.IDProc].token; root: SaffronATDef.ModulePNode _ SaffronATDef.ModulePVal[SaffronBaseDef.ReadDefFile[fname]]; env: SaffronBaseDef.EnvironmentNode _ NIL; if: SaffronBaseDef.InterfaceValNode _ NIL; result _ $Success; -- bad assumption? IF ( result = $Failure ) THEN { IO.PutF[cmd.out, "Syntax Errors Detected.\n"]; RETURN; } ELSE { IO.PutF[cmd.out, "No Syntax Errors Detected.\n"]; }; [env, if] _ root.procs.MakeEnvironment[root, "ShouldBeAFileName", SaffronBaseDef.CreateEmptyEnvironment[] ! SaffronContext.ErrorSignal => { ERROR }; ]; SaffronContext.ShowEnvironment[cmd.out, 0, env]; }; Commander.Register["Saffron", SaffronCompiler]; }.