summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-10-24 17:32:58 +0200
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-10-24 17:33:07 +0200
commit62e46e70ef61c9b3ca0d03d0c595101aca6d537d (patch)
treed31634a785ae18c3e8700d46b0a6a6881937e025
parentf983bfc2772f19b2784d2d8391438ba64b6fc264 (diff)
eolian: initial parsing for parts in eo files
-rw-r--r--src/lib/eolian/eo_lexer.h2
-rw-r--r--src/lib/eolian/eo_parser.c30
2 files changed, 31 insertions, 1 deletions
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
27 KW(abstract), KW(constructor), KW(constructors), KW(data), \ 27 KW(abstract), KW(constructor), KW(constructors), KW(data), \
28 KW(destructor), KW(eo), KW(eo_prefix), KW(event_prefix), KW(events), KW(free), \ 28 KW(destructor), KW(eo), KW(eo_prefix), KW(event_prefix), KW(events), KW(free), \
29 KW(get), KW(implements), KW(import), KW(interface), KW(keys), KW(legacy), \ 29 KW(get), KW(implements), KW(import), KW(interface), KW(keys), KW(legacy), \
30 KW(legacy_prefix), KW(methods), KW(mixin), KW(params), KW(ptr), \ 30 KW(legacy_prefix), KW(methods), KW(mixin), KW(params), KW(parts), KW(ptr), \
31 KW(set), KW(type), KW(values), KW(var), KWAT(auto), KWAT(beta), \ 31 KW(set), KW(type), KW(values), KW(var), KWAT(auto), KWAT(beta), \
32 KWAT(class), KWAT(const), KWAT(empty), KWAT(extern), \ 32 KWAT(class), KWAT(const), KWAT(empty), KWAT(extern), \
33 KWAT(free), KWAT(hot), KWAT(in), KWAT(inout), KWAT(nonull), KWAT(nullable), \ 33 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:
1479} 1479}
1480 1480
1481static void 1481static void
1482parse_part(Eo_Lexer *ls)
1483{
1484 check_next(ls, TOK_VALUE);
1485 check_next(ls, ':');
1486 Eina_Strbuf *buf = push_strbuf(ls);
1487 parse_name(ls, buf);
1488 check_next(ls, ';');
1489 if (ls->t.token == TOK_DOC)
1490 eo_lexer_get(ls);
1491 pop_strbuf(ls);
1492}
1493
1494static void
1482parse_implement(Eo_Lexer *ls, Eina_Bool iface) 1495parse_implement(Eo_Lexer *ls, Eina_Bool iface)
1483{ 1496{
1484 Eina_Strbuf *buf = NULL; 1497 Eina_Strbuf *buf = NULL;
@@ -1784,6 +1797,18 @@ parse_methods(Eo_Lexer *ls)
1784} 1797}
1785 1798
1786static void 1799static void
1800parse_parts(Eo_Lexer *ls)
1801{
1802 int line, col;
1803 eo_lexer_get(ls);
1804 line = ls->line_number, col = ls->column;
1805 check_next(ls, '{');
1806 while (ls->t.token != '}')
1807 parse_part(ls);
1808 check_match(ls, '}', '{', line, col);
1809}
1810
1811static void
1787parse_implements(Eo_Lexer *ls, Eina_Bool iface) 1812parse_implements(Eo_Lexer *ls, Eina_Bool iface)
1788{ 1813{
1789 int line, col; 1814 int line, col;
@@ -1853,6 +1878,7 @@ parse_class_body(Eo_Lexer *ls, Eolian_Class_Type type)
1853 has_event_prefix = EINA_FALSE, 1878 has_event_prefix = EINA_FALSE,
1854 has_data = EINA_FALSE, 1879 has_data = EINA_FALSE,
1855 has_methods = EINA_FALSE, 1880 has_methods = EINA_FALSE,
1881 has_parts = EINA_FALSE,
1856 has_implements = EINA_FALSE, 1882 has_implements = EINA_FALSE,
1857 has_constructors = EINA_FALSE, 1883 has_constructors = EINA_FALSE,
1858 has_events = EINA_FALSE; 1884 has_events = EINA_FALSE;
@@ -1904,6 +1930,10 @@ parse_class_body(Eo_Lexer *ls, Eolian_Class_Type type)
1904 CASE_LOCK(ls, methods, "methods definition") 1930 CASE_LOCK(ls, methods, "methods definition")
1905 parse_methods(ls); 1931 parse_methods(ls);
1906 break; 1932 break;
1933 case KW_parts:
1934 CASE_LOCK(ls, parts, "parts definition")
1935 parse_parts(ls);
1936 break;
1907 case KW_implements: 1937 case KW_implements:
1908 CASE_LOCK(ls, implements, "implements definition") 1938 CASE_LOCK(ls, implements, "implements definition")
1909 parse_implements(ls, type == EOLIAN_CLASS_INTERFACE); 1939 parse_implements(ls, type == EOLIAN_CLASS_INTERFACE);