summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJee-Yong Um <conr2d@gmail.com>2016-09-23 11:56:19 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-09-23 11:56:19 +0900
commited7febb2c542ec2c735aaf411e25c36ef4ce002a (patch)
tree7d829a6249a03b3598e47f4f6b1e61370524bd1e
parentef759b63951c0fffb61cf8366c0aff884301b5df (diff)
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
-rw-r--r--src/Makefile_Edje.am2
-rw-r--r--src/bin/edje/edje_cc.h3
-rw-r--r--src/bin/edje/edje_cc_handlers.c6
-rw-r--r--src/bin/edje/edje_cc_parse.c43
-rw-r--r--src/tests/edje/data/test_combine_keywords.edc10
-rw-r--r--src/tests/edje/edje_test_edje.c15
6 files changed, 72 insertions, 7 deletions
diff --git a/src/Makefile_Edje.am b/src/Makefile_Edje.am
index 4ecaa65b2f..5c3e0de18d 100644
--- a/src/Makefile_Edje.am
+++ b/src/Makefile_Edje.am
@@ -273,6 +273,7 @@ tests/edje/data/test_color_class.edc \
273tests/edje/data/test_swallows.edc \ 273tests/edje/data/test_swallows.edc \
274tests/edje/data/test_box.edc \ 274tests/edje/data/test_box.edc \
275tests/edje/data/test_table.edc \ 275tests/edje/data/test_table.edc \
276tests/edje/data/test_combine_keywords.edc \
276tests/edje/data/filter.lua 277tests/edje/data/filter.lua
277 278
278 279
@@ -312,6 +313,7 @@ EDJE_TEST_FILES = tests/edje/data/test_layout.edj \
312 tests/edje/data/test_color_class.edj \ 313 tests/edje/data/test_color_class.edj \
313 tests/edje/data/test_box.edj \ 314 tests/edje/data/test_box.edj \
314 tests/edje/data/test_table.edj \ 315 tests/edje/data/test_table.edj \
316 tests/edje/data/test_combine_keywords.edj \
315 $(NULL) 317 $(NULL)
316 318
317CLEANFILES += $(EDJE_TEST_FILES) 319CLEANFILES += $(EDJE_TEST_FILES)
diff --git a/src/bin/edje/edje_cc.h b/src/bin/edje/edje_cc.h
index 91371baf53..9e47283dde 100644
--- a/src/bin/edje/edje_cc.h
+++ b/src/bin/edje/edje_cc.h
@@ -247,7 +247,8 @@ void using_file(const char *filename, const char type);
247void error_and_abort(Eet_File *ef, const char *fmt, ...); 247void error_and_abort(Eet_File *ef, const char *fmt, ...);
248 248
249void stack_push_quick(const char *str); 249void stack_push_quick(const char *str);
250void stack_pop_quick(Eina_Bool check_last, Eina_Bool do_free); 250char *stack_pop_quick(Eina_Bool check_last, Eina_Bool do_free);
251void stack_replace_quick(const char *token);
251Eina_Bool edje_cc_handlers_wildcard(void); 252Eina_Bool edje_cc_handlers_wildcard(void);
252void edje_cc_handlers_hierarchy_alloc(void); 253void edje_cc_handlers_hierarchy_alloc(void);
253void edje_cc_handlers_hierarchy_free(void); 254void edje_cc_handlers_hierarchy_free(void);
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c
index efe728f286..b0fdb492d2 100644
--- a/src/bin/edje/edje_cc_handlers.c
+++ b/src/bin/edje/edje_cc_handlers.c
@@ -5951,8 +5951,7 @@ ob_collections_group_parts_part_short(void)
5951 "vector", EDJE_PART_TYPE_VECTOR, 5951 "vector", EDJE_PART_TYPE_VECTOR,
5952 NULL); 5952 NULL);
5953 5953
5954 stack_pop_quick(EINA_TRUE, EINA_TRUE); 5954 stack_replace_quick("part");
5955 stack_push_quick("part");
5956 _part_create(); 5955 _part_create();
5957 _part_type_set(type); 5956 _part_type_set(type);
5958} 5957}
@@ -7990,8 +7989,7 @@ ob_collections_group_parts_part_description(void)
7990static void 7989static void
7991ob_collections_group_parts_part_desc(void) 7990ob_collections_group_parts_part_desc(void)
7992{ 7991{
7993 stack_pop_quick(EINA_TRUE, EINA_TRUE); 7992 stack_replace_quick("description");
7994 stack_push_quick("description");
7995 ob_collections_group_parts_part_description(); 7993 ob_collections_group_parts_part_description();
7996} 7994}
7997 7995
diff --git a/src/bin/edje/edje_cc_parse.c b/src/bin/edje/edje_cc_parse.c
index 525c71d394..e5a73862c0 100644
--- a/src/bin/edje/edje_cc_parse.c
+++ b/src/bin/edje/edje_cc_parse.c
@@ -672,7 +672,7 @@ stack_push_quick(const char *str)
672 eina_strbuf_append(stack_buf, s); 672 eina_strbuf_append(stack_buf, s);
673} 673}
674 674
675void 675char *
676stack_pop_quick(Eina_Bool check_last, Eina_Bool do_free) 676stack_pop_quick(Eina_Bool check_last, Eina_Bool do_free)
677{ 677{
678 char *tmp, *str; 678 char *tmp, *str;
@@ -690,7 +690,46 @@ stack_pop_quick(Eina_Bool check_last, Eina_Bool do_free)
690 eina_strbuf_length_get(stack_buf) - strlen(tmp) - 1, 690 eina_strbuf_length_get(stack_buf) - strlen(tmp) - 1,
691 eina_strbuf_length_get(stack_buf)); /* remove: '.tmp' */ 691 eina_strbuf_length_get(stack_buf)); /* remove: '.tmp' */
692 stack = eina_list_remove_list(stack, eina_list_last(stack)); 692 stack = eina_list_remove_list(stack, eina_list_last(stack));
693 if (do_free) free(str); 693 if (do_free)
694 {
695 free(str);
696 str = NULL;
697 }
698 return str;
699}
700
701/* replace the top of stack with given token */
702void
703stack_replace_quick(const char *token)
704{
705 char *str;
706
707 str = stack_pop_quick(EINA_FALSE, EINA_FALSE);
708 if ((str) && strchr(str, '.'))
709 {
710 char *end, *tmp = str;
711 Eina_Strbuf *buf;
712
713 end = strchr(tmp, '.');
714 if (end)
715 tmp = end + 1;
716
717 buf = eina_strbuf_new();
718 eina_strbuf_append(buf, str);
719 eina_strbuf_remove(buf,
720 eina_strbuf_length_get(buf) - strlen(tmp),
721 eina_strbuf_length_get(buf));
722 eina_strbuf_append(buf, token);
723
724 stack_push_quick(eina_strbuf_string_get(buf));
725
726 eina_strbuf_free(buf);
727 free(str);
728 }
729 else
730 {
731 stack_push_quick(token);
732 }
694} 733}
695 734
696static const char * 735static const char *
diff --git a/src/tests/edje/data/test_combine_keywords.edc b/src/tests/edje/data/test_combine_keywords.edc
new file mode 100644
index 0000000000..76b70a029f
--- /dev/null
+++ b/src/tests/edje/data/test_combine_keywords.edc
@@ -0,0 +1,10 @@
1collections {
2 group { "test_group";
3 parts.rect { "base";
4 }
5 }
6 group { "test_group2";
7 parts.rect { "base";
8 }
9 }
10}
diff --git a/src/tests/edje/edje_test_edje.c b/src/tests/edje/edje_test_edje.c
index c681e02b0f..e2723d8ee5 100644
--- a/src/tests/edje/edje_test_edje.c
+++ b/src/tests/edje/edje_test_edje.c
@@ -711,6 +711,20 @@ START_TEST(edje_test_table_eoapi)
711} 711}
712END_TEST 712END_TEST
713 713
714START_TEST(edje_test_combine_keywords)
715{
716 Evas *evas;
717 Evas_Object *obj;
718
719 evas = EDJE_TEST_INIT_EVAS();
720
721 obj = edje_object_add(evas);
722 fail_unless(edje_object_file_set(obj, test_layout_get("test_combine_keywords.edj"), "test_group"));
723
724 EDJE_TEST_FREE_EVAS();
725}
726END_TEST
727
714void edje_test_edje(TCase *tc) 728void edje_test_edje(TCase *tc)
715{ 729{
716 tcase_add_test(tc, edje_test_edje_init); 730 tcase_add_test(tc, edje_test_edje_init);
@@ -731,4 +745,5 @@ void edje_test_edje(TCase *tc)
731 tcase_add_test(tc, edje_test_box_eoapi); 745 tcase_add_test(tc, edje_test_box_eoapi);
732 tcase_add_test(tc, edje_test_table); 746 tcase_add_test(tc, edje_test_table);
733 tcase_add_test(tc, edje_test_table_eoapi); 747 tcase_add_test(tc, edje_test_table_eoapi);
748 tcase_add_test(tc, edje_test_combine_keywords);
734} 749}