DEFINITION MODULE FAInput;
This module provides the character level input for both DFAPattern
and NFAPattern. It uses a double buffer input system to hold lex-
emes of up to 1024 characters in length. Care should be taken
when altering the current position, as it may confuse the pattern
matching modules. Only one file may be in use at a time.
This type is used to denote a position in the input buffer. It may
be used to hold a place while implementing a look-ahead operator,
or something of that nature.
PROCEDURE BackTrackPosition (VAR pos : Position);
This procedure may be used to move the given Position variable one
unit to the left. It does not, however, affect the current posi-
tion in the input buffer.
This procedure closes the file from which input is taken. If it is
called when there is no current input file, the program will ter-
minate with an appropriate error.
PROCEDURE DeterminePosition (VAR pos : Position);
Returns the current position in the input buffer.
PROCEDURE OpenInputFile (name : ARRAY OF CHAR; VAR done : BOOLEAN);
This procedure is used to open the input file. If an error occurs,
'done' will be FALSE, and no input will take place. If there is
already an open input file, the program will terminate with an ap-
PROCEDURE NextChar () : CHAR;
This procedure returns the next character in the input file, advanc-
ing the current position. If an attempt to read beyond the end of
the file is made, 32C (the MS-DOS end of file marker) will be re-
FAInput - 1
PROCEDURE ReturnLexeme (start,end : Position; VAR lex : ARRAY OF CHAR);
Returns the lexeme starting at position 'start' and ending at the
position one character before 'end.'
PROCEDURE SetPosition (pos : Position);
Sets the current position in the input buffer. If an invalid posi-
tion is set, the program will probably crash when one of the pat-
tern matchers attempts to read from the input.
FAInput - 2