aboutsummaryrefslogtreecommitdiff
path: root/src/parser.js
diff options
context:
space:
mode:
authoralon@honor <none@none>2010-09-02 20:05:14 -0700
committeralon@honor <none@none>2010-09-02 20:05:14 -0700
commitaa9ac51abcb31172b46df7f13a90e8a97b9abd91 (patch)
tree26bb9cd7e7572f5130489900fcce14ea5992070b /src/parser.js
parente8c3ecd8cd3d85f9f50f32fad3e419166fe126f4 (diff)
support for bitshifts +test
Diffstat (limited to 'src/parser.js')
-rw-r--r--src/parser.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/parser.js b/src/parser.js
index 7e8c8279..94d6cb86 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']
+ ['add', 'sub', 'sdiv', 'mul', 'icmp', 'zext', 'urem', 'srem', 'fadd', 'fmul', 'fdiv', 'fcmp', 'uitofp', 'sitofp', 'fpext', 'fptoui', 'fptosi', 'trunc', 'sext', 'select', 'shl', 'shr', 'ashl', 'ashr']
.indexOf(item.tokens[0].text) != -1 && !item.intertype },
processItem: function(item) {
item.intertype = 'mathop';
@@ -2226,6 +2226,8 @@ function JSify(data) {
case 'sdiv': case 'udiv': return 'Math.floor(' + ident + ' / ' + ident2 + ')';
case 'mul': return ident + ' * ' + ident2;
case 'urem': case 'srem': return 'Math.floor(' + ident + ' % ' + ident2 + ')';
+ case 'shl': case 'ashl': return ident + ' << ' + ident2;
+ case 'shr': case 'ashr': return ident + ' >> ' + ident2;
case 'fadd': return ident + ' + ' + ident2;
case 'fsub': return ident + ' - ' + ident2;
case 'fdiv': return ident + ' / ' + ident2;