aboutsummaryrefslogtreecommitdiff
path: root/src/parseTools.js
diff options
context:
space:
mode:
authoralon@honor <none@none>2010-10-23 19:56:36 -0700
committeralon@honor <none@none>2010-10-23 19:56:36 -0700
commitf221a9bada6e054c0bf6a99db1bb0c1f1d8d349d (patch)
tree6c9983266db5f7601a6c15d71aef30cb93b06a76 /src/parseTools.js
parent8a0d19fd34aadbe9209103fe2e7925539ee30138 (diff)
nicer numerical constants
Diffstat (limited to 'src/parseTools.js')
-rw-r--r--src/parseTools.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index c587a89d..1ee82394 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -384,13 +384,16 @@ function parseNumerical(value, type) {
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);
- }
- if (value == 'null') {
+ value = IEEEUnHex(value);
+ } else if (value == 'null') {
// NULL *is* 0, in C/C++. No JS null! (null == 0 is false, etc.)
- return '0';
+ value = '0';
+ }
+ if (isNumber(value)) {
+ return eval(value).toString(); // will change e.g. 5.000000e+01 to 50
+ } else {
+ return value;
}
- return value;
}
// \0Dsometext is really '\r', then sometext