character constants

This commit is contained in:
Bill Currie 2002-01-04 08:45:24 +00:00
parent 6ec47e6be6
commit 9d2739598a
2 changed files with 20 additions and 3 deletions

View File

@ -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;

View File

@ -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}+\"(\.|[^"])*\".*$ {