mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-01-19 06:40:49 +00:00
string-literals now do not treat digraphs as digraphs
This commit is contained in:
parent
90419eb13c
commit
415816e4dc
4 changed files with 8 additions and 5 deletions
4
lexer.c
4
lexer.c
|
@ -259,7 +259,7 @@ static int lex_getch(lex_file *lex)
|
||||||
lex->line++;
|
lex->line++;
|
||||||
else if (ch == '?')
|
else if (ch == '?')
|
||||||
return lex_try_trigraph(lex, ch);
|
return lex_try_trigraph(lex, ch);
|
||||||
else if (ch == '<' || ch == ':' || ch == '%')
|
else if (!lex->flags.nodigraphs && (ch == '<' || ch == ':' || ch == '%'))
|
||||||
return lex_try_digraph(lex, ch);
|
return lex_try_digraph(lex, ch);
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
@ -998,6 +998,7 @@ int lex_do(lex_file *lex)
|
||||||
|
|
||||||
if (ch == '"')
|
if (ch == '"')
|
||||||
{
|
{
|
||||||
|
lex->flags.nodigraphs = true;
|
||||||
lex->tok.ttype = lex_finish_string(lex, '"');
|
lex->tok.ttype = lex_finish_string(lex, '"');
|
||||||
while (lex->tok.ttype == TOKEN_STRINGCONST)
|
while (lex->tok.ttype == TOKEN_STRINGCONST)
|
||||||
{
|
{
|
||||||
|
@ -1010,6 +1011,7 @@ int lex_do(lex_file *lex)
|
||||||
|
|
||||||
lex->tok.ttype = lex_finish_string(lex, '"');
|
lex->tok.ttype = lex_finish_string(lex, '"');
|
||||||
}
|
}
|
||||||
|
lex->flags.nodigraphs = false;
|
||||||
if (!lex_endtoken(lex))
|
if (!lex_endtoken(lex))
|
||||||
return (lex->tok.ttype = TOKEN_FATAL);
|
return (lex->tok.ttype = TOKEN_FATAL);
|
||||||
return lex->tok.ttype;
|
return lex->tok.ttype;
|
||||||
|
|
1
lexer.h
1
lexer.h
|
@ -108,6 +108,7 @@ typedef struct {
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool noops;
|
bool noops;
|
||||||
|
bool nodigraphs; /* used when lexing string constants */
|
||||||
} flags;
|
} flags;
|
||||||
|
|
||||||
int framevalue;
|
int framevalue;
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
#^[]|{}~\
|
#^[]|{}~\%>
|
||||||
#^[]|{}~\
|
#^[]|{}~\%>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
void(string, string) print = %:1;
|
void(string, string) print = %:1;
|
||||||
|
|
||||||
void() main = ??<
|
void() main = ??<
|
||||||
print("??=??'??(??)??!??<??>??-??/??/", "??/n");
|
print("??=??'??(??)??!??<??>??-??/??/%>", "??/n");
|
||||||
print("#^[]|{}~\\", "\n");
|
print("#^[]|{}~\\%>", "\n");
|
||||||
%>;
|
%>;
|
||||||
|
|
Loading…
Reference in a new issue