s/#define / / & s/[0-9]// & inplace enum { - end }

This commit is contained in:
Dale Weiler 2012-04-25 11:42:20 -04:00
parent 6b5776776d
commit b102e77dca

46
gmqcc.h
View file

@ -89,24 +89,26 @@ struct lex_file {
* It's important that this table never exceed 32 keywords, the ascii * It's important that this table never exceed 32 keywords, the ascii
* table starts at 33 (and we don't want conflicts) * table starts at 33 (and we don't want conflicts)
*/ */
#define TOKEN_DO 0 enum {
#define TOKEN_ELSE 1 TOKEN_DO ,
#define TOKEN_IF 2 TOKEN_ELSE ,
#define TOKEN_WHILE 3 TOKEN_IF ,
#define TOKEN_BREAK 4 TOKEN_WHILE ,
#define TOKEN_CONTINUE 5 TOKEN_BREAK ,
#define TOKEN_RETURN 6 TOKEN_CONTINUE ,
#define TOKEN_GOTO 7 TOKEN_RETURN ,
#define TOKEN_FOR 8 // extension TOKEN_GOTO ,
#define TOKEN_TYPEDEF 9 // extension TOKEN_FOR , // extension
TOKEN_TYPEDEF , // extension
// ensure the token types are out of the // ensure the token types are out of the
// bounds of anyothers that may conflict. // bounds of anyothers that may conflict.
#define TOKEN_FLOAT 110 TOKEN_FLOAT = 110,
#define TOKEN_VECTOR 111 TOKEN_VECTOR ,
#define TOKEN_STRING 112 TOKEN_STRING ,
#define TOKEN_ENTITY 113 TOKEN_ENTITY ,
#define TOKEN_VOID 114 TOKEN_VOID
};
/* /*
* Lexer state constants, these are numbers for where exactly in * Lexer state constants, these are numbers for where exactly in
@ -114,10 +116,12 @@ struct lex_file {
* error occurs. These numbers must be > where the ascii-table ends * error occurs. These numbers must be > where the ascii-table ends
* and > the last type token which is TOKEN_VOID * and > the last type token which is TOKEN_VOID
*/ */
#define LEX_COMMENT 1128 enum {
#define LEX_CHRLIT 1129 LEX_COMMENT = 1128,
#define LEX_STRLIT 1130 LEX_CHRLIT ,
#define LEX_IDENT 1131 LEX_STRLIT ,
LEX_IDENT
};
int lex_token (struct lex_file *); int lex_token (struct lex_file *);
void lex_reset (struct lex_file *); void lex_reset (struct lex_file *);