eolian: add 'parse' directive

This is much like 'import' but doesn't add the imported file into
the dependency list for the current file. This is to enable doc
reference validation to remain functional without needlessly
introducing file dependencies just to satisfy it.
This commit is contained in:
Daniel Kolesa 2018-04-20 14:45:07 +02:00
parent b9d3347a48
commit 591567a6ac
2 changed files with 5 additions and 3 deletions

View File

@ -27,8 +27,8 @@ 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(parts), KW(ptr), \
KW(set), KW(type), KW(values), KW(var), KWAT(auto), KWAT(beta), \
KW(legacy_prefix), KW(methods), KW(mixin), KW(params), KW(parse), KW(parts), \
KW(ptr), KW(set), KW(type), KW(values), KW(var), KWAT(auto), KWAT(beta), \
KWAT(class), KWAT(const), KWAT(cref), KWAT(empty), KWAT(extern), \
KWAT(free), KWAT(hot), KWAT(in), KWAT(inout), KWAT(nonull), KWAT(nullable), \
KWAT(optional), KWAT(out), KWAT(owned), KWAT(private), KWAT(property), \

View File

@ -2073,7 +2073,9 @@ parse_unit(Eo_Lexer *ls, Eina_Bool eot)
parse_class(ls, EOLIAN_CLASS_INTERFACE);
goto found_class;
case KW_import:
case KW_parse:
{
Eina_Bool isdep = (ls->t.kw == KW_import);
Eina_Strbuf *buf = eina_strbuf_new();
eo_lexer_dtor_push(ls, EINA_FREE_CB(eina_strbuf_free), buf);
char errbuf[PATH_MAX];
@ -2093,7 +2095,7 @@ parse_unit(Eo_Lexer *ls, Eina_Bool eot)
eo_lexer_syntax_error(ls, errbuf);
}
}
database_defer(ls->state, eina_strbuf_string_get(buf), EINA_TRUE);
database_defer(ls->state, eina_strbuf_string_get(buf), isdep);
eo_lexer_dtor_pop(ls);
eo_lexer_get(ls);
check_next(ls, ';');