From: Daniel Kolesa Date: Tue, 24 Oct 2017 15:32:58 +0000 (+0200) Subject: eolian: initial parsing for parts in eo files X-Git-Tag: submit/sandbox/upgrade/efl120/20180319.053334~2092 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=62e46e70ef61c9b3ca0d03d0c595101aca6d537d;p=platform%2Fupstream%2Fefl.git eolian: initial parsing for parts in eo files --- diff --git a/src/lib/eolian/eo_lexer.h b/src/lib/eolian/eo_lexer.h index 657bf5b..9168ad9 100644 --- a/src/lib/eolian/eo_lexer.h +++ b/src/lib/eolian/eo_lexer.h @@ -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), \ diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c index 6baeb5d..ef19fc3 100644 --- a/src/lib/eolian/eo_parser.c +++ b/src/lib/eolian/eo_parser.c @@ -1479,6 +1479,19 @@ end: } 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) { Eina_Strbuf *buf = NULL; @@ -1784,6 +1797,18 @@ parse_methods(Eo_Lexer *ls) } 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) { int line, col; @@ -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);