has_##var = EINA_TRUE;
#define PARSE_SECTION \
- int line; \
+ int line, col; \
eo_lexer_get(ls); \
line = ls->line_number; \
+ col = ls->column; \
check_next(ls, '{'); \
while (ls->t.token != '}')
}
static void
-check_match(Eo_Lexer *ls, int what, int who, int where)
+check_match(Eo_Lexer *ls, int what, int who, int where, int col)
{
if (!test_next(ls, what))
{
eo_lexer_token_to_str(what, tbuf);
eo_lexer_token_to_str(who , vbuf);
snprintf(buf, sizeof(buf),
- "'%s' expected (to close '%s' at line %d)",
- tbuf, vbuf, where);
+ "'%s' expected (to close '%s' at line %d:%d)",
+ tbuf, vbuf, where, col);
eo_lexer_syntax_error(ls, buf);
}
}
static Eo_Type_Def *
parse_function_type(Eo_Lexer *ls)
{
- int line;
+ int line, col;
Eo_Type_Def *def = calloc(1, sizeof(Eo_Type_Def));
ls->tmp.type_def = def;
eo_lexer_get(ls);
else
def->ret_type = parse_type_void(ls);
line = ls->line_number;
+ col = ls->column;
check_next(ls, '(');
if (ls->t.token != ')')
{
while (test_next(ls, ','))
def->arguments = eina_list_append(def->arguments, parse_type(ls));
}
- check_match(ls, ')', '(', line);
+ check_match(ls, ')', '(', line, col);
return def;
}
{
case KW_const:
{
- int line;
+ int line, col;
eo_lexer_get(ls);
line = ls->line_number;
+ col = ls->column;
check_next(ls, '(');
def = parse_type_void(ls);
def->is_const = EINA_TRUE;
- check_match(ls, ')', '(', line);
+ check_match(ls, ')', '(', line, col);
goto parse_ptr;
}
case KW_own:
{
- int sline = ls->line_number, column = ls->column, line;
+ int sline = ls->line_number, scolumn = ls->column, line, column;
eo_lexer_get(ls);
line = ls->line_number;
+ column = ls->column;
check_next(ls, '(');
def = parse_type_void(ls);
if (def->type != EOLIAN_TYPE_POINTER)
{
ls->line_number = sline;
- ls->column = column;
+ ls->column = scolumn;
eo_lexer_syntax_error(ls, "pointer type expected");
}
def->is_own = EINA_TRUE;
- check_match(ls, ')', '(', line);
+ check_match(ls, ')', '(', line, column);
goto parse_ptr;
}
case KW_struct:
}
if (ls->t.token == '<')
{
- int line = ls->line_number;
+ int line = ls->line_number, col = ls->column;
eo_lexer_get(ls);
def->subtypes = eina_list_append(def->subtypes, parse_type(ls));
while (test_next(ls, ','))
def->subtypes = eina_list_append(def->subtypes, parse_type(ls));
- check_match(ls, '>', '<', line);
+ check_match(ls, '>', '<', line, col);
}
return def;
}
ls->tmp.type_def = NULL;
if (ls->t.token == '(')
{
- int line = ls->line_number;
+ int line = ls->line_number, col = ls->column;
eo_lexer_get_balanced(ls, '(', ')');
ret->dflt_ret_val = eina_stringshare_add(ls->t.value);
eo_lexer_get(ls);
- check_match(ls, ')', '(', line);
+ check_match(ls, ')', '(', line, col);
}
if (ls->t.kw == KW_at_warn_unused)
{
static void
parse_accessor(Eo_Lexer *ls)
{
- int line;
+ int line, col;
Eo_Accessor_Def *acc = NULL;
Eina_Bool has_return = EINA_FALSE, has_legacy = EINA_FALSE;
acc = calloc(1, sizeof(Eo_Accessor_Def));
acc->type = (ls->t.kw == KW_get) ? GETTER : SETTER;
eo_lexer_get(ls);
line = ls->line_number;
+ col = ls->column;
check_next(ls, '{');
if (ls->t.token == TOK_COMMENT)
{
goto end;
}
end:
- check_match(ls, '}', '{', line);
+ check_match(ls, '}', '{', line, col);
}
static void
ls->tmp.params = eina_list_append(ls->tmp.params, ls->tmp.param);
ls->tmp.param = NULL;
}
- check_match(ls, '}', '{', line);
+ check_match(ls, '}', '{', line, col);
}
static void
parse_property(Eo_Lexer *ls)
{
- int line;
+ int line, col;
Eo_Property_Def *prop = NULL;
Eina_Bool has_get = EINA_FALSE, has_set = EINA_FALSE,
has_keys = EINA_FALSE, has_values = EINA_FALSE;
prop->name = eina_stringshare_add(ls->t.value);
eo_lexer_get(ls);
line = ls->line_number;
+ col = ls->column;
check_next(ls, '{');
for (;;) switch (ls->t.kw)
{
goto end;
}
end:
- check_match(ls, '}', '{', line);
+ check_match(ls, '}', '{', line, col);
}
static void
parse_method(Eo_Lexer *ls, Eina_Bool ctor)
{
- int line;
+ int line, col;
Eo_Method_Def *meth = NULL;
Eina_Bool has_const = EINA_FALSE, has_params = EINA_FALSE,
has_return = EINA_FALSE, has_legacy = EINA_FALSE;
eo_lexer_get(ls);
}
line = ls->line_number;
+ col = ls->column;
check_next(ls, '{');
if (ls->t.token == TOK_COMMENT)
{
goto end;
}
end:
- check_match(ls, '}', '{', line);
+ check_match(ls, '}', '{', line, col);
}
static void
eo_lexer_get(ls);
if (ls->t.token == '(')
{
- int line = ls->line_number;
+ int line = ls->line_number, col = ls->column;
eo_lexer_get_balanced(ls, '(', ')');
ev->type = eina_stringshare_add(ls->t.value);
eo_lexer_get(ls);
- check_match(ls, ')', '(', line);
+ check_match(ls, ')', '(', line, col);
}
check(ls, ';');
eo_lexer_get_ident(ls, "_,");
ls->tmp.meth);
ls->tmp.meth = NULL;
}
- check_match(ls, '}', '{', line);
+ check_match(ls, '}', '{', line, col);
}
static void
ls->tmp.meth);
ls->tmp.meth = NULL;
}
- check_match(ls, '}', '{', line);
+ check_match(ls, '}', '{', line, col);
}
static void
ls->tmp.prop);
ls->tmp.prop = NULL;
}
- check_match(ls, '}', '{', line);
+ check_match(ls, '}', '{', line, col);
}
static void
ls->tmp.impl);
ls->tmp.impl = NULL;
}
- check_match(ls, '}', '{', line);
+ check_match(ls, '}', '{', line, col);
}
static void
parse_events(Eo_Lexer *ls)
{
- int line;
+ int line, col;
eo_lexer_get(ls);
line = ls->line_number;
+ col = ls->column;
check(ls, '{');
eo_lexer_get_ident(ls, "_,");
while (ls->t.token != '}')
ls->tmp.event);
ls->tmp.event = NULL;
}
- check_match(ls, '}', '{', line);
+ check_match(ls, '}', '{', line, col);
}
static void
static void
parse_class(Eo_Lexer *ls, Eina_Bool allow_ctors, Eolian_Class_Type type)
{
- int line;
+ int line, col;
Eina_Strbuf *buf = push_strbuf(ls);
ls->tmp.kls = calloc(1, sizeof(Eo_Class_Def));
eo_lexer_get(ls);
if (ls->t.token != '{')
{
line = ls->line_number;
+ col = ls->column;
check_next(ls, '(');
if (ls->t.token != ')')
{
ls->tmp.kls->inherits = parse_name_list(ls);
ls->tmp.str_items = NULL;
}
- check_match(ls, ')', '(', line);
+ check_match(ls, ')', '(', line, col);
}
line = ls->line_number;
+ col = ls->column;
check_next(ls, '{');
parse_class_body(ls, allow_ctors, type);
- check_match(ls, '}', '{', line);
+ check_match(ls, '}', '{', line, col);
}
static void