hermet pushed a commit to branch master. http://git.enlightenment.org/tools/enventor.git/commit/?id=ee415fa135e706c603a384b009177ae0fb86b5d2
commit ee415fa135e706c603a384b009177ae0fb86b5d2 Author: Mykyta Biliavskyi <m.biliavs...@samsung.com> Date: Tue Jun 16 13:38:06 2015 +0900 Parser: recognize comments in code. Summary: For cur_state_get in parser module and context_lexem_get in auto complete module add abiliti to recognize commented lines. fix T2482 Reviewers: Hermet, Jaehyun, jpeg Reviewed By: jpeg Maniphest Tasks: T2482 Differential Revision: https://phab.enlightenment.org/D2677 --- src/lib/auto_comp.c | 19 +++++++++++++++++-- src/lib/edc_parser.c | 23 ++++++++++++++++++++--- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/src/lib/auto_comp.c b/src/lib/auto_comp.c index d50cc72..2c90043 100644 --- a/src/lib/auto_comp.c +++ b/src/lib/auto_comp.c @@ -122,11 +122,26 @@ context_lexem_thread_cb(void *data, Ecore_Thread *thread EINA_UNUSED) const int quot_len = QUOT_UTF8_LEN; int quot_cnt = 0; - while (cur <= end) + while (cur && cur <= end) { if ((cur!=end) && (!strncmp(cur, quot, quot_len))) quot_cnt++; + //Check inside comment + if (*cur == '/') + { + if (cur[1] == '/') + { + cur = strchr(cur, '\n'); + continue; + } + else if (cur[1] == '*') + { + cur = strstr(cur, "*/"); + continue; + } + } + if (*cur == '{') { for (help_end_ptr = cur; @@ -145,7 +160,7 @@ context_lexem_thread_cb(void *data, Ecore_Thread *thread EINA_UNUSED) if (*cur == '}') { memset(stack[depth], 0x0, 40); - depth--; + if (depth > 0) depth--; } cur++; } diff --git a/src/lib/edc_parser.c b/src/lib/edc_parser.c index 8078415..cb583e9 100644 --- a/src/lib/edc_parser.c +++ b/src/lib/edc_parser.c @@ -260,7 +260,7 @@ cur_state_thread_blocking(void *data, Ecore_Thread *thread EINA_UNUSED) td->group_name = NULL; td->state_name = NULL; - while (p <= end) + while (p && p <= end) { //Skip "" range if (!strncmp(p, quot, quot_len)) @@ -277,6 +277,20 @@ cur_state_thread_blocking(void *data, Ecore_Thread *thread EINA_UNUSED) p++; continue; } + //Check inside comment + if (*p == '/') + { + if (p[1] == '/') + { + p = strchr(p, '\n'); + continue; + } + else if (p[1] == '*') + { + p = strstr(p, "*/"); + continue; + } + } //Check whether outside of description or part or group if ((*p == '}') && (p < end)) @@ -337,8 +351,11 @@ cur_state_thread_blocking(void *data, Ecore_Thread *thread EINA_UNUSED) } value++; } - value_convert = atof(value_buf); - free(value_buf); + if (value_buf) + { + value_convert = atof(value_buf); + free(value_buf); + } continue; } //Check Group in --