From Modula-2 Reloaded

Spec: Scanner

DEFINITION MODULE Scanner;

(* Primitives for Scanning Text Files *)


FROM FileIO IMPORT File;
IMPORT CHARSET;


(* Read text *)

PROCEDURE ReadStrWithChars ( file : File; VAR s : ARRAY OF CHAR;
                             CONST trimLeading, charsToRead : CHARSET );
(* Reads a string from <file> and passes it back in <s>. Any leading
   characters in set <trimLeading> are ignored. Characters are read
   until the first character not in set <charsToRead> is found. *)

PROCEDURE ReadStrToDelim ( file : File; VAR s : ARRAY OF CHAR;
                           CONST trimLeading, delimiterChars : CHARSET );
(* Reads a string from <file> and passes it back in <s>. Any leading
   characters in set <trimLeading> are ignored. Characters are read
   until the first delimiter character is found. Delimiter characters
   are defined by set <delimiterChars>. *)


(* Skip text *)

PROCEDURE SkipChars ( file : File; CONST skipChars : CHARSET );
(* Read and ignore any characters up to the first character
   not in set <skipChars>. *)

PROCEDURE SkipTo ( File : File; CONST skipToChar : CHARSET );
(* Read and ignore all characters up to but excluding the first
   character that is a member of set <skipToChar>. *)

END Scanner.
Retrieved from http://modula-2.net/m2r10/pmwiki.php?n=Spec.Scanner
Page last modified on 2010-05-24 12:38