MCPcopy Create free account
hub / github.com/donatj/sqlread / StartIntpState

Method StartIntpState

interpreter.go:7–46  ·  view source on GitHub ↗
(l *lexer)

Source from the content-addressed store, hash-verified

5}
6
7func (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
48func (intp *Intp) showCreateTableIntpState(l *lexer) state {
49 l.pos += 6

Callers

nothing calls this directly

Calls 5

untilSemiStateBuilderFunction · 0.85
peekMethod · 0.80
acceptMethod · 0.80
hasPrefixIMethod · 0.80
emitMethod · 0.80

Tested by

no test coverage detected