/* * Token type is either: * - EOF (from , is equal to -1) * - a positive single-character symbol less than TOKEN_HIGHCHAR * - TOKEN_ICONST, an integer constant, and ivalue is set * - TOKEN_STRCONST, a string constant, and strvalue is set * - TOKEN_IDENT, an identifier, and symvalue is set. * * This way-too-simple lexer does not do multicharacter tokens except integers * and strings, does not do comments, does not do reserved words, ... */ /* * This public type is the get_next_token() return type. */ struct token { int type; /* as described above */ int ivalue; /* only set if type == TOKEN_ICONST */ char *strvalue; /* only set if type == TOKEN_STRCONST */ struct symbol *symvalue; /* only set if type == TOKEN_IDENT */ }; #define TOKEN_HIGHCHAR 255 #define TOKEN_ICONST 256 #define TOKEN_STRCONST 257 #define TOKEN_IDENT 258 extern void token_init(FILE *fparg); extern struct token get_next_token();