mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-21 02:32:06 +00:00
Fix comment bug
There is a bug in processing the comments in source files. It's related to #326. And this bug comes out when you comment something with the character ';', and include the quotation mark without its pair in it. The lastest version of rgbds compiler has a step to parse the given source to convert its line endings to a unified one, and it processes quotation marks even before it processes the comments. I edited a little bit of the source, and it works fine now.
This commit is contained in:
@@ -181,16 +181,10 @@ YY_BUFFER_STATE yy_create_buffer(FILE *f)
|
|||||||
/* Convert all line endings to LF and spaces */
|
/* Convert all line endings to LF and spaces */
|
||||||
|
|
||||||
char *mem = pBuffer->pBuffer;
|
char *mem = pBuffer->pBuffer;
|
||||||
uint32_t instring = 0;
|
|
||||||
|
|
||||||
while (*mem) {
|
while (*mem) {
|
||||||
if (*mem == '\"')
|
|
||||||
instring = 1 - instring;
|
|
||||||
|
|
||||||
if ((mem[0] == '\\') && (mem[1] == '\"' || mem[1] == '\\')) {
|
if ((mem[0] == '\\') && (mem[1] == '\"' || mem[1] == '\\')) {
|
||||||
mem += 2;
|
mem += 2;
|
||||||
} else if (instring) {
|
|
||||||
mem += 1;
|
|
||||||
} else {
|
} else {
|
||||||
/* LF CR and CR LF */
|
/* LF CR and CR LF */
|
||||||
if (((mem[0] == 10) && (mem[1] == 13))
|
if (((mem[0] == 10) && (mem[1] == 13))
|
||||||
@@ -211,7 +205,7 @@ YY_BUFFER_STATE yy_create_buffer(FILE *f)
|
|||||||
/* Remove comments */
|
/* Remove comments */
|
||||||
|
|
||||||
mem = pBuffer->pBuffer;
|
mem = pBuffer->pBuffer;
|
||||||
instring = 0;
|
uint32_t instring = 0;
|
||||||
|
|
||||||
while (*mem) {
|
while (*mem) {
|
||||||
if (*mem == '\"')
|
if (*mem == '\"')
|
||||||
|
|||||||
Reference in New Issue
Block a user