--September 6, 1982 12:25 am
-- ParseWindow.mesa
-- Last Edited by: Gnelson, November 3, 1983 3:17 pm

DIRECTORY Atom, ViewerClasses, Parser, Rope, ParserGen;

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,
  productions: ParserGen.ProdList, -- used for well-formedness check 
  grammerfilename: Rope.ROPE,  -- contains BNF equations
  content: LIST OF NodeContent,
  contentValid: BOOL];

GenerateParser: PROC [h: Handle];
-- sets h.ph and h.productions from h.grammerfilename

NodeContent: TYPE = RECORD [text1: ROPE, text2: ROPE, tree: REF ANY];
-- the tree is the parse of the concatenation of text1 and text2.

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. 

OperatorType: TYPE = {infix, matchfix, subfixMatchfix, prefix, infixPrefix, closefix};
  
END.