The reader used to initialize an RdLexer must be seekable, because the specification is that the reader must be positionned exactly after the last token received. To get tokens from standard input, use the SeekRd.Stdin() procedure to open a new seekable standard input stream. The Lexer calls a special procedure which discards old input when possible.
The following interface is IMPORT ed from parserlib :
INTERFACE SeekRd;
IMPORT Rd;
IMPORT Pathname;
IMPORT TextList;
TYPE
T = Rd.T;
PROCEDURE Open(p: Pathname.T; searchDirs: TextList.T := NIL): T;
(* Like FileRd.Open, but if the file cannot be openned then
print a meaningful error and exit. also see "E" below.
if searchDirs=NIL then assume p is a path,
otherwise try list of prefixes ("" must be given explicitly)
*)
PROCEDURE Stdin(): T;
(* Make stdin seekable *)
PROCEDURE E(rd: T; message: TEXT);
(* To stderr:
print file name (if rd was openned using SeekRd.Open),
line number (if rd not NIL and seekable),
and message, and exit. *)
PROCEDURE DiscardPrevious(rd: T);
(* be allowed to forget everything before cur(rd) *)
END SeekRd.
$Id: SeekRd.html,v 1.1 2001/01/08 06:53:22 kp Exp $