1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-12-08 06:21:40 +01:00

33793: add 0b binary interpretation to integer constants

This commit is contained in:
Peter Stephenson 2014-11-26 17:26:58 +00:00
parent c4110f7f4e
commit a8927bf27b
4 changed files with 13 additions and 3 deletions

View file

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