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
This commit is contained in:
Mykyta Biliavskyi 2015-06-16 13:38:06 +09:00 committed by ChunEon Park
parent 97941ff378
commit ee415fa135
2 changed files with 37 additions and 5 deletions

View File

@ -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++;
}

View File

@ -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