    {------------------------------------------------------------------------}
    {-------------------------------/                                   \----}
    {----                       ----!   Const,  Type  and  Procedure    !----}
    {----    L E X I . D E F    ----!   definitions for LEXI version    !----}
    {----                       ----!   2.1,  the lexical  analyzer.    !----}
    {-------------------------------\                                   /----}
    {------------------------------------------------------------------------}

CONST
    tk_nil	= 0		{ NIL token type };
    tk_any	= 1		{ ANY token type };
    tk_mark	= 2		{ `#' token type (SYN's start arg. collect) };

TYPE

    automaton  = ^char		{ cheap fake pointer type };

    token_type = RECORD
		     typ : integer;
		     CASE integer OF
			1: (ival : integer);
			2: (rval : real);
			3: (cval : char);
			4: (bval : boolean);
			5: (nval : name_type);
		 END;


    astring	= ARRAY [1..500] OF char;
    pstring	= ^astring;

    FUNCTION  lexini	(PROCEDURE	  dfa;
			     buflen	: integer;
			     lkblen	: integer;
			     table	: hash_table):automaton;EXTERN;
    PROCEDURE lexuse	(    dfa	: automaton;
			     table	: hash_table);		EXTERN;
    FUNCTION  lextable	(    dfa	: automaton):hash_table;EXTERN;

    FUNCTION  lexgchar	(    dfa	: automaton) : char;	EXTERN;
    PROCEDURE gettoken	(    dfa	: automaton;
			 VAR token	: token_type);		EXTERN;

    FUNCTION  lexnum	(    dfa	: automaton;
			     name	: string) : integer;	EXTERN;
    PROCEDURE lexname	(    dfa	: automaton;
			     number	: integer;
			 VAR name	: string;
			 VAR length	: integer);		EXTERN;
    PROCEDURE tokdescr	(    dfa	: automaton;
			 VAR buffer	: pstring;
			 VAR length	: integer);		EXTERN;

    PROCEDURE lchange	(    dfa	: automaton;
			     token	: token_type;
			     newtype	: word);		EXTERN;
    PROCEDURE lexgtok	(    dfa	: automaton;
			 VAR token	: token_type);		EXTERN;
    PROCEDURE lexstok	(    dfa	: automaton;
			     token	: token_type);		EXTERN;
    PROCEDURE lexkey	(    dfa	: automaton;
			     on		: boolean);		EXTERN.
