Example_caseInsensitivity demonstrates case-insensitive keyword matching.
()
| 80 | |
| 81 | // Example_caseInsensitivity demonstrates case-insensitive keyword matching. |
| 82 | func Example_caseInsensitivity() { |
| 83 | // Create keywords with case-insensitive matching (default) |
| 84 | kw := keywords.New(keywords.DialectGeneric, true) |
| 85 | |
| 86 | // All of these should match |
| 87 | examples := []string{"SELECT", "select", "Select", "SeLeCt"} |
| 88 | |
| 89 | for _, word := range examples { |
| 90 | if kw.IsKeyword(word) { |
| 91 | fmt.Printf("%s is recognized as SELECT keyword\n", word) |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | // Output: |
| 96 | // SELECT is recognized as SELECT keyword |
| 97 | // select is recognized as SELECT keyword |
| 98 | // Select is recognized as SELECT keyword |
| 99 | // SeLeCt is recognized as SELECT keyword |
| 100 | } |
| 101 | |
| 102 | // Example_tokenTypeMapping demonstrates mapping keywords to token types. |
| 103 | func Example_tokenTypeMapping() { |