support of >>> operator

This commit is contained in:
Borys Levytskyi
2015-04-11 23:55:45 +03:00
parent b7ea2545bb
commit d0ff0a579f
3 changed files with 11 additions and 4 deletions

View File

@@ -83,13 +83,19 @@
</div>
<div class="float:left">
<p class="section">
<strong>Supported Bitwise Operations</strong>
<strong>Supported Bitwise Operations</strong><br/>
<small>
<a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators">
as implemented in JavaScript engine
</a>
</small>
<ul>
<li><code>&</code> bitwise AND</li>
<li><code>|</code> bitwise inclusive OR</li>
<li><code>^</code> bitwise exclusive XOR</li>
<li><code><<</code> left shift</li>
<li><code>>></code> right shift</li>
<li><code>>></code> sign propagating right shift</li>
<li><code>>>></code> zero-fill right shift</li>
</ul>
</p>
</div>

View File

@@ -1,7 +1,7 @@
app.set('expression', function() {
"use strict";
var exprRegex = /^(-?(?:\d+|0x[\d,a-f]+))\s*(<<|>>|\||\&|\^)\s*(-?(?:\d+|0x[\d,a-f]+))$/;
var exprRegex = /^(-?(?:\d+|0x[\d,a-f]+))\s*(<<|>>|>>>|\||\&|\^)\s*(-?(?:\d+|0x[\d,a-f]+))$/;
var listRegex = /^(-?(?:\d+|0x[\d,a-f]+)\s?)+$/;
return {

View File

@@ -18,7 +18,8 @@ describe("expression parse", function() {
"23^0x1": { operand1: 23, operand2:1, "sign":"^", string: "23^0x1" },
"0xf>>0xa": { operand1: 15, operand2:10, "sign":">>", string:"0xf>>0xa" },
"0x10&0x11": { operand1: 0x10, operand2:0x11, "sign":"&", string:"0x10&0x11" },
"0x1a^11": { operand1: 0x1a, operand2:11, "sign":"^", string:"0x1a^11" }
"0x1a^11": { operand1: 0x1a, operand2:11, "sign":"^", string:"0x1a^11" },
"0x1a>>>11": { operand1: 0x1a, operand2:11, "sign":">>>", string:"0x1a>>>11" }
};
it("should parse expressions", function() {