diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ng/parse.js | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/ng/parse.js b/src/ng/parse.js index 97aba113..5a70979a 100644 --- a/src/ng/parse.js +++ b/src/ng/parse.js @@ -20,6 +20,8 @@ var OPERATORS = { '%':function(self, locals, a,b){return a(self, locals)%b(self, locals);}, '^':function(self, locals, a,b){return a(self, locals)^b(self, locals);}, '=':noop, + '===':function(self, locals, a, b){return a(self, locals)===b(self, locals);}, + '!==':function(self, locals, a, b){return a(self, locals)!==b(self, locals);}, '==':function(self, locals, a,b){return a(self, locals)==b(self, locals);}, '!=':function(self, locals, a,b){return a(self, locals)!=b(self, locals);}, '<':function(self, locals, a,b){return a(self, locals)<b(self, locals);}, @@ -70,9 +72,14 @@ function lex(text, csp){ continue; } else { var ch2 = ch + peek(), + ch3 = ch2 + peek(2), fn = OPERATORS[ch], - fn2 = OPERATORS[ch2]; - if (fn2) { + fn2 = OPERATORS[ch2], + fn3 = OPERATORS[ch3]; + if (fn3) { + tokens.push({index:index, text:ch3, fn:fn3}); + index += 3; + } else if (fn2) { tokens.push({index:index, text:ch2, fn:fn2}); index += 2; } else if (fn) { @@ -94,8 +101,9 @@ function lex(text, csp){ return chars.indexOf(lastCh) != -1; } - function peek() { - return index + 1 < text.length ? text.charAt(index + 1) : false; + function peek(i) { + var num = i || 1; + return index + num < text.length ? text.charAt(index + num) : false; } function isNumber(ch) { return '0' <= ch && ch <= '9'; @@ -456,7 +464,7 @@ function parser(text, json, $filter, csp){ function equality() { var left = relational(); var token; - if ((token = expect('==','!='))) { + if ((token = expect('==','!=','===','!=='))) { left = binaryFn(left, token.fn, equality()); } return left; |
