cc65: Add support for binary literals

Binary literals, 0b001, are a GCC extension in C and a C++14 feature.
This commit is contained in:
Lauri Kasanen
2019-07-16 18:39:37 +03:00
committed by Oliver Schmidt
parent 76fe064e03
commit 925ea9d544
2 changed files with 538 additions and 2 deletions

View File

@@ -464,8 +464,8 @@ static void NumericConst (void)
unsigned DigitVal;
unsigned long IVal; /* Value */
/* Check for a leading hex or octal prefix and determine the possible
** integer types.
/* Check for a leading hex, octal or binary prefix and determine the
** possible integer types.
*/
if (CurC == '0') {
/* Gobble 0 and examine next char */
@@ -473,6 +473,9 @@ static void NumericConst (void)
if (toupper (CurC) == 'X') {
Base = Prefix = 16;
NextChar (); /* gobble "x" */
} else if (toupper (CurC) == 'B' && IS_Get (&Standard) >= STD_CC65) {
Base = Prefix = 2;
NextChar (); /* gobble 'b' */
} else {
Base = 10; /* Assume 10 for now - see below */
Prefix = 8; /* Actual prefix says octal */