Support more character literals

This commit is contained in:
Dan Gisselquist 2018-05-03 12:35:01 +02:00 committed by Clifford Wolf
parent ea3ff6f59c
commit e060375f23
1 changed files with 9 additions and 1 deletions

View File

@ -241,10 +241,18 @@ YOSYS_NAMESPACE_END
while (yystr[i]) { while (yystr[i]) {
if (yystr[i] == '\\' && yystr[i + 1]) { if (yystr[i] == '\\' && yystr[i + 1]) {
i++; i++;
if (yystr[i] == 'n') if (yystr[i] == 'a')
yystr[i] = '\a';
else if (yystr[i] == 'f')
yystr[i] = '\f';
else if (yystr[i] == 'n')
yystr[i] = '\n'; yystr[i] = '\n';
else if (yystr[i] == 'r')
yystr[i] = '\r';
else if (yystr[i] == 't') else if (yystr[i] == 't')
yystr[i] = '\t'; yystr[i] = '\t';
else if (yystr[i] == 'v')
yystr[i] = '\v';
else if ('0' <= yystr[i] && yystr[i] <= '7') { else if ('0' <= yystr[i] && yystr[i] <= '7') {
yystr[i] = yystr[i] - '0'; yystr[i] = yystr[i] - '0';
if ('0' <= yystr[i + 1] && yystr[i + 1] <= '7') { if ('0' <= yystr[i + 1] && yystr[i + 1] <= '7') {