diff --git a/Docs/src/history.but b/Docs/src/history.but index 95de8b17..83bf6c23 100644 --- a/Docs/src/history.but +++ b/Docs/src/history.but @@ -28,7 +28,7 @@ Released on ?, 2014 \b !execute supports comparing the exit code with the same syntax as !system -\b Preprocessor supports MASM style 0n and 0y radix prefix on numbers +\b Preprocessor supports \cw{0n} and \cw{0b} radix prefix on number literals \H{v3.0a2} 3.0 Alpha 2 diff --git a/Source/lineparse.cpp b/Source/lineparse.cpp index 3d33af8b..5768a9d2 100644 --- a/Source/lineparse.cpp +++ b/Source/lineparse.cpp @@ -116,9 +116,9 @@ int LineParser::gettoken_int(int token, int *success/*=0*/) const ++p, ++neg; if (_T('0') == p[0]) { - // Special support for 0n and 0y MASM style radix prefix: + // Special support for 0n and 0y MASM style and 0b Python style radix prefix: if (_T('n') == (p[1]|32)) parse=&p[2], base=10; - if (_T('y') == (p[1]|32)) parse=&p[2], base=2; + if (_T('b') == (p[1]|32) || _T('y') == (p[1]|32)) parse=&p[2], base=2; } if (neg) { @@ -142,7 +142,7 @@ double LineParser::gettoken_number(int token, int *success/*=0*/) const { if (_T('x') == (str[1]|32)) ++forceint; if (_T('n') == (str[1]|32)) ++forceint; - if (_T('y') == (str[1]|32)) ++forceint; + if (_T('b') == (str[1]|32) || _T('y') == (str[1]|32)) ++forceint; } return forceint ? gettoken_int(token,success) : gettoken_float(token,success); }