q66 pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=80165034ed8e19eed35561a52b21d0ed3dd0fcae

commit 80165034ed8e19eed35561a52b21d0ed3dd0fcae
Author: Daniel Kolesa <[email protected]>
Date:   Wed Jul 16 16:18:13 2014 +0100

    eolian: preliminary number constant stuff in eo_lexer
---
 src/lib/eolian/eo_lexer.c |  8 ++++----
 src/lib/eolian/eo_lexer.h | 32 ++++++++++++++++++++++++++++----
 2 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/src/lib/eolian/eo_lexer.c b/src/lib/eolian/eo_lexer.c
index c113ef8..3744e4c 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[] =
 {
-   "<comment>", "<value>",
+   "<comment>", "<number>", "<value>",
 
    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 15bbcb6..801d9bd 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

-- 


Reply via email to