Skip to content

Commit

Permalink
Fix bad cursor update
Browse files Browse the repository at this point in the history
  • Loading branch information
eatonphil committed Mar 8, 2020
1 parent 6a788b6 commit b1e42e0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ func parseInsertStatement(tokens []*token, initialCursor uint, delimiter token)
cursor++

if !expectToken(tokens, cursor, tokenFromKeyword(intoKeyword)) {
helpMessage(tokens, cursor, "Expected into")
return nil, initialCursor, false
}
cursor++
Expand Down Expand Up @@ -393,6 +394,7 @@ func Parse(source io.Reader) (*Ast, error) {
for cursor < uint(len(tokens)) {
stmt, newCursor, ok := parseStatement(tokens, cursor, tokenFromSymbol(semicolonSymbol))
if !ok {
helpMessage(tokens, cursor, "Expected statement")
return nil, errors.New("Failed to parse, expected statement")
}
cursor = newCursor
Expand All @@ -409,8 +411,6 @@ func Parse(source io.Reader) (*Ast, error) {
helpMessage(tokens, cursor, "Expected semi-colon delimiter between statements")
return nil, errors.New("Missing semi-colon between statements")
}

cursor++
}

return &a, nil
Expand Down

0 comments on commit b1e42e0

Please sign in to comment.