diff options
author | ChunEon Park <chuneon.park@samsung.com> | 2013-06-06 18:48:48 +0900 |
---|---|---|
committer | Sungho Kwak <sungho1.kwak@samsung.com> | 2013-06-11 20:10:20 +0900 |
commit | e47cce31baecbe6bc85101ee5e16e84f6da19fce (patch) | |
tree | a36d45ffb847a46cc0c559afb4033084722170e6 | |
parent | 9955adf10a5c2b2c442d0726c8e7dece537d7f9f (diff) | |
download | edje-e47cce31baecbe6bc85101ee5e16e84f6da19fce.tar.gz edje-e47cce31baecbe6bc85101ee5e16e84f6da19fce.tar.bz2 edje-e47cce31baecbe6bc85101ee5e16e84f6da19fce.zip |
edje/edje_cc_parser - support [] markers for indexing values
commit 86f37578faf74be6748ac1eb40ea5bd0da57ba1c
Author: ChunEon Park <hermet>@hermet.pe.kr>
Date: Tue Jun 4 14:30:07 2013 +0900
Change-Id: I5df724a1792c72a876f2b901b1e4f46c19023d87
-rw-r--r-- | src/bin/edje_cc_parse.c | 58 |
1 files changed, 46 insertions, 12 deletions
diff --git a/src/bin/edje_cc_parse.c b/src/bin/edje_cc_parse.c index 9695700..7c65d88 100644 --- a/src/bin/edje_cc_parse.c +++ b/src/bin/edje_cc_parse.c @@ -231,7 +231,7 @@ perform_math (char *input) static int isdelim(char c) { - const char *delims = "{},;:"; + const char *delims = "{},;:[]"; char *d; d = (char *)delims; @@ -560,6 +560,7 @@ parse(char *data, off_t size) char *p, *end, *token; int delim = 0; int do_params = 0; + int do_indexes = 0; // 0: none, 1: ready, 2: done DBG("Parsing input file"); @@ -582,7 +583,14 @@ parse(char *data, off_t size) } else if (delim) { - if (*token == ',' || *token == ':') do_params = 1; + if ((do_indexes == 2) && (*token != ']')) + { + ERR("parse error %s:%i. %c marker before ] marker", + file_in, line - 1, *token); + err_show(); + exit(-1); + } + else if (*token == ',' || *token == ':') do_params = 1; else if (*token == '}') { if (do_params) @@ -617,19 +625,45 @@ parse(char *data, off_t size) ERR("parse error %s:%i. { marker before ; marker", file_in, line - 1); err_show(); - exit(-1); - } - } - free(token); - } - else - { - if (do_params) + exit(-1); + } + } + else if (*token == '[') + { + do_indexes = 1; + } + else if (*token == ']') + { + if (do_indexes == 2) + do_indexes = 0; + else + { + if (do_indexes == 0) + ERR("parse error %s:%i. ] marker before [ marker", + file_in, line - 1); + else + ERR("parse error %s:%i. [?] empty bracket", + file_in, line - 1); + + err_show(); + exit(-1); + } + } + free(token); + } + else + { + if (do_params) { eina_array_push(¶ms, token); } - else - { + else if (do_indexes) + { + do_indexes++; + eina_array_push(¶ms, token); + } + else + { stack_push(token); new_object(); if ((verbatim == 1) && (p < (end - 2))) |