diff options
-rw-r--r-- | src/parser.js | 4 | ||||
-rw-r--r-- | tests/runner.py | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/parser.js b/src/parser.js index 42613cb4..3551c281 100644 --- a/src/parser.js +++ b/src/parser.js @@ -275,7 +275,7 @@ function IEEEUnHex(stringy) { } function parseNumerical(value, type) { - if ((type == 'double' || type == 'float') && value.substr(0,2) == '0x') { + if ((!type || type == 'double' || type == 'float') && value.substr(0,2) == '0x') { // Hexadecimal double value, as the llvm docs say, // "The one non-intuitive notation for constants is the hexadecimal form of floating point constants." return IEEEUnHex(value); @@ -1820,7 +1820,7 @@ function JSify(data) { } else if (segment[1].type == '{') { return '[' + handleSegments(segment[1].tokens) + ']'; } else if (segment.length == 2) { - return toNiceIdent(segment[1].text); + return parseNumerical(toNiceIdent(segment[1].text)); } else { //print('// seggg: ' + JSON.stringify(segment) + '???!???\n') return '???!???'; diff --git a/tests/runner.py b/tests/runner.py index d11487cf..dfba8897 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -444,17 +444,17 @@ class T(unittest.TestCase): int main( int argc, const char *argv[] ) { IUB iub[] = { - { 'a', 0.27, 5 }, + { 'a', 0.3029549426680, 5 }, { 'c', 0.15, 4 }, { 'g', 0.12, 3 }, { 't', 0.27, 2 }, }; - printf("*%d,%d,%d*\\n", iub[0].c, int(iub[1].p*100), iub[2].pi); + printf("*%d,%d,%d,%d*\\n", iub[0].c, int(iub[1].p*100), iub[2].pi, int(iub[0].p*10000)); // printf("*%d*\\n", int(iub[1].p*100)); return 0; } ''' - self.do_test(src, '*97,15,3*') + self.do_test(src, '*97,15,3,3029*') def test_memcpy(self): |