eolian: initial parsing for parts in eo files

This commit is contained in:
Daniel Kolesa 2017-10-24 17:32:58 +02:00
parent f983bfc277
commit 62e46e70ef
2 changed files with 31 additions and 1 deletions

View File

@ -27,7 +27,7 @@ enum Tokens
KW(abstract), KW(constructor), KW(constructors), KW(data), \
KW(destructor), KW(eo), KW(eo_prefix), KW(event_prefix), KW(events), KW(free), \
KW(get), KW(implements), KW(import), KW(interface), KW(keys), KW(legacy), \
KW(legacy_prefix), KW(methods), KW(mixin), KW(params), KW(ptr), \
KW(legacy_prefix), KW(methods), KW(mixin), KW(params), KW(parts), KW(ptr), \
KW(set), KW(type), KW(values), KW(var), KWAT(auto), KWAT(beta), \
KWAT(class), KWAT(const), KWAT(empty), KWAT(extern), \
KWAT(free), KWAT(hot), KWAT(in), KWAT(inout), KWAT(nonull), KWAT(nullable), \

View File

@ -1478,6 +1478,19 @@ end:
_func_pure_virtual_set(ls, meth, has_virtp);
}
static void
parse_part(Eo_Lexer *ls)
{
check_next(ls, TOK_VALUE);
check_next(ls, ':');
Eina_Strbuf *buf = push_strbuf(ls);
parse_name(ls, buf);
check_next(ls, ';');
if (ls->t.token == TOK_DOC)
eo_lexer_get(ls);
pop_strbuf(ls);
}
static void
parse_implement(Eo_Lexer *ls, Eina_Bool iface)
{
@ -1783,6 +1796,18 @@ parse_methods(Eo_Lexer *ls)
check_match(ls, '}', '{', line, col);
}
static void
parse_parts(Eo_Lexer *ls)
{
int line, col;
eo_lexer_get(ls);
line = ls->line_number, col = ls->column;
check_next(ls, '{');
while (ls->t.token != '}')
parse_part(ls);
check_match(ls, '}', '{', line, col);
}
static void
parse_implements(Eo_Lexer *ls, Eina_Bool iface)
{
@ -1853,6 +1878,7 @@ parse_class_body(Eo_Lexer *ls, Eolian_Class_Type type)
has_event_prefix = EINA_FALSE,
has_data = EINA_FALSE,
has_methods = EINA_FALSE,
has_parts = EINA_FALSE,
has_implements = EINA_FALSE,
has_constructors = EINA_FALSE,
has_events = EINA_FALSE;
@ -1904,6 +1930,10 @@ parse_class_body(Eo_Lexer *ls, Eolian_Class_Type type)
CASE_LOCK(ls, methods, "methods definition")
parse_methods(ls);
break;
case KW_parts:
CASE_LOCK(ls, parts, "parts definition")
parse_parts(ls);
break;
case KW_implements:
CASE_LOCK(ls, implements, "implements definition")
parse_implements(ls, type == EOLIAN_CLASS_INTERFACE);