JunoOldParseWindow.mesa (ex OldParseWindow.mesa)
Coded September 6, 1982 12:25 am
Last Edited by: Gnelson, October 11, 1983 9:29 pm
Last Edited by: Stolfi, April 6, 1984 4:23:06 pm PST

Maintains a text viewer containing the current set of Juno procedures. Exports procedures that search this list and that append new procedures to it.

TO FIX: Everything.

DIRECTORY Atom, ViewerClasses, JunoNewParser, Rope;

JunoOldParseWindow: DEFINITIONS =

BEGIN

OPEN Parser: JunoNewParser;

ROPE
: TYPE = Rope.ROPE;

- - - - XXX

Moved here from JunoStorage on April 6, 1984 3:52:04 pm PST; need to be fixed!!!

GetBody: PUBLIC PROC [name: REF ANY] RETURNS [REF ANY];

GetLocals: PUBLIC PROC [name: REF ANY] RETURNS [REF ANY];

AddDef: PUBLIC PROC [name, locals, body: REF ANY]; -- adds to lambdaAlist the definition of name

- - - - XXX

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 [text1: ROPE, text2: 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.

AddText: PUBLIC PROC[pw: Handle, text1: ROPE, text2: ROPE];
adds a new last node to the viewer, with header text1 and body text2. Does not parse the viewer or alter pw.content. The idea is that text1 and text2 will have fields to be filled in by the user.

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.