elm_code: update syntax symbols for C

Also don't hard code preprocessing parse
This commit is contained in:
Andy Williams 2017-02-03 17:13:27 +00:00
parent 3cc60ce5f3
commit e8e72fb959
1 changed files with 4 additions and 2 deletions

View File

@ -10,6 +10,7 @@
typedef struct _Elm_Code_Syntax
{
const char *symbols;
const char *preprocessor;
const char *comment_single;
const char *comment_start;
const char *comment_end;
@ -18,7 +19,8 @@ typedef struct _Elm_Code_Syntax
static Elm_Code_Syntax _elm_code_syntax_c =
{
"{}()[]:;/*+&|!=<->,.",
"{}()[]:;%^/*+&|~!=<->,.",
"#",
"//",
"/*",
"*/",
@ -161,7 +163,7 @@ elm_code_syntax_parse_line(Elm_Code_Syntax *syntax, Elm_Code_Line *line)
continue;
}
if (content[i] == '#')
if (syntax->preprocessor && _content_starts_with(content+i, syntax->preprocessor, strlen(syntax->preprocessor)))
{
elm_code_line_token_add(line, i, length - 1, 1, ELM_CODE_TOKEN_TYPE_PREPROCESSOR);
return;