Permalink
Browse files

altered create table grammar

  • Loading branch information...
1 parent 8b2cd1a commit 84a2384044de01d34bfc15b4b68525005da975fc @chrisdew committed Nov 15, 2012
Showing with 2 additions and 2 deletions.
  1. +1 −1 grammar.pegjs
  2. +1 −1 test/parser-test.js
View
@@ -5,7 +5,7 @@ start
/ "subscribe" el:ExprList fc:FromClause?
{ return {subscribe:{exprs:el,from:fc}}; }
/ "create" _ "table" _ TableName _? "(" _? lines:CreateLines _? ")"
- { return {createTable:lines}; }
+ { return {createTable:{fields:lines}}; }
/ "use" _ DatabaseName
/ "create" _ DatabaseName
/ "insert into" _ tn:TableName _? "(" _? fields:FieldList _? ")" _? "values" _? "(" _? values:ValueList ")"
View
@@ -8,7 +8,7 @@ describe('grammar', function() {
assert.deepEqual({"select":{"exprs":["id","foo"],"from":["bar"]}}, parser.parse('select id, foo from bar'));
});
it('create table bar (id integer primary key auto_increment, foo varchar)', function() {
- assert.deepEqual({"createTable":[{"field":"id","type":"integer","pk":true,"ai":true},{"field":"foo","type":"varchar"}]},
+ assert.deepEqual({"createTable":{fields:[{"field":"id","type":"integer","pk":true,"ai":true},{"field":"foo","type":"varchar"}]}},
parser.parse('create table bar (id integer primary key auto_increment, foo varchar)'));
});
it('insert into bar (id, foo) values (1, "hello")', function() {

0 comments on commit 84a2384

Please sign in to comment.