eolian: disable parsing of old style docs

This commit is contained in:
Daniel Kolesa 2015-09-03 15:08:08 +01:00
parent 35a6bb1666
commit 7ae6781451
3 changed files with 13 additions and 48 deletions

View File

@ -50,7 +50,7 @@ static const char * const tokens[] =
{ {
"==", "!=", ">=", "<=", "&&", "||", "<<", ">>", "==", "!=", ">=", "<=", "&&", "||", "<<", ">>",
"<comment>", "<doc>", "<string>", "<char>", "<number>", "<value>", "<doc>", "<string>", "<char>", "<number>", "<value>",
KEYWORDS KEYWORDS
}; };
@ -115,7 +115,7 @@ init_hash(void)
unsigned int i, u; unsigned int i, u;
if (keyword_map) return; if (keyword_map) return;
keyword_map = eina_hash_string_superfast_new(NULL); keyword_map = eina_hash_string_superfast_new(NULL);
for (i = u = 14; i < (sizeof(tokens) / sizeof(const char*)); ++i) for (i = u = 13; i < (sizeof(tokens) / sizeof(const char*)); ++i)
{ {
eina_hash_add(keyword_map, tokens[i], (void*)(size_t)(i - u + 1)); eina_hash_add(keyword_map, tokens[i], (void*)(size_t)(i - u + 1));
} }
@ -192,7 +192,7 @@ should_skip_star(Eo_Lexer *ls, int ccol, Eina_Bool *term)
} }
static void static void
read_long_comment(Eo_Lexer *ls, Eo_Token *tok, int ccol) read_long_comment(Eo_Lexer *ls, int ccol)
{ {
Eina_Bool had_star = EINA_FALSE, had_nl = EINA_FALSE; Eina_Bool had_star = EINA_FALSE, had_nl = EINA_FALSE;
eina_strbuf_reset(ls->buff); eina_strbuf_reset(ls->buff);
@ -250,7 +250,6 @@ read_long_comment(Eo_Lexer *ls, Eo_Token *tok, int ccol)
} }
cend: cend:
eina_strbuf_trim(ls->buff); eina_strbuf_trim(ls->buff);
if (tok) tok->value.s = eina_stringshare_add(eina_strbuf_string_get(ls->buff));
} }
enum Doc_Tokens { enum Doc_Tokens {
@ -752,15 +751,14 @@ lex(Eo_Lexer *ls, Eo_Token *tok)
next_char(ls); next_char(ls);
if (ls->current == '*') if (ls->current == '*')
{ {
Eina_Bool doc = EINA_FALSE;
int ccol = ls->column; int ccol = ls->column;
next_char(ls); next_char(ls);
if ((doc = (ls->current == '@'))) if (ls->current == '@')
next_char(ls); {
read_long_comment(ls, doc ? tok : NULL, ccol); eo_lexer_lex_error(ls, "old style documentation comment", -1);
if (doc) return -1; /* unreachable */
return TOK_COMMENT; }
else read_long_comment(ls, ccol);
continue; continue;
} }
else if (ls->current != '/') return '/'; else if (ls->current != '/') return '/';
@ -1096,7 +1094,7 @@ eo_lexer_token_to_str(int token, char *buf)
const char * const char *
eo_lexer_keyword_str_get(int kw) eo_lexer_keyword_str_get(int kw)
{ {
return tokens[kw + 13]; return tokens[kw + 12];
} }
Eina_Bool Eina_Bool
@ -1146,7 +1144,7 @@ eo_lexer_shutdown()
static Eina_Bool static Eina_Bool
_eo_is_tokstr(int t) { _eo_is_tokstr(int t) {
return (t == TOK_COMMENT) || (t == TOK_STRING) || (t == TOK_VALUE); return (t == TOK_STRING) || (t == TOK_VALUE);
} }
void void

View File

@ -17,7 +17,7 @@ enum Tokens
TOK_EQ = START_CUSTOM, TOK_NQ, TOK_GE, TOK_LE, TOK_EQ = START_CUSTOM, TOK_NQ, TOK_GE, TOK_LE,
TOK_AND, TOK_OR, TOK_LSH, TOK_RSH, TOK_AND, TOK_OR, TOK_LSH, TOK_RSH,
TOK_COMMENT, TOK_DOC, TOK_STRING, TOK_CHAR, TOK_NUMBER, TOK_VALUE TOK_DOC, TOK_STRING, TOK_CHAR, TOK_NUMBER, TOK_VALUE
}; };
/* all keywords in eolian, they can still be used as names (they're TOK_VALUE) /* all keywords in eolian, they can still be used as names (they're TOK_VALUE)

View File

@ -957,11 +957,6 @@ parse_return(Eo_Lexer *ls, Eo_Ret_Def *ret, Eina_Bool allow_void)
eo_lexer_get(ls); eo_lexer_get(ls);
} }
check_next(ls, ';'); check_next(ls, ';');
if (ls->t.token == TOK_COMMENT)
{
ret->comment = eina_stringshare_ref(ls->t.value.s);
eo_lexer_get(ls);
}
FILL_DOC(ls, ret, doc); FILL_DOC(ls, ret, doc);
} }
@ -1039,11 +1034,6 @@ parse_param(Eo_Lexer *ls, Eina_List **params, Eina_Bool allow_inout,
} }
end: end:
check_next(ls, ';'); check_next(ls, ';');
if (ls->t.token == TOK_COMMENT)
{
par->description = eina_stringshare_ref(ls->t.value.s);
eo_lexer_get(ls);
}
FILL_DOC(ls, par, doc); FILL_DOC(ls, par, doc);
} }
@ -1101,14 +1091,6 @@ parse_accessor(Eo_Lexer *ls, Eolian_Function *prop)
line = ls->line_number; line = ls->line_number;
col = ls->column; col = ls->column;
check_next(ls, '{'); check_next(ls, '{');
if (ls->t.token == TOK_COMMENT)
{
if (is_get)
prop->get_description = eina_stringshare_ref(ls->t.value.s);
else
prop->set_description = eina_stringshare_ref(ls->t.value.s);
eo_lexer_get(ls);
}
if (is_get) if (is_get)
{ {
FILL_DOC(ls, prop, get_doc); FILL_DOC(ls, prop, get_doc);
@ -1243,11 +1225,6 @@ body:
line = ls->line_number; line = ls->line_number;
col = ls->column; col = ls->column;
check_next(ls, '{'); check_next(ls, '{');
if (ls->t.token == TOK_COMMENT)
{
prop->common_description = eina_stringshare_ref(ls->t.value.s);
eo_lexer_get(ls);
}
FILL_DOC(ls, prop, common_doc); FILL_DOC(ls, prop, common_doc);
for (;;) switch (ls->t.kw) for (;;) switch (ls->t.kw)
{ {
@ -1329,11 +1306,6 @@ body:
line = ls->line_number; line = ls->line_number;
col = ls->column; col = ls->column;
check_next(ls, '{'); check_next(ls, '{');
if (ls->t.token == TOK_COMMENT)
{
meth->common_description = eina_stringshare_ref(ls->t.value.s);
eo_lexer_get(ls);
}
FILL_DOC(ls, meth, common_doc); FILL_DOC(ls, meth, common_doc);
for (;;) switch (ls->t.kw) for (;;) switch (ls->t.kw)
{ {
@ -1655,11 +1627,6 @@ parse_class_body(Eo_Lexer *ls, Eolian_Class_Type type)
has_implements = EINA_FALSE, has_implements = EINA_FALSE,
has_constructors = EINA_FALSE, has_constructors = EINA_FALSE,
has_events = EINA_FALSE; has_events = EINA_FALSE;
if (ls->t.token == TOK_COMMENT)
{
ls->tmp.kls->description = eina_stringshare_ref(ls->t.value.s);
eo_lexer_get(ls);
}
FILL_DOC(ls, ls->tmp.kls, doc); FILL_DOC(ls, ls->tmp.kls, doc);
if (type == EOLIAN_CLASS_INTERFACE) if (type == EOLIAN_CLASS_INTERFACE)
{ {