diff --git a/tools/qfcc/source/pr_lex.c b/tools/qfcc/source/pr_lex.c index e71b6ba32..d6219d228 100644 --- a/tools/qfcc/source/pr_lex.c +++ b/tools/qfcc/source/pr_lex.c @@ -106,12 +106,13 @@ PR_LexString (void) int i; int mask; int boldnext; + int quote; pr_token_len = 0; mask = 0x00; boldnext = 0; - pr_file_p++; + quote = *pr_file_p++; do { c = *pr_file_p++; if (!c) @@ -123,12 +124,18 @@ PR_LexString (void) if (!c) error (0, "EOF inside quote"); switch (c) { + case '\\': + c = '\\'; + break; case 'n': c = '\n'; break; case '"': c = '\"'; break; + case '\'': + c = '\''; + break; case '0': case '1': case '2': @@ -197,7 +204,7 @@ PR_LexString (void) error (0, "Unknown escape char"); break; } - } else if (c == '\"') { + } else if (c == quote) { pr_token[pr_token_len] = 0; pr_token_type = tt_immediate; pr_immediate_type = &type_string; diff --git a/tools/qfcc/source/qc-lex.l b/tools/qfcc/source/qc-lex.l index 89203862f..860bb4000 100644 --- a/tools/qfcc/source/qc-lex.l +++ b/tools/qfcc/source/qc-lex.l @@ -108,7 +108,17 @@ m ([\-+]?) sscanf (yytext, "' %f %f %f %f '", &yylval.vector_val[0], &yylval.vector_val[1], &yylval.vector_val[2], &yylval.vector_val[3]); - return VECTOR_VAL; + return QUATERNION_VAL; + } + +'(\\[^xX0-7\n]|[^'\n]|\\[xX][0-9A-Fa-f]+|\\[0-7]+)*' { + char *str = make_string (yytext); + + if (str[1]) + warning (0, "multibyte char constant"); + yylval.integer_val = *str; + free (str); + return INT_VAL; } ^#{s}+{DIGIT}+{s}+\"(\.|[^"])*\".*$ {