#pragma once #include "const.h" typedef enum scanner_Sym { S_undef, S_eof, S_DIV, S_INT, S_VOID, S_RETURN, S_IDENT, S_INT_CONST, S_SEMICOLON, S_LPARENT, S_RPARENT, S_LCURL, S_RCURL } scanner_Sym; typedef struct scanner_Symbol { scanner_Sym sym; union { char s[MAX_IDENT_LEN]; int i; } data; int tag; } scanner_Symbol; typedef struct Scanner { int peek; int row; int col; char *src; char *pos; int debug; } Scanner; void scanner_init( Scanner *s, char *src ); void scanner_reset( Scanner *s ); void scanner_done( Scanner *s ); scanner_Symbol scanner_scan( Scanner *s ); void scanner_debug( Scanner *s, int enable );