Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

parses complex select where caluse

  • Loading branch information...
commit a11e9239ccc60c2af1e314507ddf0a53e53c3dde 1 parent 34a107e
chrisdew authored
Showing with 5 additions and 1 deletion.
  1. +1 −1  lib/grammar.pegjs
  2. +4 −0 test/grammar-test.js
View
2  lib/grammar.pegjs
@@ -54,7 +54,7 @@ Value
/ String
Integer
- = head:([1-9]) tail:([0-9]*) { tail.unshift(head); return parseInt(tail.join(''), 10); }
+ = head:([0-9]) tail:([0-9]*) { tail.unshift(head); return parseInt(tail.join(''), 10); }
String
= "\"" value:([a-z]*) "\"" { return value.join(''); }
View
4 test/grammar-test.js
@@ -60,4 +60,8 @@ This test takes 25s to run! All the others take 149ms in total.
assert.deepEqual({"selectStar":{"from":["bar"],"where":{"expr":{"fn":"and","args":[{"fn":"equal","args":[{"field":"x"},1]},{"fn":"lt","args":[{"field":"y"},{"fn":"now","args":[]}]}]}}}},
parser.parse('select * from bar where x = 1 and y < now()'));
});
+ it('select * from bar where x = 1 and x > 0', function() {
+ assert.deepEqual({"selectStar":{"from":["bar"],"where":{"expr":{"fn":"and","args":[{"fn":"equal","args":[{"field":"x"},1]},{"fn":"gt","args":[{"field":"x"},0]}]}}}},
+ parser.parse('select * from bar where x = 1 and x > 0'));
+ });
});
Please sign in to comment.
Something went wrong with that request. Please try again.