github.com/waldiirawan/apm-agent-go/v2@v2.2.2/internal/testdata/json-specs/sql_token_examples.json (about) 1 [ 2 { 3 "name": "whitespace-only", 4 "comment": "whitespace between tokens is ignored", 5 "input": " " 6 }, 7 { 8 "name": "keywords", 9 "comment": "keywords each have their own kind, and are scanned case-insensitively", 10 "input": "INSERT or rEpLaCe", 11 "tokens": [ 12 { 13 "kind": "INSERT", 14 "text": "INSERT" 15 }, 16 { 17 "kind": "OR", 18 "text": "or" 19 }, 20 { 21 "kind": "REPLACE", 22 "text": "rEpLaCe" 23 } 24 ] 25 }, 26 { 27 "name": "qualified-table", 28 "input": "schema.Abc_123", 29 "tokens": [ 30 { 31 "kind": "IDENT", 32 "text": "schema" 33 }, 34 { 35 "kind": "PERIOD", 36 "text": "." 37 }, 38 { 39 "kind": "IDENT", 40 "text": "Abc_123" 41 } 42 ] 43 }, 44 { 45 "name": "dollar-variable", 46 "comment": "dollar variables mustn't confuse dollar quoting", 47 "input": "$123", 48 "tokens": [ 49 { 50 "kind": "OTHER", 51 "text": "$123" 52 } 53 ] 54 }, 55 { 56 "name": "identifiers", 57 "input": "_foo foo$", 58 "tokens": [ 59 { 60 "kind": "IDENT", 61 "text": "_foo" 62 }, 63 { 64 "kind": "IDENT", 65 "text": "foo$" 66 } 67 ] 68 }, 69 { 70 "name": "quoted-identifiers", 71 "input": "`SELECT` \"SELECT \"\"\" [SELECT '']", 72 "tokens": [ 73 { 74 "kind": "IDENT", 75 "text": "SELECT" 76 }, 77 { 78 "kind": "IDENT", 79 "text": "SELECT \"\"" 80 }, 81 { 82 "kind": "IDENT", 83 "text": "SELECT ''" 84 } 85 ] 86 }, 87 { 88 "name": "punctuation", 89 "input": "().", 90 "tokens": [ 91 { 92 "kind": "LPAREN", 93 "text": "(" 94 }, 95 { 96 "kind": "RPAREN", 97 "text": ")" 98 }, 99 { 100 "kind": "PERIOD", 101 "text": "." 102 } 103 ] 104 }, 105 { 106 "name": "comments", 107 "input": "/* /*nested*/ */ -- SELECT /*", 108 "tokens": [ 109 { 110 "kind": "COMMENT", 111 "text": "/* /*nested*/ */" 112 }, 113 { 114 "kind": "COMMENT", 115 "text": "-- SELECT /*" 116 } 117 ] 118 }, 119 { 120 "name": "CQL line comment", 121 "input": "/* /*nested*/ */ // SELECT /*", 122 "tokens": [ 123 { 124 "kind": "COMMENT", 125 "text": "/* /*nested*/ */" 126 }, 127 { 128 "kind": "COMMENT", 129 "text": "// SELECT /*" 130 } 131 ] 132 }, 133 { 134 "name": "string-literal", 135 "input": "'abc '' def\\''", 136 "tokens": [ 137 { 138 "kind": "STRING", 139 "text": "'abc '' def\\''" 140 } 141 ] 142 }, 143 { 144 "name": "dollar-quoted-string-literal", 145 "input": "$$f$o$o$$ $$ $$ $foo$'`$$$$\"$foo$ $foo $bar", 146 "tokens": [ 147 { 148 "kind": "STRING", 149 "text": "$$f$o$o$$" 150 }, 151 { 152 "kind": "STRING", 153 "text": "$$ $$" 154 }, 155 { 156 "kind": "STRING", 157 "text": "$foo$'`$$$$\"$foo$" 158 }, 159 { 160 "kind": "OTHER", 161 "text": "$foo" 162 }, 163 { 164 "kind": "OTHER", 165 "text": "$bar" 166 } 167 ] 168 }, 169 { 170 "name": "unterminated-dollar-quoted-string-literal", 171 "comment": "Unterminated dollar-quoted string rewinds back to the first whitespace, under the assumption that the input is valid and we've interpreted it wrongly", 172 "input": "$foo$ banana $", 173 "tokens": [ 174 { 175 "kind": "OTHER", 176 "text": "$foo$" 177 }, 178 { 179 "kind": "IDENT", 180 "text": "banana" 181 }, 182 { 183 "kind": "OTHER", 184 "text": "$" 185 } 186 ] 187 }, 188 { 189 "name": "numeric-literals", 190 "input": "123 123.456 123E45 123e+45 123e-45 1.2.3", 191 "tokens": [ 192 { 193 "kind": "NUMBER", 194 "text": "123" 195 }, 196 { 197 "kind": "NUMBER", 198 "text": "123.456" 199 }, 200 { 201 "kind": "NUMBER", 202 "text": "123E45" 203 }, 204 { 205 "kind": "NUMBER", 206 "text": "123e+45" 207 }, 208 { 209 "kind": "NUMBER", 210 "text": "123e-45" 211 }, 212 { 213 "kind": "NUMBER", 214 "text": "1.2" 215 }, 216 { 217 "kind": "PERIOD", 218 "text": "." 219 }, 220 { 221 "kind": "NUMBER", 222 "text": "3" 223 } 224 ] 225 }, 226 { 227 "name": "unicode", 228 "input": "选择 FROM foo", 229 "tokens": [ 230 { 231 "kind": "IDENT", 232 "text": "选择" 233 }, 234 { 235 "kind": "FROM", 236 "text": "FROM" 237 }, 238 { 239 "kind": "IDENT", 240 "text": "foo" 241 } 242 ] 243 } 244 ]