MCPcopy Index your code
hub / github.com/LissaGreense/GO4SQL / validateToken

Function validateToken

parser/parser.go:50–65  ·  view source on GitHub ↗

validateToken - Check if current token type is appearing in provided expectedTokens array

(tokenType token.Type, expectedTokens []token.Type)

Source from the content-addressed store, hash-verified

48
49// validateToken - Check if current token type is appearing in provided expectedTokens array
50func validateToken(tokenType token.Type, expectedTokens []token.Type) error {
51 var contains = false
52 expectedTokensStrings := make([]string, 0)
53 for _, x := range expectedTokens {
54 expectedTokensStrings = append(expectedTokensStrings, string(x))
55
56 if x == tokenType {
57 contains = true
58 break
59 }
60 }
61 if !contains {
62 return &SyntaxError{expectedTokensStrings, string(tokenType)}
63 }
64 return nil
65}
66
67// parseCreateCommand - Return ast.CreateCommand created from tokens and validate the syntax
68//

Callers 14

validateTokenAndSkipFunction · 0.85
parseCreateCommandMethod · 0.85
parseInsertCommandMethod · 0.85
parseSelectCommandMethod · 0.85
getColumnNameMethod · 0.85
parseWhereCommandMethod · 0.85
parseDeleteCommandMethod · 0.85
parseDropCommandMethod · 0.85
parseOrderByCommandMethod · 0.85
parseLimitCommandMethod · 0.85
parseOffsetCommandMethod · 0.85
parseJoinCommandMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected