--September 6, 1982 12:25 am
-- ParseWindow.mesa
-- Last Edited by: Gnelson, March 20, 1983 5:11 pm
DIRECTORY Atom, ViewerClasses, Parser, Rope;
ParseWindow: DEFINITIONS
= BEGIN
ROPE: TYPE = Rope.ROPE;
Handle: TYPE = REF HandleRep;
NewHandle: PROC [v: ViewerClasses.Viewer]
RETURNS [h: Handle];
HandleRep: TYPE = RECORD [
ph: Parser.Handle,
viewer: ViewerClasses.Viewer,
WellFormed: SyntacticPredicate,
content: LIST OF NodeContent,
contentValid: BOOL];
NodeContent: TYPE = RECORD [text: ROPE, tree: REF ANY];
SyntacticPredicate: TYPE =
PROC [f: REF ANY] RETURNS [VerdictAndCulprit];
VerdictAndCulprit: TYPE =
RECORD [verdict: Verdict, culprit: REF ANY];
-- culprit relevant only if verdict is No or OfCourseNot
Verdict: TYPE = {Yes, No, OfCourseNot}; -- Yes == innocent
HasForm: PROC[f: REF ANY,
op: ATOM,
Arg1: SyntacticPredicate,
Arg2: SyntacticPredicate ← NIL]
RETURNS [VerdictAndCulprit];
-- HasForm tests if Car[f] is of the form (op x y) where x is
-- of the form Arg1 and y is of the form Arg2,
-- unless Arg2 = NIL in which case the test is for the
-- form (op x). It is assumed that Arg1 # NIL and
-- (Arg1 = NIL => Arg2 = NIL).
Or: PROC [aw1, aw2: VerdictAndCulprit]
RETURNS [r: VerdictAndCulprit];
ParseViewer: PUBLIC PROC [pw: Handle];
AddTree: PUBLIC PROC[pw: Handle, tree: REF];
-- unparses the tree, adds the text, and repaints the viewer.
AddOp: PROC[
h: Handle,
op: ROPE,
alias: ROPE, -- alternate form; op is preferred
bp: INTEGER,
f: OperatorType,
c: ROPE,
u: INT ← 0];
OperatorType: TYPE = {infix, matchfix, subfixMatchfix, prefix, infixPrefix, closefix};
END.