summaryrefslogtreecommitdiff
path: root/src/lib/eolian/eo_parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/eolian/eo_parser.c')
-rw-r--r--src/lib/eolian/eo_parser.c34
1 files changed, 3 insertions, 31 deletions
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index f4bcb83724..ddb49f30c1 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -684,38 +684,10 @@ _parse_dep(Eo_Lexer *ls, const char *fname, const char *name)
684 } 684 }
685} 685}
686 686
687static const Eina_Bool _ownable_types[] = {
688 EINA_FALSE, /* unknown */
689 EINA_FALSE, /* void */
690 EINA_FALSE, /* regular */
691 EINA_TRUE, /* complex */
692 EINA_TRUE, /* pointer */
693 EINA_TRUE, /* class */
694 EINA_TRUE, /* static array */
695 EINA_TRUE, /* terminated array */
696 EINA_FALSE /* undefined */
697};
698
699static Eina_Bool
700_type_is_ownable(Eolian_Type *tp)
701{
702 if (tp->is_ptr)
703 return EINA_TRUE;
704 if (tp->type == EOLIAN_TYPE_REGULAR)
705 {
706 int kwid = eo_lexer_keyword_str_to_id(tp->name);
707 const char *ct = eo_lexer_get_c_type(kwid);
708 if (!ct)
709 return EINA_FALSE;
710 return (ct[strlen(ct) - 1] == '*');
711 }
712 return _ownable_types[tp->type];
713}
714
715static Eina_Bool 687static Eina_Bool
716_type_is_terminatable(Eolian_Type *tp) 688_type_is_terminatable(Eolian_Type *tp)
717{ 689{
718 if (_type_is_ownable(tp)) 690 if (database_type_is_ownable(tp))
719 return EINA_TRUE; 691 return EINA_TRUE;
720 if (tp->type == EOLIAN_TYPE_REGULAR) 692 if (tp->type == EOLIAN_TYPE_REGULAR)
721 { 693 {
@@ -769,7 +741,7 @@ parse_type_void(Eo_Lexer *ls, Eina_Bool allow_ref, Eina_Bool allow_sarray)
769 check_next(ls, '('); 741 check_next(ls, '(');
770 eo_lexer_context_push(ls); 742 eo_lexer_context_push(ls);
771 def = parse_type_void(ls, allow_ref, EINA_FALSE); 743 def = parse_type_void(ls, allow_ref, EINA_FALSE);
772 if (!_type_is_ownable(def)) 744 if (!database_type_is_ownable(def))
773 { 745 {
774 eo_lexer_context_restore(ls); 746 eo_lexer_context_restore(ls);
775 eo_lexer_syntax_error(ls, "ownable type expected"); 747 eo_lexer_syntax_error(ls, "ownable type expected");
@@ -789,7 +761,7 @@ parse_type_void(Eo_Lexer *ls, Eina_Bool allow_ref, Eina_Bool allow_sarray)
789 check_next(ls, '('); 761 check_next(ls, '(');
790 eo_lexer_context_push(ls); 762 eo_lexer_context_push(ls);
791 def = parse_type_void(ls, allow_ref, EINA_FALSE); 763 def = parse_type_void(ls, allow_ref, EINA_FALSE);
792 if (!_type_is_ownable(def)) 764 if (!database_type_is_ownable(def))
793 { 765 {
794 eo_lexer_context_restore(ls); 766 eo_lexer_context_restore(ls);
795 eo_lexer_syntax_error(ls, "freeable type expected"); 767 eo_lexer_syntax_error(ls, "freeable type expected");