From 984f10907bc03d4559236bdeba86e5b9b26a2499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 27 Nov 2013 02:37:12 +0000 Subject: add Eo_Accessor_Def a property has a name, parameters and accessors --- eo_tokenizer.h | 17 ++++++++++++----- eo_tokenizer.rl | 25 +++++++++++++++++++++---- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/eo_tokenizer.h b/eo_tokenizer.h index eb618b9..646dd45 100644 --- a/eo_tokenizer.h +++ b/eo_tokenizer.h @@ -60,20 +60,26 @@ typedef struct _eo_param_def /* PROPERTIES */ -typedef enum _property_type +typedef enum _eo_accessor_type { SETTER, GETTER, PROP_TYPE_LAST -} Property_Type; +} Eo_Accessor_Type; -typedef struct _eo_property_def +typedef struct _eo_accessor_def { - Property_Type type; + Eo_Accessor_Type type; Eo_Ret_Def ret; - const char *name; const char *comment; + Eina_List *legacies; +} Eo_Accessor_Def; + +typedef struct _eo_property_def +{ + const char *name; Eina_List *params; + Eina_List *accessors; } Eo_Property_Def; /* METHODS */ @@ -130,6 +136,7 @@ typedef struct _eo_tokenizer Eo_Property_Def *prop; Eo_Method_Def *meth; Eo_Param_Def *param; + Eo_Accessor_Def *accessor; } tmp; } Eo_Tokenizer; diff --git a/eo_tokenizer.rl b/eo_tokenizer.rl index aebf832..ee66d05 100644 --- a/eo_tokenizer.rl +++ b/eo_tokenizer.rl @@ -339,20 +339,37 @@ _eo_tokenizer_param_free(Eo_Param_Def *param) } static void +_eo_tokenizer_accessor_free(Eo_Accessor_Def *accessor) +{ + const char *s; + Eina_List *l; + + if (accessor->comment) + eina_stringshare_del(accessor->comment); + + EINA_LIST_FOREACH(accessor->legacies, l, s) + if (s) eina_stringshare_del(s); + + _eo_tokenizer_ret_free(&accessor->ret); + + free(accessor); +} + +static void _eo_tokenizer_property_def_free(Eo_Property_Def *prop) { Eo_Param_Def *param; - - _eo_tokenizer_ret_free(&prop->ret); + Eo_Accessor_Def *accessor; if (prop->name) eina_stringshare_del(prop->name); - if (prop->comment) - eina_stringshare_del(prop->comment); EINA_LIST_FREE(prop->params, param) _eo_tokenizer_param_free(param); + EINA_LIST_FREE(prop->accessors, accessor) + _eo_tokenizer_accessor_free(accessor); + free(prop); } -- cgit v1.1-2-g2b99