edje_cc: allow combine lazEDC keywords

Summary:
Fix parsing error which occurs when lazEDC keyword is combined
with other keyword by period. (like parts.rect)

@fix

Test Plan: Download attached file and run "make"

Reviewers: Hermet, cedric, jpeg

Subscribers: taxi2se

Differential Revision: https://phab.enlightenment.org/D4309
This commit is contained in:
Jee-Yong Um 2016-09-23 11:56:19 +09:00 committed by Jean-Philippe Andre
parent ef759b6395
commit ed7febb2c5
6 changed files with 72 additions and 7 deletions

View File

@ -273,6 +273,7 @@ tests/edje/data/test_color_class.edc \
tests/edje/data/test_swallows.edc \
tests/edje/data/test_box.edc \
tests/edje/data/test_table.edc \
tests/edje/data/test_combine_keywords.edc \
tests/edje/data/filter.lua
@ -312,6 +313,7 @@ EDJE_TEST_FILES = tests/edje/data/test_layout.edj \
tests/edje/data/test_color_class.edj \
tests/edje/data/test_box.edj \
tests/edje/data/test_table.edj \
tests/edje/data/test_combine_keywords.edj \
$(NULL)
CLEANFILES += $(EDJE_TEST_FILES)

View File

@ -247,7 +247,8 @@ void using_file(const char *filename, const char type);
void error_and_abort(Eet_File *ef, const char *fmt, ...);
void stack_push_quick(const char *str);
void stack_pop_quick(Eina_Bool check_last, Eina_Bool do_free);
char *stack_pop_quick(Eina_Bool check_last, Eina_Bool do_free);
void stack_replace_quick(const char *token);
Eina_Bool edje_cc_handlers_wildcard(void);
void edje_cc_handlers_hierarchy_alloc(void);
void edje_cc_handlers_hierarchy_free(void);

View File

@ -5951,8 +5951,7 @@ ob_collections_group_parts_part_short(void)
"vector", EDJE_PART_TYPE_VECTOR,
NULL);
stack_pop_quick(EINA_TRUE, EINA_TRUE);
stack_push_quick("part");
stack_replace_quick("part");
_part_create();
_part_type_set(type);
}
@ -7990,8 +7989,7 @@ ob_collections_group_parts_part_description(void)
static void
ob_collections_group_parts_part_desc(void)
{
stack_pop_quick(EINA_TRUE, EINA_TRUE);
stack_push_quick("description");
stack_replace_quick("description");
ob_collections_group_parts_part_description();
}

View File

@ -672,7 +672,7 @@ stack_push_quick(const char *str)
eina_strbuf_append(stack_buf, s);
}
void
char *
stack_pop_quick(Eina_Bool check_last, Eina_Bool do_free)
{
char *tmp, *str;
@ -690,7 +690,46 @@ stack_pop_quick(Eina_Bool check_last, Eina_Bool do_free)
eina_strbuf_length_get(stack_buf) - strlen(tmp) - 1,
eina_strbuf_length_get(stack_buf)); /* remove: '.tmp' */
stack = eina_list_remove_list(stack, eina_list_last(stack));
if (do_free) free(str);
if (do_free)
{
free(str);
str = NULL;
}
return str;
}
/* replace the top of stack with given token */
void
stack_replace_quick(const char *token)
{
char *str;
str = stack_pop_quick(EINA_FALSE, EINA_FALSE);
if ((str) && strchr(str, '.'))
{
char *end, *tmp = str;
Eina_Strbuf *buf;
end = strchr(tmp, '.');
if (end)
tmp = end + 1;
buf = eina_strbuf_new();
eina_strbuf_append(buf, str);
eina_strbuf_remove(buf,
eina_strbuf_length_get(buf) - strlen(tmp),
eina_strbuf_length_get(buf));
eina_strbuf_append(buf, token);
stack_push_quick(eina_strbuf_string_get(buf));
eina_strbuf_free(buf);
free(str);
}
else
{
stack_push_quick(token);
}
}
static const char *

View File

@ -0,0 +1,10 @@
collections {
group { "test_group";
parts.rect { "base";
}
}
group { "test_group2";
parts.rect { "base";
}
}
}

View File

@ -711,6 +711,20 @@ START_TEST(edje_test_table_eoapi)
}
END_TEST
START_TEST(edje_test_combine_keywords)
{
Evas *evas;
Evas_Object *obj;
evas = EDJE_TEST_INIT_EVAS();
obj = edje_object_add(evas);
fail_unless(edje_object_file_set(obj, test_layout_get("test_combine_keywords.edj"), "test_group"));
EDJE_TEST_FREE_EVAS();
}
END_TEST
void edje_test_edje(TCase *tc)
{
tcase_add_test(tc, edje_test_edje_init);
@ -731,4 +745,5 @@ void edje_test_edje(TCase *tc)
tcase_add_test(tc, edje_test_box_eoapi);
tcase_add_test(tc, edje_test_table);
tcase_add_test(tc, edje_test_table_eoapi);
tcase_add_test(tc, edje_test_combine_keywords);
}