eolian: remove eo_lexer_get_until and allow just single-word value in the data: field...
authorDaniel Kolesa <d.kolesa@samsung.com>
Wed, 16 Jul 2014 14:33:11 +0000 (15:33 +0100)
committerDaniel Kolesa <d.kolesa@samsung.com>
Wed, 16 Jul 2014 14:33:11 +0000 (15:33 +0100)
src/lib/eolian/eo_lexer.c
src/lib/eolian/eo_lexer.h
src/lib/eolian/eo_parser.c

index aae2aaa..f581ce2 100644 (file)
@@ -297,30 +297,6 @@ lex_balanced(Eo_Lexer *ls, const char **value, int *kwid, char beg, char end)
    return TOK_VALUE;
 }
 
-static int
-lex_until(Eo_Lexer *ls, const char **value, int *kwid, char end)
-{
-   int col;
-   const char *str;
-   eina_strbuf_reset(ls->buff);
-   while (isspace(ls->current))
-     next_char(ls);
-   col = ls->column;
-   while (ls->current)
-     {
-        if (ls->current == end)
-          break;
-        eina_strbuf_append_char(ls->buff, ls->current);
-        next_char(ls);
-     }
-   eina_strbuf_trim(ls->buff);
-   str    = eina_strbuf_string_get(ls->buff);
-   *kwid  = (int)(uintptr_t)eina_hash_find(keyword_map, str);
-   *value = str;
-   ls->column = col + 1;
-   return TOK_VALUE;
-}
-
 static void
 eo_lexer_set_input(Eo_Lexer *ls, const char *source)
 {
@@ -396,13 +372,6 @@ eo_lexer_get_balanced(Eo_Lexer *ls, char beg, char end)
 }
 
 int
-eo_lexer_get_until(Eo_Lexer *ls, char end)
-{
-   assert(ls->lookahead.token == TOK_EOF);
-   return (ls->t.token == lex_until(ls, &ls->t.value, &ls->t.kw, end));
-}
-
-int
 eo_lexer_get(Eo_Lexer *ls)
 {
    if (ls->lookahead.token != TOK_EOF)
index 117ac0b..27c0064 100644 (file)
@@ -144,8 +144,6 @@ void        eo_lexer_free           (Eo_Lexer *ls);
  * "end" character, but keeps it balanced, so if it hits "beg" during lexing,
  * it won't end at the next "end", useful for lexing between () or [] */
 int         eo_lexer_get_balanced   (Eo_Lexer *ls, char beg, char end);
-/* gets a TOK_VALUE until the "end" character */
-int         eo_lexer_get_until      (Eo_Lexer *ls, char end);
 /* gets a regular token, singlechar or one of TOK_something */
 int         eo_lexer_get            (Eo_Lexer *ls);
 /* lookahead token - see Eo_Lexer */
index cabf32c..006fc74 100644 (file)
@@ -961,8 +961,8 @@ parse_class_body(Eo_Lexer *ls, Eina_Bool allow_ctors, Eolian_Class_Type type)
       case KW_data:
         CASE_LOCK(ls, data, "data definition")
         eo_lexer_get(ls);
-        check(ls, ':');
-        eo_lexer_get_until(ls, ';');
+        check_next(ls, ':');
+        check(ls, TOK_VALUE);
         ls->tmp.kls->data_type = eina_stringshare_add(ls->t.value);
         eo_lexer_get(ls);
         check_next(ls, ';');