(l *lexer)
| 5 | } |
| 6 | |
| 7 | func (intp *Intp) StartIntpState(l *lexer) state { |
| 8 | _, p := l.peek(1) |
| 9 | if p[0] == eof { |
| 10 | intp.EOF = true |
| 11 | return nil |
| 12 | } |
| 13 | |
| 14 | l.accept(sep) |
| 15 | |
| 16 | if l.hasPrefixI("S") && l.hasPrefixI("SHOW") { |
| 17 | l.pos += 4 |
| 18 | if l.accept(whitespace) < 1 { |
| 19 | l.emit(TIllegal) |
| 20 | return nil |
| 21 | } |
| 22 | |
| 23 | if l.hasPrefixI("TABLES") { |
| 24 | return untilSemiStateBuilder(TIntpShowTables, nil) |
| 25 | } |
| 26 | if l.hasPrefixI("COLUMNS") { |
| 27 | return intp.showColumnsIntpState |
| 28 | } |
| 29 | if l.hasPrefixI("CREATE") { |
| 30 | return intp.showCreateTableIntpState |
| 31 | } |
| 32 | |
| 33 | l.emit(TIllegal) |
| 34 | return nil |
| 35 | } |
| 36 | |
| 37 | if (l.hasPrefixI("Q") || l.hasPrefixI("E")) && (l.hasPrefixI("QUIT") || l.hasPrefixI("EXIT")) { |
| 38 | return untilSemiStateBuilder(TIntpQuit, nil) |
| 39 | } |
| 40 | |
| 41 | if l.hasPrefixI("S") && l.hasPrefixI("SELECT") { |
| 42 | return intp.selectIntpState |
| 43 | } |
| 44 | |
| 45 | return nil |
| 46 | } |
| 47 | |
| 48 | func (intp *Intp) showCreateTableIntpState(l *lexer) state { |
| 49 | l.pos += 6 |
nothing calls this directly
no test coverage detected