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:
parent
97941ff378
commit
ee415fa135
|
@ -122,11 +122,26 @@ context_lexem_thread_cb(void *data, Ecore_Thread *thread EINA_UNUSED)
|
||||||
const int quot_len = QUOT_UTF8_LEN;
|
const int quot_len = QUOT_UTF8_LEN;
|
||||||
int quot_cnt = 0;
|
int quot_cnt = 0;
|
||||||
|
|
||||||
while (cur <= end)
|
while (cur && cur <= end)
|
||||||
{
|
{
|
||||||
if ((cur!=end) && (!strncmp(cur, quot, quot_len)))
|
if ((cur!=end) && (!strncmp(cur, quot, quot_len)))
|
||||||
quot_cnt++;
|
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 == '{')
|
if (*cur == '{')
|
||||||
{
|
{
|
||||||
for (help_end_ptr = cur;
|
for (help_end_ptr = cur;
|
||||||
|
@ -145,7 +160,7 @@ context_lexem_thread_cb(void *data, Ecore_Thread *thread EINA_UNUSED)
|
||||||
if (*cur == '}')
|
if (*cur == '}')
|
||||||
{
|
{
|
||||||
memset(stack[depth], 0x0, 40);
|
memset(stack[depth], 0x0, 40);
|
||||||
depth--;
|
if (depth > 0) depth--;
|
||||||
}
|
}
|
||||||
cur++;
|
cur++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -260,7 +260,7 @@ cur_state_thread_blocking(void *data, Ecore_Thread *thread EINA_UNUSED)
|
||||||
td->group_name = NULL;
|
td->group_name = NULL;
|
||||||
td->state_name = NULL;
|
td->state_name = NULL;
|
||||||
|
|
||||||
while (p <= end)
|
while (p && p <= end)
|
||||||
{
|
{
|
||||||
//Skip "" range
|
//Skip "" range
|
||||||
if (!strncmp(p, quot, quot_len))
|
if (!strncmp(p, quot, quot_len))
|
||||||
|
@ -277,6 +277,20 @@ cur_state_thread_blocking(void *data, Ecore_Thread *thread EINA_UNUSED)
|
||||||
p++;
|
p++;
|
||||||
continue;
|
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
|
//Check whether outside of description or part or group
|
||||||
if ((*p == '}') && (p < end))
|
if ((*p == '}') && (p < end))
|
||||||
|
@ -337,8 +351,11 @@ cur_state_thread_blocking(void *data, Ecore_Thread *thread EINA_UNUSED)
|
||||||
}
|
}
|
||||||
value++;
|
value++;
|
||||||
}
|
}
|
||||||
value_convert = atof(value_buf);
|
if (value_buf)
|
||||||
free(value_buf);
|
{
|
||||||
|
value_convert = atof(value_buf);
|
||||||
|
free(value_buf);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//Check Group in
|
//Check Group in
|
||||||
|
|
Loading…
Reference in New Issue