summaryrefslogtreecommitdiff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/math.c6
-rw-r--r--Src/utils.c2
2 files changed, 6 insertions, 2 deletions
diff --git a/Src/math.c b/Src/math.c
index 266569827..438a17089 100644
--- a/Src/math.c
+++ b/Src/math.c
@@ -449,12 +449,14 @@ lexconstant(void)
nptr++;
if (*nptr == '0') {
+ int lowchar;
nptr++;
- if (*nptr == 'x' || *nptr == 'X') {
+ lowchar = tolower(*nptr);
+ if (lowchar == 'x' || lowchar == 'b') {
/* Let zstrtol parse number with base */
yyval.u.l = zstrtol_underscore(ptr, &ptr, 0, 1);
/* Should we set lastbase here? */
- lastbase = 16;
+ lastbase = (lowchar == 'b') ? 2 : 16;
if (isset(FORCEFLOAT))
{
yyval.type = MN_FLOAT;
diff --git a/Src/utils.c b/Src/utils.c
index c6e7aed35..5f0c1062b 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -2082,6 +2082,8 @@ zstrtol_underscore(const char *s, char **t, int base, int underscore)
base = 10;
else if (*++s == 'x' || *s == 'X')
base = 16, s++;
+ else if (*s == 'b' || *s == 'B')
+ base = 2, s++;
else
base = 8;
}