GetTokenType returns the token type for a given keyword. If the word is not a recognized keyword, it returns models.TokenTypeWord. The lookup is case-insensitive when the Keywords instance was created with case-insensitive matching (default behavior). Example: kw := keywords.New(keywords.Dialect
(word string)
| 331 | // tokenType = kw.GetTokenType("select") // models.TokenTypeSelect (case-insensitive) |
| 332 | // tokenType = kw.GetTokenType("unknown") // models.TokenTypeWord |
| 333 | func (k *Keywords) GetTokenType(word string) models.TokenType { |
| 334 | var key string |
| 335 | if k.ignoreCase { |
| 336 | key = strings.ToUpper(word) |
| 337 | } else { |
| 338 | key = word |
| 339 | } |
| 340 | |
| 341 | if kw, ok := k.keywordMap[key]; ok { |
| 342 | return kw.Type |
| 343 | } |
| 344 | return models.TokenTypeWord |
| 345 | } |
no outgoing calls