eolian: support for void as separate type type

This commit is contained in:
Daniel Kolesa 2014-06-30 23:07:32 +01:00
parent d5f4af5e61
commit 39aad55991
6 changed files with 36 additions and 18 deletions

View File

@ -116,6 +116,7 @@ typedef enum
typedef enum
{
EOLIAN_TYPE_UNKNOWN_TYPE,
EOLIAN_TYPE_VOID,
EOLIAN_TYPE_REGULAR,
EOLIAN_TYPE_POINTER,
EOLIAN_TYPE_FUNCTION

View File

@ -385,11 +385,11 @@ eo_lexer_lex_error(Eo_Lexer *ls, const char *msg, int token)
{
char buf[256];
txt_token(ls, token, buf);
throw(ls, "%s: %d: %s near '%s'\n", ls->source, ls->line_number, msg,
throw(ls, "%s:%d: %s near '%s'\n", ls->source, ls->line_number, msg,
buf);
}
else
throw(ls, "%s: %d: %s\n", ls->source, ls->line_number, msg);
throw(ls, "%s:%d: %s\n", ls->source, ls->line_number, msg);
}
void

View File

@ -147,7 +147,20 @@ parse_name_list(Eo_Lexer *ls)
return ls->tmp.str_items;
}
static Eo_Type_Def *parse_type(Eo_Lexer *ls);
static Eo_Type_Def *parse_type_void(Eo_Lexer *ls);
static Eo_Type_Def *
parse_type(Eo_Lexer *ls)
{
int line = ls->line_number;
Eo_Type_Def *ret = parse_type_void(ls);
if (ret->type == EOLIAN_TYPE_VOID)
{
ls->line_number = line;
eo_lexer_syntax_error(ls, "non-void type expected");
}
return ret;
}
static Eo_Type_Def *
parse_function_type(Eo_Lexer *ls)
@ -159,7 +172,7 @@ parse_function_type(Eo_Lexer *ls)
if (ls->t.kw == KW_void)
eo_lexer_get(ls);
else
def->ret_type = parse_type(ls);
def->ret_type = parse_type_void(ls);
line = ls->line_number;
check_next(ls, '(');
if (ls->t.token != ')')
@ -173,7 +186,7 @@ parse_function_type(Eo_Lexer *ls)
}
static Eo_Type_Def *
parse_type(Eo_Lexer *ls)
parse_type_void(Eo_Lexer *ls)
{
Eina_Bool has_struct = EINA_FALSE;
Eo_Type_Def *def;
@ -186,7 +199,7 @@ parse_type(Eo_Lexer *ls)
eo_lexer_get(ls);
line = ls->line_number;
check_next(ls, '(');
def = parse_type(ls);
def = parse_type_void(ls);
def->is_const = EINA_TRUE;
check_match(ls, ')', '(', line);
goto parse_ptr;
@ -197,7 +210,7 @@ parse_type(Eo_Lexer *ls)
eo_lexer_get(ls);
line = ls->line_number;
check_next(ls, '(');
def = parse_type(ls);
def = parse_type_void(ls);
def->is_own = EINA_TRUE;
check_match(ls, ')', '(', line);
goto parse_ptr;
@ -213,12 +226,17 @@ parse_type(Eo_Lexer *ls)
}
def = calloc(1, sizeof(Eo_Type_Def));
ls->tmp.type_def = def;
def->type = EOLIAN_TYPE_REGULAR;
def->is_struct = has_struct;
def->is_const = EINA_FALSE;
check(ls, TOK_VALUE);
ctype = eo_lexer_get_c_type(ls->t.kw);
def->name = eina_stringshare_add(ctype ? ctype : ls->t.value);
if (ls->t.kw == KW_void)
def->type = EOLIAN_TYPE_VOID;
else
{
def->type = EOLIAN_TYPE_REGULAR;
def->is_struct = has_struct;
def->is_const = EINA_FALSE;
check(ls, TOK_VALUE);
ctype = eo_lexer_get_c_type(ls->t.kw);
def->name = eina_stringshare_add(ctype ? ctype : ls->t.value);
}
eo_lexer_get(ls);
parse_ptr:
while (ls->t.token == '*')

View File

@ -1228,12 +1228,15 @@ _type_to_str(Eolian_Type tp, Eina_Strbuf *buf, const char *name)
_ftype_to_str(tp, buf, name);
return;
}
if (tpp->type == EOLIAN_TYPE_REGULAR && tpp->is_const)
if ((tpp->type == EOLIAN_TYPE_REGULAR || tpp->type == EOLIAN_TYPE_VOID)
&& tpp->is_const)
eina_strbuf_append(buf, "const ");
if (tpp->is_struct)
eina_strbuf_append(buf, "struct ");
if (tpp->type == EOLIAN_TYPE_REGULAR)
eina_strbuf_append(buf, tpp->name);
else if (tpp->type == EOLIAN_TYPE_VOID)
eina_strbuf_append(buf, "void");
else
{
_Parameter_Type *btpp = (_Parameter_Type*)tpp->base_type;

View File

@ -176,7 +176,6 @@ class Evas_3D_Mesh (Evas_3D_Object, Evas.Common_Interface)
@ingroup Evas_3D_Mesh
*/
return void ;
params {
@in Evas_3D_Index_Format format; /*@ Vertex index data format. */
@in int count; /*@ Vertex index count. */

View File

@ -60,7 +60,6 @@ class Evas_3D_Texture (Evas_3D_Object, Evas.Common_Interface)
@ingroup Evas_3D_Texture
*/
return void ;
params {
@in const(char)* file; /*@ Path to the image file. */
@in const(char)* key; /*@ Key in the image file. */
@ -79,7 +78,6 @@ class Evas_3D_Texture (Evas_3D_Object, Evas.Common_Interface)
@ingroup Evas_3D_Texture
*/
return void ;
params {
@in Evas_Object *source; /*@ Source evas object to be used as the texture data. */
}
@ -147,7 +145,6 @@ class Evas_3D_Texture (Evas_3D_Object, Evas.Common_Interface)
@ingroup Evas_3D_Texture
*/
return void ;
params {
@out Evas_3D_Wrap_Mode s; /*@ Pointer to receive S-axis wrap mode. */
@out Evas_3D_Wrap_Mode t; /*@ Pointer to receive T-axis wrap mode. */