string block works
This commit is contained in:
parent
0e35b78508
commit
d77aa85d4e
40
src/code.c
40
src/code.c
|
@ -411,6 +411,7 @@ static void parse(const char* start, u8* color)
|
|||
const char* ptr = start;
|
||||
|
||||
const char* blockCommentStart = NULL;
|
||||
const char* blockStringStart = NULL;
|
||||
|
||||
static const char BlockCommentStart[] = "--[[";
|
||||
static const char BlockCommentEnd[] = "]]";
|
||||
|
@ -427,6 +428,36 @@ static void parse(const char* start, u8* color)
|
|||
memset(color + (blockCommentStart - start), getConfig()->theme.code.comment, ptr - blockCommentStart);
|
||||
blockCommentStart = NULL;
|
||||
}
|
||||
else if(blockStringStart)
|
||||
{
|
||||
const char* blockStart = blockStringStart+1;
|
||||
|
||||
while(true)
|
||||
{
|
||||
const char* pos = strchr(blockStart, *blockStringStart);
|
||||
|
||||
if(pos)
|
||||
{
|
||||
if(*(pos-1) == '\\' && *(pos-2) != '\\')
|
||||
{
|
||||
blockStart = pos + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr = pos + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr = blockStringStart + strlen(blockStringStart);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
memset(color + (blockStringStart - start), getConfig()->theme.code.string, ptr - blockStringStart);
|
||||
blockStringStart = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
s32 blockCommentStartSize = strlen(BlockCommentStart);
|
||||
|
@ -437,10 +468,19 @@ static void parse(const char* start, u8* color)
|
|||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(c == '"' || c == '\'')
|
||||
{
|
||||
blockStringStart = ptr;
|
||||
ptr += 1;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// do other stuff
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// static const char Comment = '-';
|
||||
// const char* singleCommentStart = NULL;
|
||||
|
|
Loading…
Reference in New Issue