/*                      QBCC Project

This source file is licensed under the GNU Public Licence which should be 
included with the distribution of this source.

*/
#ifndef __SCANNER_H__
#define __SCANNER_H__

#include "qbcc.h"

// Variable Types

// NOTE: These are specially ordered in priority
#define VAR_VOID		0
#define VAR_INTEGER     1
#define VAR_FILE		2
#define VAR_LONG        3
#define VAR_SINGLE      4
#define VAR_DOUBLE      5
#define VAR_STRING      6
#define VAR_USER_DEFINED	7


// Token Types
#define TK_SYMBOL			0
#define TK_OPERATOR			1
#define TK_STRINGCONSTANT	2
#define TK_KEYWORD			3
#define TK_VARIABLE			4
#define TK_NUMBER			5
#define TK_TYPE				6
#define TK_UNKNOWN			7
#define TK_COMMENT			8
#define TK_HEX				11
#define TK_NEWLINE			12
#define TK_SOFTLINE			13
#define TK_LABEL			14
#define TK_EOF				15
#define TK_FUNCTION			16
#define TK_DOT				17
#define TK_UNRECOGNIZE		18

// Default constants
#define SZ_DEFAULT			256				// Default size (useless?)

// Token Flags
#define TKF_ARGUEMENT		1
#define TKF_FILE			2
#define TKF_VARPTR			4

// Typedef's
typedef struct TOKEN_S token_t;

// Token Structure
struct TOKEN_S {
	char text[256];				// Text
	int type;					// Token type
	int VarType;				// Variable Type (if a var)
	int flags;					// Flags
};

// Tokens
extern token_t *curToken;					// Current Token
extern token_t *LookToken;					// Look ahead Token
extern default_t *DefStruct;				// Default QB Types

extern int LineNumber;						// Line Number
int FileStart;

// Scanner.c prototypes
void NextLine(int linetype);
void RestartScanner(void);
void GetToken(void);
void Match(char *string);

int IsVariable(char *name,int *VarType);
int IsArguement(char *name,int *VarType);
int IsMember(char *name, int *VarType);

#endif  //  __SCANNER_H__