eolian: remove eo_lexer_get_until and allow just single-word value in the data: field of a class

This commit is contained in:
Daniel Kolesa 2014-07-16 15:33:11 +01:00
parent 9b2680ad6f
commit 226f417005
3 changed files with 2 additions and 35 deletions

View 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)
{
@ -395,13 +371,6 @@ eo_lexer_get_balanced(Eo_Lexer *ls, char beg, char end)
return (ls->t.token == lex_balanced(ls, &ls->t.value, &ls->t.kw, beg, 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)
{

View 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 */

View 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, ';');