(l *lexer)
| 6 | ) |
| 7 | |
| 8 | func StartState(l *lexer) state { |
| 9 | l.accept(sep) |
| 10 | |
| 11 | if l.hasPrefix("--") { |
| 12 | return doubleDashCommentStateBuilder(StartState) |
| 13 | } |
| 14 | |
| 15 | if l.hasPrefix("/*") { |
| 16 | return blockCommentStateBuilder(StartState) |
| 17 | } |
| 18 | |
| 19 | if l.hasPrefix("DROP TABLE ") { |
| 20 | return untilSemiStateBuilder(TDropTableFullStmt, StartState) |
| 21 | } |
| 22 | |
| 23 | if l.hasPrefix("LOCK TABLES ") { |
| 24 | return untilSemiStateBuilder(TLockTableFullStmt, StartState) |
| 25 | } |
| 26 | |
| 27 | if l.hasPrefix("UNLOCK TABLES") { |
| 28 | return untilSemiStateBuilder(TUnlockTablesFullStmt, StartState) |
| 29 | } |
| 30 | |
| 31 | if l.hasPrefix("CREATE TABLE ") { |
| 32 | return createTableState |
| 33 | } |
| 34 | |
| 35 | if l.hasPrefix("INSERT INTO ") { |
| 36 | return insertIntoTableState |
| 37 | } |
| 38 | |
| 39 | if l.hasPrefix("DELIMITER ") { // TODO: Add delimiter awareness |
| 40 | return untilNewlineStateBuilder(TDelim, StartState) |
| 41 | } |
| 42 | |
| 43 | if l.hasPrefix("SET ") { |
| 44 | return untilSemiStateBuilder(TSetFullStmt, StartState) |
| 45 | } |
| 46 | |
| 47 | _, p := l.peek(1) |
| 48 | if p[0] != eof { |
| 49 | l.emit(TIllegal) |
| 50 | } |
| 51 | |
| 52 | return nil |
| 53 | } |
| 54 | |
| 55 | func insertIntoTableState(l *lexer) state { |
| 56 | l.start = l.pos |
nothing calls this directly
no test coverage detected