eolian: add syntax for overridding docs in implements

This commit is contained in:
Daniel Kolesa 2017-01-18 15:33:44 +01:00
parent 2e0dc2a1f9
commit 5f8172a589
4 changed files with 21 additions and 6 deletions

View File

@ -11,5 +11,8 @@ database_implement_del(Eolian_Implement *impl)
if (!impl) return; if (!impl) return;
if (impl->base.file) eina_stringshare_del(impl->base.file); if (impl->base.file) eina_stringshare_del(impl->base.file);
if (impl->full_name) eina_stringshare_del(impl->full_name); if (impl->full_name) eina_stringshare_del(impl->full_name);
database_doc_del(impl->common_doc);
database_doc_del(impl->get_doc);
database_doc_del(impl->set_doc);
free(impl); free(impl);
} }

View File

@ -1593,8 +1593,8 @@ parse_implement(Eo_Lexer *ls, Eina_Bool iface)
eina_strbuf_append_char(buf, '.'); eina_strbuf_append_char(buf, '.');
eina_strbuf_append(buf, eo_lexer_keyword_str_get(ls->t.kw)); eina_strbuf_append(buf, eo_lexer_keyword_str_get(ls->t.kw));
eo_lexer_get(ls); eo_lexer_get(ls);
check_next(ls, ';'); check(ls, ';');
goto end; goto propbeg;
} }
eina_strbuf_append_char(buf, '.'); eina_strbuf_append_char(buf, '.');
check(ls, TOK_VALUE); check(ls, TOK_VALUE);
@ -1608,6 +1608,7 @@ propbeg:
{ {
Eina_Bool has_get = EINA_FALSE, has_set = EINA_FALSE; Eina_Bool has_get = EINA_FALSE, has_set = EINA_FALSE;
eo_lexer_get(ls); eo_lexer_get(ls);
FILL_DOC(ls, impl, common_doc);
for (;;) switch (ls->t.kw) for (;;) switch (ls->t.kw)
{ {
case KW_get: case KW_get:
@ -1627,6 +1628,7 @@ propbeg:
eo_lexer_get(ls); eo_lexer_get(ls);
} }
check_next(ls, ';'); check_next(ls, ';');
FILL_DOC(ls, impl, get_doc);
break; break;
case KW_set: case KW_set:
CASE_LOCK(ls, set, "set specifier"); CASE_LOCK(ls, set, "set specifier");
@ -1645,6 +1647,7 @@ propbeg:
eo_lexer_get(ls); eo_lexer_get(ls);
} }
check_next(ls, ';'); check_next(ls, ';');
FILL_DOC(ls, impl, set_doc);
break; break;
default: default:
goto propend; goto propend;
@ -1655,12 +1658,14 @@ propend:
check_next(ls, '}'); check_next(ls, '}');
} }
else else
{
check_next(ls, ';'); check_next(ls, ';');
FILL_DOC(ls, impl, common_doc);
}
if (glob_auto) if (glob_auto)
impl->get_auto = impl->set_auto = EINA_TRUE; impl->get_auto = impl->set_auto = EINA_TRUE;
if (glob_empty) if (glob_empty)
impl->get_empty = impl->set_empty = EINA_TRUE; impl->get_empty = impl->set_empty = EINA_TRUE;
end:
if (buf) if (buf)
{ {
impl->full_name = eina_stringshare_add(eina_strbuf_string_get(buf)); impl->full_name = eina_stringshare_add(eina_strbuf_string_get(buf));

View File

@ -194,6 +194,9 @@ struct _Eolian_Implement
const Eolian_Class *klass; const Eolian_Class *klass;
const Eolian_Function *foo_id; const Eolian_Function *foo_id;
Eina_Stringshare *full_name; Eina_Stringshare *full_name;
Eolian_Documentation *common_doc;
Eolian_Documentation *get_doc;
Eolian_Documentation *set_doc;
Eina_Bool is_prop_get :1; Eina_Bool is_prop_get :1;
Eina_Bool is_prop_set :1; Eina_Bool is_prop_set :1;
Eina_Bool get_pure_virtual :1; Eina_Bool get_pure_virtual :1;

View File

@ -43,10 +43,14 @@ class Override (Base) {
} }
} }
implements { implements {
Base.constructor; Base.constructor; [[overridden docs for constructor]]
@auto .b { set; } @auto .b { set; }
@empty .bar; @empty .bar;
@auto .c { get; } @auto .c { get; }
@auto Base.z { get; set; } @auto Base.z {
[[overridden general property docs]]
get; [[overridden get docs]]
set; [[overridden set docs]]
}
} }
} }