(*
  Title:	M2Lex
  $Header: M2Lex.def,v 1.2 84/12/04 12:38:04 mjj Exp $
  		Copyright (C) 1984 by Acorn Research Centre
*)

DEFINITION MODULE M2Lex;

EXPORT QUALIFIED
    Symbol, LStream, OpenStream, CloseStream, 
    NextSymbol, Accept, AcceptId, Skip, LineNumber;


TYPE
    Symbol = (Commasym, Semicolonsym, Definitionsym, Endfilesym,
        Fromsym, Identsym, Implementationsym, Importsym, Modulesym,
        Othersym);

    LStream;

PROCEDURE OpenStream (VAR s: LStream; name: ARRAY OF CHAR): BOOLEAN;
(* creates a stream from the file if the file is valid *)

PROCEDURE CloseStream (s: LStream);
(* deletes the stream and closes the File from which it is built *)

PROCEDURE NextSymbol (s: LStream; VAR id: ARRAY OF CHAR): Symbol;
(* returns the next symbol in the file and its value if identsym *)

PROCEDURE Accept (s: LStream; sym: Symbol): BOOLEAN;
(* tries to read a symbol of type sym from the file *)

PROCEDURE AcceptId (s: LStream; VAR id: ARRAY OF CHAR): BOOLEAN;
(* tries to read an identsym from the file, returning its value *)

PROCEDURE Skip (s: LStream; sym: Symbol);
(* tries to read up to and including the first occurrence of a sym *)

PROCEDURE LineNumber(s: LStream): CARDINAL;
(* returns current line number on stream 's' *)


END M2Lex.

(*
$Log:	M2Lex.def,v $
Revision 1.2  84/12/04  12:38:04  mjj
Added PROCEDURE LineNumber for error messages

Revision 1.1  84/11/30  16:11:40  mjj
Initial revision

*)

