diff --git a/src/lib/eolian/eo_lexer.c b/src/lib/eolian/eo_lexer.c index c113ef87d8..3744e4c799 100644 --- a/src/lib/eolian/eo_lexer.c +++ b/src/lib/eolian/eo_lexer.c @@ -44,7 +44,7 @@ next_char(Eo_Lexer *ls) static const char * const tokens[] = { - "", "", + "", "", "", KEYWORDS }; @@ -104,9 +104,9 @@ init_hash(void) unsigned int i; if (keyword_map) return; keyword_map = eina_hash_string_superfast_new(NULL); - for (i = 2; i < (sizeof(tokens) / sizeof(const char*)); ++i) + for (i = 3; i < (sizeof(tokens) / sizeof(const char*)); ++i) { - eina_hash_add(keyword_map, tokens[i], (void*)(size_t)(i - 1)); + eina_hash_add(keyword_map, tokens[i], (void*)(size_t)(i - 2)); } } @@ -437,7 +437,7 @@ eo_lexer_token_to_str(int token, char *buf) const char * eo_lexer_keyword_str_get(int kw) { - return tokens[kw + 1]; + return tokens[kw + 2]; } Eina_Bool diff --git a/src/lib/eolian/eo_lexer.h b/src/lib/eolian/eo_lexer.h index 15bbcb6515..801d9bd101 100644 --- a/src/lib/eolian/eo_lexer.h +++ b/src/lib/eolian/eo_lexer.h @@ -13,7 +13,7 @@ enum Tokens { - TOK_COMMENT = START_CUSTOM, TOK_VALUE + TOK_COMMENT = START_CUSTOM, TOK_NUMBER, TOK_VALUE }; /* all keywords in eolian, they can still be used as names (they're TOK_VALUE) @@ -59,14 +59,38 @@ enum Keywords #undef KW #undef KWAT +enum Numbers +{ + NUM_INT, + NUM_UINT, + NUM_LONG, + NUM_ULONG, + NUM_LLONG, + NUM_ULLONG, + NUM_FLOAT, + NUM_DOUBLE, + NUM_LDOUBLE +}; + /* a token - "token" is the actual token id, "value" is the value of a token * if needed - NULL otherwise - for example the value of a TOK_VALUE, "kw" * is the keyword id if this is a keyword, it's 0 when not a keyword */ typedef struct _Eo_Token { - int token; - const char *value; - int kw; + int token, kw; + union + { + const char *value; + signed int value_i; + unsigned int value_u; + signed long value_l; + unsigned long value_ul; + signed long long value_ll; + unsigned long long value_ull; + float value_f; + double value_d; + long double value_ld; + }; } Eo_Token; enum Nodes