#ifndef _SCANNER_H_
#define _SCANNER_H_

/* PURPOSE:
 *    SCANNER.H: Public interface to the Scanner.
 * HISTORY:
 *    Ian D. Allen   idallen@freenet.carleton.ca
 */

#include "mem.h"

#include <stdio.h>

/* The Token Types returned by the Scanner.
 * This list must exactly match the English descriptions
 * returned by the token_type() function in scanner.c
 * Not all these Types may be implemented.
 */
typedef enum TokenType {
	TT_UNK=0,	/* unknown */
	TT_ERR,		/* error */
	TT_EOF,		/* eof */
	TT_JUNK,	/* undifferentiated junk */
	TT_ID,		/* identifier */
	TT_UINT,	/* unsigned integer */
//FIXME-- add your own TT_* Token types here
	TT_DIMENSION	/* LAST ENTRY: size of this array */
} TokenType;

/* The Token returned by the Scanner.
 * A token is a classified lexeme.  Here, you find the lexeme
 * and its classification, and the line number on which it was found.
 */
typedef struct Token {
	TokenType type;	/* type of the lexeme recognized */
	char *lexeme;	/* actual lexeme character string */
	long lineno;	/* line number on which lexeme was found */
} Token;

	char *
token_name(		/* RET: English description of token */
	TokenType token	/* IN: token number from Scanner */
);

	void
scanner_init(
	FILE *fd,   	/* IN: open stream descriptor to read */
	char *fname	/* IN: name of open stream */
);

	void
scanner_term(void);

	Token
scanner(		/* RET: the next Token from the input stream */
	void
);

#endif /*_SCANNER_H_*/
