Skip to content
Snippets Groups Projects
Commit 474f94ef authored by Lactozilla's avatar Lactozilla :speech_balloon:
Browse files

Fix escaping of '{'

parent 2f56d1ee
Branches
No related tags found
No related merge requests found
...@@ -268,6 +268,10 @@ static char *EscapeStringChars(const char *string, int tokenizer_line) ...@@ -268,6 +268,10 @@ static char *EscapeStringChars(const char *string, int tokenizer_line)
case '\'': case '\'':
BUFWRITE('\''); BUFWRITE('\'');
break; break;
case '{':
BUFWRITE('\\');
BUFWRITE('{');
break;
case 'x': { case 'x': {
int out = 0, c; int out = 0, c;
int i = 0; int i = 0;
...@@ -319,6 +323,8 @@ static char *EscapeStringChars(const char *string, int tokenizer_line) ...@@ -319,6 +323,8 @@ static char *EscapeStringChars(const char *string, int tokenizer_line)
BUFWRITE((char)out); BUFWRITE((char)out);
} }
else
ParseError(tokenizer_line, CONS_WARNING, "In string: unknown escape sequence '\\%c'", chr);
break; break;
} }
} }
...@@ -659,16 +665,15 @@ static char *ParseText(char *text, size_t *text_length, boolean parse_scripts, i ...@@ -659,16 +665,15 @@ static char *ParseText(char *text, size_t *text_length, boolean parse_scripts, i
if (chr == '\\') if (chr == '\\')
{ {
if (input[1] == '{') unsigned char nextchar = input[1];
if (nextchar == '{')
{ {
WRITE_TEXTCHAR(input[1]); WRITE_TEXTCHAR(nextchar);
input += 2; input++;
} }
else else
WRITE_TEXTCHAR(chr); WRITE_TEXTCHAR(chr);
} }
else if (chr == 0xFF)
; // Just ignore it
else if (chr == '{') else if (chr == '{')
{ {
input++; input++;
...@@ -680,6 +685,8 @@ static char *ParseText(char *text, size_t *text_length, boolean parse_scripts, i ...@@ -680,6 +685,8 @@ static char *ParseText(char *text, size_t *text_length, boolean parse_scripts, i
GetCommandEnd(&input); GetCommandEnd(&input);
} }
else if (chr == 0xFF)
; // Just ignore it
else else
WRITE_TEXTCHAR(chr); WRITE_TEXTCHAR(chr);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment