syntax_color: apply string syntax color prior to others.

even if the comments are inside of the qutoes,
the comments syntax color should not be applied.
This commit is contained in:
ChunEon Park 2015-07-04 01:08:01 +09:00
parent 6b6f4b19c1
commit d2e3c6dc6b
1 changed files with 14 additions and 14 deletions

View File

@ -860,6 +860,20 @@ color_apply(color_data *cd, const char *src, int length, char *from, char *to)
}
}
//escape string: " ~ "
ret = string_apply(strbuf, &cur, &prev, cd->col_string, inside_string);
if (ret == 1)
{
inside_string = !inside_string;
continue;
}
if (inside_string || inside_comment)
{
cur++;
continue;
}
//handle comment: /* ~ */
ret = comment_apply(strbuf, &src, length, &cur, &prev, cd->col_comment,
&inside_comment);
@ -875,20 +889,6 @@ color_apply(color_data *cd, const char *src, int length, char *from, char *to)
else if (ret == -1) goto finished;
}
//escape string: " ~ "
ret = string_apply(strbuf, &cur, &prev, cd->col_string, inside_string);
if (ret == 1)
{
inside_string = !inside_string;
continue;
}
if (inside_string || inside_comment)
{
cur++;
continue;
}
//handle comment: preprocessors, #
ret = macro_apply(strbuf, &src, length, &cur, &prev, cd->col_macro, cd);
if (ret == 1) continue;