q66 pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=62e46e70ef61c9b3ca0d03d0c595101aca6d537d

commit 62e46e70ef61c9b3ca0d03d0c595101aca6d537d
Author: Daniel Kolesa <[email protected]>
Date:   Tue Oct 24 17:32:58 2017 +0200

    eolian: initial parsing for parts in eo files
---
 src/lib/eolian/eo_lexer.h  |  2 +-
 src/lib/eolian/eo_parser.c | 30 ++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/src/lib/eolian/eo_lexer.h b/src/lib/eolian/eo_lexer.h
index 657bf5b168..9168ad946c 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 6baeb5d017..ef19fc3486 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);

-- 


Reply via email to