/*
 * Lexical Analyser header file.
 *
 * Automatically generated by genHeader.pl from cavy_syntax.l, DO NOT HAND EDIT.
 */

#ifndef _CAVY_SYNTAX_H_
#define _CAVY_SYNTAX_H_

#include <stdio.h>

enum token_type {
    T_EOF,
	T_COMMA,
	T_SEMICOLON,
	T_LEFT_BRACE,
	T_RIGHT_BRACE,
	T_LEFT_PARENTHESIS,
	T_RIGHT_PARENTHESIS,
	T_LEFT_SQUARE_BRACKET,
	T_RIGHT_SQUARE_BRACKET,
	T_LOGICAL_OR,
	T_LOGICAL_AND,
	T_ASSIGNMENT,
	T_EQUALS,
	T_NOT_EQUALS,
	T_LESS_THAN,
	T_LESS_THAN_EQUALS  ,
	T_GREATER_THAN,
	T_GREATER_THAN_EQUALS,
	T_PLUS,
	T_MINUS,
	T_MULTIPLY,
	T_DIVIDE,
	T_MODULUS,
	T_OR,
	T_AND,
	T_EXCLUSIVE_OR,
	T_DOT,
	T_NOT,
	T_ARROW,
	T_INCREMENT,
	T_DECREMENT,
	T_CHAR,
	T_SHORT,
	T_INT,
	T_LONG,
	T_VOID,
	T_GETC,
	T_GETI,
	T_PUTC,
	T_PUTH,
	T_PUTI,
	T_PUTS,
	T_BREAK,
	T_CONTINUE,
	T_IF,
	T_ELSE,
	T_FOR,
	T_RETURN,
	T_STRUCT,
	T_WHILE,
	T_NULL,
	T_CONSTANT,
	T_IDENTIFIER,
	T_STRING_CONSTANT,
};

typedef enum token_type token_type;
typedef struct token token;

struct token {
    token_type      type;
    int             line_number;
    char            *text;
    int             int_value;
};

/*
 * Set the input file for lexical analysis
 */
void open_lexical_analysis(FILE *f);

/*
 * Returns the next token.  This token is consumed.
 */
token *get_token(void);

/*
 * Returns the nth token ahead of the current one.
 * No tokens are consumed.
 */
token *view_token(int n);

/*
 * Convert a lexeme into a string.
 */
char *token_type_to_string(token_type t);

#endif /* _CAVY_SYNTAX_H_ */

