Remove RECORD keyword

This commit is contained in:
Tobie Morgan Hitchcock 2016-10-14 07:54:26 +01:00
parent 58b9cf3478
commit 6da2e371ca
4 changed files with 9 additions and 11 deletions

View file

@ -115,7 +115,7 @@ func (p *parser) parseMulti() (*Query, error) {
// parseSingle parses a single SQL SELECT statement.
func (p *parser) parseSingle() (Statement, error) {
tok, _, err := p.shouldBe(USE, INFO, LET, BEGIN, CANCEL, COMMIT, ROLLBACK, SELECT, CREATE, UPDATE, INSERT, UPSERT, MODIFY, DELETE, RELATE, RECORD, DEFINE, REMOVE)
tok, _, err := p.shouldBe(USE, INFO, LET, BEGIN, CANCEL, COMMIT, ROLLBACK, SELECT, CREATE, UPDATE, INSERT, UPSERT, MODIFY, DELETE, RELATE, DEFINE, REMOVE)
switch tok {

View file

@ -36,7 +36,7 @@ func (p *parser) parseDefineRulesStatement() (stmt *DefineRulesStatement, err er
for {
tok, _, exi := p.mightBe(SELECT, CREATE, UPDATE, DELETE, RELATE, RECORD)
tok, _, exi := p.mightBe(SELECT, CREATE, UPDATE, DELETE, RELATE)
if !exi {
break
}
@ -50,7 +50,7 @@ func (p *parser) parseDefineRulesStatement() (stmt *DefineRulesStatement, err er
}
if len(stmt.When) == 0 {
return nil, &ParseError{Found: "", Expected: []string{"SELECT", "CREATE", "UPDATE", "DELETE", "RELATE", "RECORD"}}
return nil, &ParseError{Found: "", Expected: []string{"SELECT", "CREATE", "UPDATE", "DELETE", "RELATE"}}
}
if tok, _, err := p.shouldBe(ACCEPT, REJECT, CUSTOM); err != nil {
@ -97,7 +97,7 @@ func (p *parser) parseRemoveRulesStatement() (stmt *RemoveRulesStatement, err er
for {
tok, _, exi := p.mightBe(SELECT, CREATE, UPDATE, DELETE, RELATE, RECORD)
tok, _, exi := p.mightBe(SELECT, CREATE, UPDATE, DELETE, RELATE)
if !exi {
break
}
@ -111,7 +111,7 @@ func (p *parser) parseRemoveRulesStatement() (stmt *RemoveRulesStatement, err er
}
if len(stmt.When) == 0 {
return nil, &ParseError{Found: "", Expected: []string{"SELECT", "CREATE", "UPDATE", "DELETE", "RELATE", "RECORD"}}
return nil, &ParseError{Found: "", Expected: []string{"SELECT", "CREATE", "UPDATE", "DELETE", "RELATE"}}
}
if _, _, err = p.shouldBe(EOF, SEMICOLON); err != nil {

View file

@ -140,11 +140,11 @@ func Test_Parse_Queries_Malformed(t *testing.T) {
},
{
sql: `!`,
err: "Found `!` but expected `USE, INFO, LET, BEGIN, CANCEL, COMMIT, ROLLBACK, SELECT, CREATE, UPDATE, INSERT, UPSERT, MODIFY, DELETE, RELATE, RECORD, DEFINE, REMOVE`",
err: "Found `!` but expected `USE, INFO, LET, BEGIN, CANCEL, COMMIT, ROLLBACK, SELECT, CREATE, UPDATE, INSERT, UPSERT, MODIFY, DELETE, RELATE, DEFINE, REMOVE`",
},
{
sql: `SELECT * FROM person;;;`,
err: "Found `;` but expected `USE, INFO, LET, BEGIN, CANCEL, COMMIT, ROLLBACK, SELECT, CREATE, UPDATE, INSERT, UPSERT, MODIFY, DELETE, RELATE, RECORD, DEFINE, REMOVE`",
err: "Found `;` but expected `USE, INFO, LET, BEGIN, CANCEL, COMMIT, ROLLBACK, SELECT, CREATE, UPDATE, INSERT, UPSERT, MODIFY, DELETE, RELATE, DEFINE, REMOVE`",
},
}
@ -1338,7 +1338,7 @@ func Test_Parse_Queries_Define(t *testing.T) {
},
{
sql: `DEFINE RULES ON person FOR`,
err: "Found `` but expected `SELECT, CREATE, UPDATE, DELETE, RELATE, RECORD`",
err: "Found `` but expected `SELECT, CREATE, UPDATE, DELETE, RELATE`",
},
{
sql: `DEFINE RULES ON person FOR select, create, update, delete`,
@ -1878,7 +1878,7 @@ func Test_Parse_Queries_Remove(t *testing.T) {
},
{
sql: `REMOVE RULES ON person FOR`,
err: "Found `` but expected `SELECT, CREATE, UPDATE, DELETE, RELATE, RECORD`",
err: "Found `` but expected `SELECT, CREATE, UPDATE, DELETE, RELATE`",
},
{
sql: `REMOVE RULES ON person FOR select, create, update, delete`,

View file

@ -160,7 +160,6 @@ const (
OR
ORDER
READONLY
RECORD
REJECT
RELATE
REMOVE
@ -319,7 +318,6 @@ var tokens = [...]string{
OR: "OR",
ORDER: "ORDER",
READONLY: "READONLY",
RECORD: "RECORD",
REJECT: "REJECT",
RELATE: "RELATE",
REMOVE: "REMOVE",