diff options
author | alon@honor <none@none> | 2010-09-02 21:34:15 -0700 |
---|---|---|
committer | alon@honor <none@none> | 2010-09-02 21:34:15 -0700 |
commit | ab371a5c466d2ab5d441490d27e15d00085fbbc1 (patch) | |
tree | 638e4d1297380cce7c53978e9341cbca57955a7d /src | |
parent | 1ba6a6f48ff22002037b1628587bb49c75a56da7 (diff) |
ptrtoint support, +test that includes scanning generated code
Diffstat (limited to 'src')
-rw-r--r-- | src/parser.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/parser.js b/src/parser.js index 8936e87b..e37d408a 100644 --- a/src/parser.js +++ b/src/parser.js @@ -702,7 +702,7 @@ function intertyper(data) { // mathops substrate.addZyme('Mathops', { selectItem: function(item) { return item.indent === -1 && item.tokens && item.tokens.length >= 3 && - ['add', 'sub', 'sdiv', 'mul', 'icmp', 'zext', 'urem', 'srem', 'fadd', 'fmul', 'fdiv', 'fcmp', 'uitofp', 'sitofp', 'fpext', 'fptoui', 'fptosi', 'trunc', 'sext', 'select', 'shl', 'shr', 'ashl', 'ashr', 'xor', 'or', 'and'] + ['add', 'sub', 'sdiv', 'mul', 'icmp', 'zext', 'urem', 'srem', 'fadd', 'fmul', 'fdiv', 'fcmp', 'uitofp', 'sitofp', 'fpext', 'fptoui', 'fptosi', 'trunc', 'sext', 'select', 'shl', 'shr', 'ashl', 'ashr', 'xor', 'or', 'and', 'ptrtoint'] .indexOf(item.tokens[0].text) != -1 && !item.intertype }, processItem: function(item) { item.intertype = 'mathop'; @@ -2261,6 +2261,10 @@ function JSify(data) { } case 'zext': case 'fpext': case 'trunc': case 'sext': return ident; case 'select': return '(' + ident + ' ? ' + ident3 + ' : ' + ident4 + ')'; + case 'ptrtoint': { + if (type.text != 'i8*') print('// XXX Warning: Risky ptrtoint operation on line ' + lineNum); + return ident; + } default: throw 'Unknown mathcmp op: ' + item.op } } }); |