Use charmaps in const expressions.

This commit is contained in:
yenatch
2018-07-06 22:48:49 -04:00
parent adea89f3eb
commit e2de106d71
4 changed files with 12 additions and 1 deletions

View File

@@ -1243,7 +1243,13 @@ const : T_ID { $$ = sym_GetConstantValue($1); }
| T_NUMBER { $$ = $1; }
| T_OP_HIGH '(' const ')' { $$ = ($3 >> 8) & 0xFF; }
| T_OP_LOW '(' const ')' { $$ = $3 & 0xFF; }
| string { $$ = str2int($1); }
| string
{
char *s = $1;
int32_t length = charmap_Convert(&s);
$$ = str2int2(s, length);
free(s);
}
| T_OP_LOGICNOT const %prec NEG { $$ = !$2; }
| const T_OP_LOGICOR const { $$ = $1 || $3; }
| const T_OP_LOGICAND const { $$ = $1 && $3; }

4
test/asm/equ-charmap.asm Normal file
View File

@@ -0,0 +1,4 @@
SECTION "sec", ROM0
charmap "A", 1
_A_ EQU "A"
db _A_

0
test/asm/equ-charmap.out Normal file
View File

View File

@@ -0,0 +1 @@