flowquery 1.0.46 → 1.0.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (422) hide show
  1. package/dist/flowquery.min.js +1 -1
  2. package/dist/index.d.ts +0 -7
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +6 -4
  5. package/dist/index.js.map +1 -1
  6. package/dist/parsing/data_structures/list_comprehension.d.ts +56 -0
  7. package/dist/parsing/data_structures/list_comprehension.d.ts.map +1 -0
  8. package/dist/parsing/data_structures/list_comprehension.js +102 -0
  9. package/dist/parsing/data_structures/list_comprehension.js.map +1 -0
  10. package/dist/parsing/parser.d.ts +18 -0
  11. package/dist/parsing/parser.d.ts.map +1 -1
  12. package/dist/parsing/parser.js +92 -0
  13. package/dist/parsing/parser.js.map +1 -1
  14. package/package.json +4 -1
  15. package/.editorconfig +0 -21
  16. package/.gitattributes +0 -3
  17. package/.github/workflows/npm-publish.yml +0 -32
  18. package/.github/workflows/python-publish.yml +0 -143
  19. package/.github/workflows/release.yml +0 -107
  20. package/.husky/pre-commit +0 -28
  21. package/.prettierrc +0 -22
  22. package/CODE_OF_CONDUCT.md +0 -10
  23. package/FlowQueryLogoIcon.png +0 -0
  24. package/SECURITY.md +0 -14
  25. package/SUPPORT.md +0 -13
  26. package/docs/flowquery.min.js +0 -1
  27. package/docs/index.html +0 -105
  28. package/flowquery-py/CONTRIBUTING.md +0 -127
  29. package/flowquery-py/README.md +0 -67
  30. package/flowquery-py/misc/data/test.json +0 -10
  31. package/flowquery-py/misc/data/users.json +0 -242
  32. package/flowquery-py/notebooks/TestFlowQuery.ipynb +0 -440
  33. package/flowquery-py/pyproject.toml +0 -121
  34. package/flowquery-py/setup_env.ps1 +0 -92
  35. package/flowquery-py/setup_env.sh +0 -87
  36. package/flowquery-py/src/__init__.py +0 -38
  37. package/flowquery-py/src/__main__.py +0 -10
  38. package/flowquery-py/src/compute/__init__.py +0 -6
  39. package/flowquery-py/src/compute/flowquery.py +0 -68
  40. package/flowquery-py/src/compute/runner.py +0 -64
  41. package/flowquery-py/src/extensibility.py +0 -52
  42. package/flowquery-py/src/graph/__init__.py +0 -31
  43. package/flowquery-py/src/graph/data.py +0 -136
  44. package/flowquery-py/src/graph/database.py +0 -141
  45. package/flowquery-py/src/graph/hops.py +0 -43
  46. package/flowquery-py/src/graph/node.py +0 -143
  47. package/flowquery-py/src/graph/node_data.py +0 -26
  48. package/flowquery-py/src/graph/node_reference.py +0 -50
  49. package/flowquery-py/src/graph/pattern.py +0 -115
  50. package/flowquery-py/src/graph/pattern_expression.py +0 -67
  51. package/flowquery-py/src/graph/patterns.py +0 -42
  52. package/flowquery-py/src/graph/physical_node.py +0 -41
  53. package/flowquery-py/src/graph/physical_relationship.py +0 -36
  54. package/flowquery-py/src/graph/relationship.py +0 -193
  55. package/flowquery-py/src/graph/relationship_data.py +0 -36
  56. package/flowquery-py/src/graph/relationship_match_collector.py +0 -85
  57. package/flowquery-py/src/graph/relationship_reference.py +0 -21
  58. package/flowquery-py/src/io/__init__.py +0 -5
  59. package/flowquery-py/src/io/command_line.py +0 -108
  60. package/flowquery-py/src/parsing/__init__.py +0 -17
  61. package/flowquery-py/src/parsing/alias.py +0 -20
  62. package/flowquery-py/src/parsing/alias_option.py +0 -11
  63. package/flowquery-py/src/parsing/ast_node.py +0 -147
  64. package/flowquery-py/src/parsing/base_parser.py +0 -84
  65. package/flowquery-py/src/parsing/components/__init__.py +0 -19
  66. package/flowquery-py/src/parsing/components/csv.py +0 -8
  67. package/flowquery-py/src/parsing/components/from_.py +0 -12
  68. package/flowquery-py/src/parsing/components/headers.py +0 -12
  69. package/flowquery-py/src/parsing/components/json.py +0 -8
  70. package/flowquery-py/src/parsing/components/null.py +0 -10
  71. package/flowquery-py/src/parsing/components/post.py +0 -8
  72. package/flowquery-py/src/parsing/components/text.py +0 -8
  73. package/flowquery-py/src/parsing/context.py +0 -50
  74. package/flowquery-py/src/parsing/data_structures/__init__.py +0 -15
  75. package/flowquery-py/src/parsing/data_structures/associative_array.py +0 -41
  76. package/flowquery-py/src/parsing/data_structures/json_array.py +0 -30
  77. package/flowquery-py/src/parsing/data_structures/key_value_pair.py +0 -38
  78. package/flowquery-py/src/parsing/data_structures/lookup.py +0 -51
  79. package/flowquery-py/src/parsing/data_structures/range_lookup.py +0 -42
  80. package/flowquery-py/src/parsing/expressions/__init__.py +0 -61
  81. package/flowquery-py/src/parsing/expressions/boolean.py +0 -20
  82. package/flowquery-py/src/parsing/expressions/expression.py +0 -141
  83. package/flowquery-py/src/parsing/expressions/expression_map.py +0 -26
  84. package/flowquery-py/src/parsing/expressions/f_string.py +0 -27
  85. package/flowquery-py/src/parsing/expressions/identifier.py +0 -21
  86. package/flowquery-py/src/parsing/expressions/number.py +0 -32
  87. package/flowquery-py/src/parsing/expressions/operator.py +0 -271
  88. package/flowquery-py/src/parsing/expressions/reference.py +0 -47
  89. package/flowquery-py/src/parsing/expressions/string.py +0 -27
  90. package/flowquery-py/src/parsing/functions/__init__.py +0 -127
  91. package/flowquery-py/src/parsing/functions/aggregate_function.py +0 -60
  92. package/flowquery-py/src/parsing/functions/async_function.py +0 -65
  93. package/flowquery-py/src/parsing/functions/avg.py +0 -55
  94. package/flowquery-py/src/parsing/functions/coalesce.py +0 -43
  95. package/flowquery-py/src/parsing/functions/collect.py +0 -75
  96. package/flowquery-py/src/parsing/functions/count.py +0 -79
  97. package/flowquery-py/src/parsing/functions/date_.py +0 -61
  98. package/flowquery-py/src/parsing/functions/datetime_.py +0 -62
  99. package/flowquery-py/src/parsing/functions/duration.py +0 -159
  100. package/flowquery-py/src/parsing/functions/element_id.py +0 -50
  101. package/flowquery-py/src/parsing/functions/function.py +0 -68
  102. package/flowquery-py/src/parsing/functions/function_factory.py +0 -170
  103. package/flowquery-py/src/parsing/functions/function_metadata.py +0 -148
  104. package/flowquery-py/src/parsing/functions/functions.py +0 -67
  105. package/flowquery-py/src/parsing/functions/head.py +0 -39
  106. package/flowquery-py/src/parsing/functions/id_.py +0 -49
  107. package/flowquery-py/src/parsing/functions/join.py +0 -49
  108. package/flowquery-py/src/parsing/functions/keys.py +0 -34
  109. package/flowquery-py/src/parsing/functions/last.py +0 -39
  110. package/flowquery-py/src/parsing/functions/localdatetime.py +0 -60
  111. package/flowquery-py/src/parsing/functions/localtime.py +0 -57
  112. package/flowquery-py/src/parsing/functions/max_.py +0 -49
  113. package/flowquery-py/src/parsing/functions/min_.py +0 -49
  114. package/flowquery-py/src/parsing/functions/nodes.py +0 -48
  115. package/flowquery-py/src/parsing/functions/predicate_function.py +0 -47
  116. package/flowquery-py/src/parsing/functions/predicate_sum.py +0 -49
  117. package/flowquery-py/src/parsing/functions/properties.py +0 -50
  118. package/flowquery-py/src/parsing/functions/rand.py +0 -28
  119. package/flowquery-py/src/parsing/functions/range_.py +0 -41
  120. package/flowquery-py/src/parsing/functions/reducer_element.py +0 -15
  121. package/flowquery-py/src/parsing/functions/relationships.py +0 -46
  122. package/flowquery-py/src/parsing/functions/replace.py +0 -39
  123. package/flowquery-py/src/parsing/functions/round_.py +0 -34
  124. package/flowquery-py/src/parsing/functions/schema.py +0 -40
  125. package/flowquery-py/src/parsing/functions/size.py +0 -34
  126. package/flowquery-py/src/parsing/functions/split.py +0 -54
  127. package/flowquery-py/src/parsing/functions/string_distance.py +0 -92
  128. package/flowquery-py/src/parsing/functions/stringify.py +0 -49
  129. package/flowquery-py/src/parsing/functions/substring.py +0 -76
  130. package/flowquery-py/src/parsing/functions/sum.py +0 -51
  131. package/flowquery-py/src/parsing/functions/tail.py +0 -37
  132. package/flowquery-py/src/parsing/functions/temporal_utils.py +0 -186
  133. package/flowquery-py/src/parsing/functions/time_.py +0 -57
  134. package/flowquery-py/src/parsing/functions/timestamp.py +0 -37
  135. package/flowquery-py/src/parsing/functions/to_float.py +0 -46
  136. package/flowquery-py/src/parsing/functions/to_integer.py +0 -46
  137. package/flowquery-py/src/parsing/functions/to_json.py +0 -35
  138. package/flowquery-py/src/parsing/functions/to_lower.py +0 -37
  139. package/flowquery-py/src/parsing/functions/to_string.py +0 -41
  140. package/flowquery-py/src/parsing/functions/trim.py +0 -37
  141. package/flowquery-py/src/parsing/functions/type_.py +0 -47
  142. package/flowquery-py/src/parsing/functions/value_holder.py +0 -24
  143. package/flowquery-py/src/parsing/logic/__init__.py +0 -15
  144. package/flowquery-py/src/parsing/logic/case.py +0 -28
  145. package/flowquery-py/src/parsing/logic/else_.py +0 -12
  146. package/flowquery-py/src/parsing/logic/end.py +0 -8
  147. package/flowquery-py/src/parsing/logic/then.py +0 -12
  148. package/flowquery-py/src/parsing/logic/when.py +0 -12
  149. package/flowquery-py/src/parsing/operations/__init__.py +0 -46
  150. package/flowquery-py/src/parsing/operations/aggregated_return.py +0 -25
  151. package/flowquery-py/src/parsing/operations/aggregated_with.py +0 -22
  152. package/flowquery-py/src/parsing/operations/call.py +0 -73
  153. package/flowquery-py/src/parsing/operations/create_node.py +0 -35
  154. package/flowquery-py/src/parsing/operations/create_relationship.py +0 -35
  155. package/flowquery-py/src/parsing/operations/delete_node.py +0 -29
  156. package/flowquery-py/src/parsing/operations/delete_relationship.py +0 -29
  157. package/flowquery-py/src/parsing/operations/group_by.py +0 -148
  158. package/flowquery-py/src/parsing/operations/limit.py +0 -33
  159. package/flowquery-py/src/parsing/operations/load.py +0 -148
  160. package/flowquery-py/src/parsing/operations/match.py +0 -52
  161. package/flowquery-py/src/parsing/operations/operation.py +0 -69
  162. package/flowquery-py/src/parsing/operations/order_by.py +0 -114
  163. package/flowquery-py/src/parsing/operations/projection.py +0 -21
  164. package/flowquery-py/src/parsing/operations/return_op.py +0 -88
  165. package/flowquery-py/src/parsing/operations/union.py +0 -115
  166. package/flowquery-py/src/parsing/operations/union_all.py +0 -17
  167. package/flowquery-py/src/parsing/operations/unwind.py +0 -42
  168. package/flowquery-py/src/parsing/operations/where.py +0 -43
  169. package/flowquery-py/src/parsing/operations/with_op.py +0 -18
  170. package/flowquery-py/src/parsing/parser.py +0 -1384
  171. package/flowquery-py/src/parsing/parser_state.py +0 -26
  172. package/flowquery-py/src/parsing/token_to_node.py +0 -109
  173. package/flowquery-py/src/tokenization/__init__.py +0 -23
  174. package/flowquery-py/src/tokenization/keyword.py +0 -54
  175. package/flowquery-py/src/tokenization/operator.py +0 -29
  176. package/flowquery-py/src/tokenization/string_walker.py +0 -158
  177. package/flowquery-py/src/tokenization/symbol.py +0 -19
  178. package/flowquery-py/src/tokenization/token.py +0 -693
  179. package/flowquery-py/src/tokenization/token_mapper.py +0 -53
  180. package/flowquery-py/src/tokenization/token_type.py +0 -21
  181. package/flowquery-py/src/tokenization/tokenizer.py +0 -214
  182. package/flowquery-py/src/tokenization/trie.py +0 -125
  183. package/flowquery-py/src/utils/__init__.py +0 -6
  184. package/flowquery-py/src/utils/object_utils.py +0 -20
  185. package/flowquery-py/src/utils/string_utils.py +0 -113
  186. package/flowquery-py/tests/__init__.py +0 -1
  187. package/flowquery-py/tests/compute/__init__.py +0 -1
  188. package/flowquery-py/tests/compute/test_runner.py +0 -4902
  189. package/flowquery-py/tests/graph/__init__.py +0 -1
  190. package/flowquery-py/tests/graph/test_create.py +0 -56
  191. package/flowquery-py/tests/graph/test_data.py +0 -73
  192. package/flowquery-py/tests/graph/test_match.py +0 -40
  193. package/flowquery-py/tests/parsing/__init__.py +0 -1
  194. package/flowquery-py/tests/parsing/test_context.py +0 -34
  195. package/flowquery-py/tests/parsing/test_expression.py +0 -248
  196. package/flowquery-py/tests/parsing/test_parser.py +0 -1237
  197. package/flowquery-py/tests/test_extensibility.py +0 -611
  198. package/flowquery-py/tests/tokenization/__init__.py +0 -1
  199. package/flowquery-py/tests/tokenization/test_token_mapper.py +0 -60
  200. package/flowquery-py/tests/tokenization/test_tokenizer.py +0 -198
  201. package/flowquery-py/tests/tokenization/test_trie.py +0 -30
  202. package/flowquery-vscode/.vscode-test.mjs +0 -5
  203. package/flowquery-vscode/.vscodeignore +0 -13
  204. package/flowquery-vscode/LICENSE +0 -21
  205. package/flowquery-vscode/README.md +0 -11
  206. package/flowquery-vscode/demo/FlowQueryVSCodeDemo.gif +0 -0
  207. package/flowquery-vscode/eslint.config.mjs +0 -25
  208. package/flowquery-vscode/extension.js +0 -508
  209. package/flowquery-vscode/flowQueryEngine/flowquery.min.js +0 -1
  210. package/flowquery-vscode/flowquery-worker.js +0 -66
  211. package/flowquery-vscode/images/FlowQueryLogoIcon.png +0 -0
  212. package/flowquery-vscode/jsconfig.json +0 -13
  213. package/flowquery-vscode/libs/page.css +0 -53
  214. package/flowquery-vscode/libs/table.css +0 -13
  215. package/flowquery-vscode/libs/tabs.css +0 -66
  216. package/flowquery-vscode/package-lock.json +0 -2917
  217. package/flowquery-vscode/package.json +0 -51
  218. package/flowquery-vscode/test/extension.test.js +0 -196
  219. package/flowquery-vscode/test/worker.test.js +0 -25
  220. package/flowquery-vscode/vsc-extension-quickstart.md +0 -42
  221. package/jest.config.js +0 -14
  222. package/misc/apps/RAG/README.md +0 -29
  223. package/misc/apps/RAG/data/chats.json +0 -302
  224. package/misc/apps/RAG/data/emails.json +0 -182
  225. package/misc/apps/RAG/data/events.json +0 -226
  226. package/misc/apps/RAG/data/files.json +0 -172
  227. package/misc/apps/RAG/data/users.json +0 -158
  228. package/misc/apps/RAG/jest.config.js +0 -21
  229. package/misc/apps/RAG/package.json +0 -48
  230. package/misc/apps/RAG/public/index.html +0 -18
  231. package/misc/apps/RAG/src/App.css +0 -42
  232. package/misc/apps/RAG/src/App.tsx +0 -50
  233. package/misc/apps/RAG/src/components/AdaptiveCardRenderer.css +0 -172
  234. package/misc/apps/RAG/src/components/AdaptiveCardRenderer.tsx +0 -380
  235. package/misc/apps/RAG/src/components/ApiKeySettings.tsx +0 -245
  236. package/misc/apps/RAG/src/components/ChatContainer.css +0 -67
  237. package/misc/apps/RAG/src/components/ChatContainer.tsx +0 -242
  238. package/misc/apps/RAG/src/components/ChatInput.css +0 -23
  239. package/misc/apps/RAG/src/components/ChatInput.tsx +0 -76
  240. package/misc/apps/RAG/src/components/ChatMessage.css +0 -160
  241. package/misc/apps/RAG/src/components/ChatMessage.tsx +0 -286
  242. package/misc/apps/RAG/src/components/FlowQueryAgent.ts +0 -708
  243. package/misc/apps/RAG/src/components/FlowQueryRunner.css +0 -113
  244. package/misc/apps/RAG/src/components/FlowQueryRunner.tsx +0 -371
  245. package/misc/apps/RAG/src/components/index.ts +0 -28
  246. package/misc/apps/RAG/src/graph/index.ts +0 -19
  247. package/misc/apps/RAG/src/graph/initializeGraph.ts +0 -254
  248. package/misc/apps/RAG/src/index.tsx +0 -29
  249. package/misc/apps/RAG/src/prompts/FlowQuerySystemPrompt.ts +0 -327
  250. package/misc/apps/RAG/src/prompts/index.ts +0 -10
  251. package/misc/apps/RAG/src/tests/graph.test.ts +0 -35
  252. package/misc/apps/RAG/src/utils/FlowQueryExecutor.ts +0 -130
  253. package/misc/apps/RAG/src/utils/FlowQueryExtractor.ts +0 -208
  254. package/misc/apps/RAG/src/utils/Llm.ts +0 -248
  255. package/misc/apps/RAG/src/utils/index.ts +0 -12
  256. package/misc/apps/RAG/tsconfig.json +0 -22
  257. package/misc/apps/RAG/webpack.config.js +0 -43
  258. package/misc/apps/README.md +0 -1
  259. package/misc/queries/analyze_catfacts.cql +0 -75
  260. package/misc/queries/azure_openai_completions.cql +0 -13
  261. package/misc/queries/azure_openai_models.cql +0 -9
  262. package/misc/queries/mock_pipeline.cql +0 -84
  263. package/misc/queries/openai_completions.cql +0 -15
  264. package/misc/queries/openai_models.cql +0 -13
  265. package/misc/queries/test.cql +0 -6
  266. package/misc/queries/tool_inference.cql +0 -24
  267. package/misc/queries/wisdom.cql +0 -6
  268. package/misc/queries/wisdom_letter_histogram.cql +0 -8
  269. package/src/compute/flowquery.ts +0 -46
  270. package/src/compute/runner.ts +0 -66
  271. package/src/extensibility.ts +0 -45
  272. package/src/graph/data.ts +0 -130
  273. package/src/graph/database.ts +0 -143
  274. package/src/graph/hops.ts +0 -22
  275. package/src/graph/node.ts +0 -122
  276. package/src/graph/node_data.ts +0 -18
  277. package/src/graph/node_reference.ts +0 -38
  278. package/src/graph/pattern.ts +0 -110
  279. package/src/graph/pattern_expression.ts +0 -48
  280. package/src/graph/patterns.ts +0 -36
  281. package/src/graph/physical_node.ts +0 -23
  282. package/src/graph/physical_relationship.ts +0 -23
  283. package/src/graph/relationship.ts +0 -167
  284. package/src/graph/relationship_data.ts +0 -31
  285. package/src/graph/relationship_match_collector.ts +0 -64
  286. package/src/graph/relationship_reference.ts +0 -25
  287. package/src/index.browser.ts +0 -46
  288. package/src/index.node.ts +0 -55
  289. package/src/index.ts +0 -12
  290. package/src/io/command_line.ts +0 -74
  291. package/src/parsing/alias.ts +0 -23
  292. package/src/parsing/alias_option.ts +0 -5
  293. package/src/parsing/ast_node.ts +0 -153
  294. package/src/parsing/base_parser.ts +0 -98
  295. package/src/parsing/components/csv.ts +0 -9
  296. package/src/parsing/components/from.ts +0 -12
  297. package/src/parsing/components/headers.ts +0 -12
  298. package/src/parsing/components/json.ts +0 -9
  299. package/src/parsing/components/null.ts +0 -9
  300. package/src/parsing/components/post.ts +0 -9
  301. package/src/parsing/components/text.ts +0 -9
  302. package/src/parsing/context.ts +0 -54
  303. package/src/parsing/data_structures/associative_array.ts +0 -43
  304. package/src/parsing/data_structures/json_array.ts +0 -31
  305. package/src/parsing/data_structures/key_value_pair.ts +0 -37
  306. package/src/parsing/data_structures/lookup.ts +0 -44
  307. package/src/parsing/data_structures/range_lookup.ts +0 -36
  308. package/src/parsing/expressions/boolean.ts +0 -21
  309. package/src/parsing/expressions/expression.ts +0 -150
  310. package/src/parsing/expressions/expression_map.ts +0 -22
  311. package/src/parsing/expressions/f_string.ts +0 -26
  312. package/src/parsing/expressions/identifier.ts +0 -22
  313. package/src/parsing/expressions/number.ts +0 -40
  314. package/src/parsing/expressions/operator.ts +0 -354
  315. package/src/parsing/expressions/reference.ts +0 -45
  316. package/src/parsing/expressions/string.ts +0 -34
  317. package/src/parsing/functions/aggregate_function.ts +0 -58
  318. package/src/parsing/functions/async_function.ts +0 -64
  319. package/src/parsing/functions/avg.ts +0 -47
  320. package/src/parsing/functions/coalesce.ts +0 -49
  321. package/src/parsing/functions/collect.ts +0 -54
  322. package/src/parsing/functions/count.ts +0 -54
  323. package/src/parsing/functions/date.ts +0 -63
  324. package/src/parsing/functions/datetime.ts +0 -63
  325. package/src/parsing/functions/duration.ts +0 -143
  326. package/src/parsing/functions/element_id.ts +0 -51
  327. package/src/parsing/functions/function.ts +0 -60
  328. package/src/parsing/functions/function_factory.ts +0 -195
  329. package/src/parsing/functions/function_metadata.ts +0 -217
  330. package/src/parsing/functions/functions.ts +0 -70
  331. package/src/parsing/functions/head.ts +0 -42
  332. package/src/parsing/functions/id.ts +0 -51
  333. package/src/parsing/functions/join.ts +0 -40
  334. package/src/parsing/functions/keys.ts +0 -29
  335. package/src/parsing/functions/last.ts +0 -42
  336. package/src/parsing/functions/localdatetime.ts +0 -63
  337. package/src/parsing/functions/localtime.ts +0 -58
  338. package/src/parsing/functions/max.ts +0 -37
  339. package/src/parsing/functions/min.ts +0 -37
  340. package/src/parsing/functions/nodes.ts +0 -54
  341. package/src/parsing/functions/predicate_function.ts +0 -48
  342. package/src/parsing/functions/predicate_sum.ts +0 -47
  343. package/src/parsing/functions/properties.ts +0 -56
  344. package/src/parsing/functions/rand.ts +0 -21
  345. package/src/parsing/functions/range.ts +0 -37
  346. package/src/parsing/functions/reducer_element.ts +0 -10
  347. package/src/parsing/functions/relationships.ts +0 -52
  348. package/src/parsing/functions/replace.ts +0 -38
  349. package/src/parsing/functions/round.ts +0 -28
  350. package/src/parsing/functions/schema.ts +0 -39
  351. package/src/parsing/functions/size.ts +0 -28
  352. package/src/parsing/functions/split.ts +0 -45
  353. package/src/parsing/functions/string_distance.ts +0 -83
  354. package/src/parsing/functions/stringify.ts +0 -37
  355. package/src/parsing/functions/substring.ts +0 -68
  356. package/src/parsing/functions/sum.ts +0 -41
  357. package/src/parsing/functions/tail.ts +0 -39
  358. package/src/parsing/functions/temporal_utils.ts +0 -180
  359. package/src/parsing/functions/time.ts +0 -58
  360. package/src/parsing/functions/timestamp.ts +0 -37
  361. package/src/parsing/functions/to_float.ts +0 -50
  362. package/src/parsing/functions/to_integer.ts +0 -50
  363. package/src/parsing/functions/to_json.ts +0 -28
  364. package/src/parsing/functions/to_lower.ts +0 -28
  365. package/src/parsing/functions/to_string.ts +0 -32
  366. package/src/parsing/functions/trim.ts +0 -28
  367. package/src/parsing/functions/type.ts +0 -39
  368. package/src/parsing/functions/value_holder.ts +0 -13
  369. package/src/parsing/logic/case.ts +0 -26
  370. package/src/parsing/logic/else.ts +0 -12
  371. package/src/parsing/logic/end.ts +0 -9
  372. package/src/parsing/logic/then.ts +0 -12
  373. package/src/parsing/logic/when.ts +0 -12
  374. package/src/parsing/operations/aggregated_return.ts +0 -22
  375. package/src/parsing/operations/aggregated_with.ts +0 -18
  376. package/src/parsing/operations/call.ts +0 -69
  377. package/src/parsing/operations/create_node.ts +0 -39
  378. package/src/parsing/operations/create_relationship.ts +0 -38
  379. package/src/parsing/operations/delete_node.ts +0 -33
  380. package/src/parsing/operations/delete_relationship.ts +0 -32
  381. package/src/parsing/operations/group_by.ts +0 -137
  382. package/src/parsing/operations/limit.ts +0 -31
  383. package/src/parsing/operations/load.ts +0 -146
  384. package/src/parsing/operations/match.ts +0 -54
  385. package/src/parsing/operations/operation.ts +0 -69
  386. package/src/parsing/operations/order_by.ts +0 -126
  387. package/src/parsing/operations/projection.ts +0 -18
  388. package/src/parsing/operations/return.ts +0 -76
  389. package/src/parsing/operations/union.ts +0 -114
  390. package/src/parsing/operations/union_all.ts +0 -16
  391. package/src/parsing/operations/unwind.ts +0 -36
  392. package/src/parsing/operations/where.ts +0 -42
  393. package/src/parsing/operations/with.ts +0 -20
  394. package/src/parsing/parser.ts +0 -1641
  395. package/src/parsing/parser_state.ts +0 -25
  396. package/src/parsing/token_to_node.ts +0 -114
  397. package/src/tokenization/keyword.ts +0 -50
  398. package/src/tokenization/operator.ts +0 -25
  399. package/src/tokenization/string_walker.ts +0 -197
  400. package/src/tokenization/symbol.ts +0 -15
  401. package/src/tokenization/token.ts +0 -764
  402. package/src/tokenization/token_mapper.ts +0 -53
  403. package/src/tokenization/token_type.ts +0 -16
  404. package/src/tokenization/tokenizer.ts +0 -250
  405. package/src/tokenization/trie.ts +0 -117
  406. package/src/utils/object_utils.ts +0 -17
  407. package/src/utils/string_utils.ts +0 -114
  408. package/tests/compute/runner.test.ts +0 -4559
  409. package/tests/extensibility.test.ts +0 -643
  410. package/tests/graph/create.test.ts +0 -36
  411. package/tests/graph/data.test.ts +0 -58
  412. package/tests/graph/match.test.ts +0 -29
  413. package/tests/parsing/context.test.ts +0 -27
  414. package/tests/parsing/expression.test.ts +0 -303
  415. package/tests/parsing/parser.test.ts +0 -1327
  416. package/tests/tokenization/token_mapper.test.ts +0 -47
  417. package/tests/tokenization/tokenizer.test.ts +0 -191
  418. package/tests/tokenization/trie.test.ts +0 -20
  419. package/tsconfig.json +0 -19
  420. package/typedoc.json +0 -16
  421. package/vscode-settings.json.recommended +0 -16
  422. package/webpack.config.js +0 -26
@@ -1,693 +0,0 @@
1
- """Represents a single token in the FlowQuery language."""
2
-
3
- from __future__ import annotations
4
-
5
- from typing import Optional
6
-
7
- from ..parsing.ast_node import ASTNode
8
- from ..utils.string_utils import StringUtils
9
- from .keyword import Keyword
10
- from .operator import Operator
11
- from .symbol import Symbol
12
- from .token_type import TokenType
13
-
14
-
15
- class Token:
16
- """Represents a single token in the FlowQuery language.
17
-
18
- Tokens are the atomic units of lexical analysis, produced by the tokenizer
19
- and consumed by the parser. Each token has a type (keyword, operator, identifier, etc.)
20
- and an optional value.
21
-
22
- Example:
23
- with_token = Token.WITH()
24
- ident_token = Token.IDENTIFIER("myVar")
25
- num_token = Token.NUMBER("42")
26
- """
27
-
28
- def __init__(self, type_: TokenType, value: Optional[str] = None):
29
- """Creates a new Token instance.
30
-
31
- Args:
32
- type_: The type of the token
33
- value: The optional value associated with the token
34
- """
35
- self._position: int = -1
36
- self._type = type_
37
- self._value = value
38
- self._case_sensitive_value: Optional[str] = None
39
- self._can_be_identifier = StringUtils.can_be_identifier(value or "")
40
-
41
- def equals(self, other: Token) -> bool:
42
- """Checks if this token equals another token.
43
-
44
- Args:
45
- other: The token to compare against
46
-
47
- Returns:
48
- True if tokens are equal, False otherwise
49
- """
50
- if self._type == TokenType.IDENTIFIER and other.type == TokenType.IDENTIFIER:
51
- return True # Identifier values are not compared
52
- return self._type == other.type and self._value == other.value
53
-
54
- @property
55
- def position(self) -> int:
56
- return self._position
57
-
58
- @position.setter
59
- def position(self, value: int) -> None:
60
- self._position = value
61
-
62
- @property
63
- def type(self) -> TokenType:
64
- return self._type
65
-
66
- @property
67
- def value(self) -> Optional[str]:
68
- return self._case_sensitive_value or self._value
69
-
70
- @property
71
- def case_sensitive_value(self) -> Optional[str]:
72
- return self._case_sensitive_value
73
-
74
- @case_sensitive_value.setter
75
- def case_sensitive_value(self, value: str) -> None:
76
- self._case_sensitive_value = value
77
-
78
- @property
79
- def can_be_identifier(self) -> bool:
80
- return self._can_be_identifier
81
-
82
- @property
83
- def node(self) -> ASTNode:
84
- # Import at runtime to avoid circular dependency
85
- from ..parsing.token_to_node import TokenToNode
86
- return TokenToNode.convert(self)
87
-
88
- def __str__(self) -> str:
89
- return f"{self._type.value} {self._value}"
90
-
91
- # Comment tokens
92
-
93
- @staticmethod
94
- def COMMENT(comment: str) -> Token:
95
- return Token(TokenType.COMMENT, comment)
96
-
97
- def is_comment(self) -> bool:
98
- return self._type == TokenType.COMMENT
99
-
100
- # Identifier token
101
-
102
- @staticmethod
103
- def IDENTIFIER(value: str) -> Token:
104
- return Token(TokenType.IDENTIFIER, value)
105
-
106
- def is_identifier(self) -> bool:
107
- return self._type == TokenType.IDENTIFIER or self._type == TokenType.BACKTICK_STRING
108
-
109
- def is_keyword_that_cannot_be_identifier(self) -> bool:
110
- """Returns True for keywords that have special expression-level roles
111
- and should not be treated as identifiers (NULL, CASE, WHEN, THEN, ELSE, END)."""
112
- return self.is_keyword() and (
113
- self.is_null()
114
- or self.is_case()
115
- or self.is_when()
116
- or self.is_then()
117
- or self.is_else()
118
- or self.is_end()
119
- )
120
-
121
- def is_identifier_or_keyword(self) -> bool:
122
- """Returns True if the token is an identifier or a keyword that can be used as an identifier."""
123
- return self.is_identifier() or (
124
- self.is_keyword() and not self.is_keyword_that_cannot_be_identifier()
125
- )
126
-
127
- # String token
128
-
129
- @staticmethod
130
- def STRING(value: str, quote_char: str = '"') -> Token:
131
- unquoted = StringUtils.unquote(value)
132
- unescaped = StringUtils.remove_escaped_quotes(unquoted, quote_char)
133
- return Token(TokenType.STRING, unescaped)
134
-
135
- def is_string(self) -> bool:
136
- return self._type == TokenType.STRING or self._type == TokenType.BACKTICK_STRING
137
-
138
- @staticmethod
139
- def BACKTICK_STRING(value: str, quote_char: str = '"') -> Token:
140
- unquoted = StringUtils.unquote(value)
141
- unescaped = StringUtils.remove_escaped_quotes(unquoted, quote_char)
142
- return Token(TokenType.BACKTICK_STRING, unescaped)
143
-
144
- @staticmethod
145
- def F_STRING(value: str, quote_char: str = '"') -> Token:
146
- unquoted = StringUtils.unquote(value)
147
- unescaped = StringUtils.remove_escaped_quotes(unquoted, quote_char)
148
- fstring = StringUtils.remove_escaped_braces(unescaped)
149
- return Token(TokenType.F_STRING, fstring)
150
-
151
- def is_f_string(self) -> bool:
152
- return self._type == TokenType.F_STRING
153
-
154
- # Number token
155
-
156
- @staticmethod
157
- def NUMBER(value: str) -> Token:
158
- return Token(TokenType.NUMBER, value)
159
-
160
- def is_number(self) -> bool:
161
- return self._type == TokenType.NUMBER
162
-
163
- # Boolean token
164
-
165
- @staticmethod
166
- def BOOLEAN(value: str) -> Token:
167
- return Token(TokenType.BOOLEAN, value)
168
-
169
- def is_boolean(self) -> bool:
170
- return self._type == TokenType.BOOLEAN and self._value in ("TRUE", "FALSE")
171
-
172
- # Symbol tokens
173
-
174
- @staticmethod
175
- def LEFT_PARENTHESIS() -> Token:
176
- return Token(TokenType.SYMBOL, Symbol.LEFT_PARENTHESIS.value)
177
-
178
- def is_left_parenthesis(self) -> bool:
179
- return self._type == TokenType.SYMBOL and self._value == Symbol.LEFT_PARENTHESIS.value
180
-
181
- @staticmethod
182
- def RIGHT_PARENTHESIS() -> Token:
183
- return Token(TokenType.SYMBOL, Symbol.RIGHT_PARENTHESIS.value)
184
-
185
- def is_right_parenthesis(self) -> bool:
186
- return self._type == TokenType.SYMBOL and self._value == Symbol.RIGHT_PARENTHESIS.value
187
-
188
- @staticmethod
189
- def COMMA() -> Token:
190
- return Token(TokenType.SYMBOL, Symbol.COMMA.value)
191
-
192
- def is_comma(self) -> bool:
193
- return self._type == TokenType.SYMBOL and self._value == Symbol.COMMA.value
194
-
195
- @staticmethod
196
- def DOT() -> Token:
197
- return Token(TokenType.SYMBOL, Symbol.DOT.value)
198
-
199
- def is_dot(self) -> bool:
200
- return self._type == TokenType.SYMBOL and self._value == Symbol.DOT.value
201
-
202
- @staticmethod
203
- def COLON() -> Token:
204
- return Token(TokenType.SYMBOL, Symbol.COLON.value)
205
-
206
- def is_colon(self) -> bool:
207
- return self._type == TokenType.SYMBOL and self._value == Symbol.COLON.value
208
-
209
- @staticmethod
210
- def OPENING_BRACE() -> Token:
211
- return Token(TokenType.SYMBOL, Symbol.OPENING_BRACE.value)
212
-
213
- def is_opening_brace(self) -> bool:
214
- return self._type == TokenType.SYMBOL and self._value == Symbol.OPENING_BRACE.value
215
-
216
- @staticmethod
217
- def CLOSING_BRACE() -> Token:
218
- return Token(TokenType.SYMBOL, Symbol.CLOSING_BRACE.value)
219
-
220
- def is_closing_brace(self) -> bool:
221
- return self._type == TokenType.SYMBOL and self._value == Symbol.CLOSING_BRACE.value
222
-
223
- @staticmethod
224
- def OPENING_BRACKET() -> Token:
225
- return Token(TokenType.SYMBOL, Symbol.OPENING_BRACKET.value)
226
-
227
- def is_opening_bracket(self) -> bool:
228
- return self._type == TokenType.SYMBOL and self._value == Symbol.OPENING_BRACKET.value
229
-
230
- @staticmethod
231
- def CLOSING_BRACKET() -> Token:
232
- return Token(TokenType.SYMBOL, Symbol.CLOSING_BRACKET.value)
233
-
234
- def is_closing_bracket(self) -> bool:
235
- return self._type == TokenType.SYMBOL and self._value == Symbol.CLOSING_BRACKET.value
236
-
237
- # Whitespace token
238
-
239
- @staticmethod
240
- def WHITESPACE() -> Token:
241
- return Token(TokenType.WHITESPACE)
242
-
243
- def is_whitespace(self) -> bool:
244
- return self._type == TokenType.WHITESPACE
245
-
246
- # Operator tokens
247
-
248
- def is_operator(self) -> bool:
249
- return self._type == TokenType.OPERATOR
250
-
251
- def is_unary_operator(self) -> bool:
252
- return self._type == TokenType.UNARY_OPERATOR
253
-
254
- @staticmethod
255
- def ADD() -> Token:
256
- return Token(TokenType.OPERATOR, Operator.ADD.value)
257
-
258
- def is_add(self) -> bool:
259
- return self._type == TokenType.OPERATOR and self._value == Operator.ADD.value
260
-
261
- @staticmethod
262
- def SUBTRACT() -> Token:
263
- return Token(TokenType.OPERATOR, Operator.SUBTRACT.value)
264
-
265
- def is_subtract(self) -> bool:
266
- return self._type == TokenType.OPERATOR and self._value == Operator.SUBTRACT.value
267
-
268
- def is_negation(self) -> bool:
269
- return self.is_subtract()
270
-
271
- @staticmethod
272
- def MULTIPLY() -> Token:
273
- return Token(TokenType.OPERATOR, Operator.MULTIPLY.value)
274
-
275
- def is_multiply(self) -> bool:
276
- return self._type == TokenType.OPERATOR and self._value == Operator.MULTIPLY.value
277
-
278
- @staticmethod
279
- def DIVIDE() -> Token:
280
- return Token(TokenType.OPERATOR, Operator.DIVIDE.value)
281
-
282
- def is_divide(self) -> bool:
283
- return self._type == TokenType.OPERATOR and self._value == Operator.DIVIDE.value
284
-
285
- @staticmethod
286
- def EXPONENT() -> Token:
287
- return Token(TokenType.OPERATOR, Operator.EXPONENT.value)
288
-
289
- def is_exponent(self) -> bool:
290
- return self._type == TokenType.OPERATOR and self._value == Operator.EXPONENT.value
291
-
292
- @staticmethod
293
- def MODULO() -> Token:
294
- return Token(TokenType.OPERATOR, Operator.MODULO.value)
295
-
296
- def is_modulo(self) -> bool:
297
- return self._type == TokenType.OPERATOR and self._value == Operator.MODULO.value
298
-
299
- @staticmethod
300
- def EQUALS() -> Token:
301
- return Token(TokenType.OPERATOR, Operator.EQUALS.value)
302
-
303
- def is_equals(self) -> bool:
304
- return self._type == TokenType.OPERATOR and self._value == Operator.EQUALS.value
305
-
306
- @staticmethod
307
- def NOT_EQUALS() -> Token:
308
- return Token(TokenType.OPERATOR, Operator.NOT_EQUALS.value)
309
-
310
- def is_not_equals(self) -> bool:
311
- return self._type == TokenType.OPERATOR and self._value == Operator.NOT_EQUALS.value
312
-
313
- @staticmethod
314
- def LESS_THAN() -> Token:
315
- return Token(TokenType.OPERATOR, Operator.LESS_THAN.value)
316
-
317
- def is_less_than(self) -> bool:
318
- return self._type == TokenType.OPERATOR and self._value == Operator.LESS_THAN.value
319
-
320
- @staticmethod
321
- def LESS_THAN_OR_EQUAL() -> Token:
322
- return Token(TokenType.OPERATOR, Operator.LESS_THAN_OR_EQUAL.value)
323
-
324
- def is_less_than_or_equal(self) -> bool:
325
- return self._type == TokenType.OPERATOR and self._value == Operator.LESS_THAN_OR_EQUAL.value
326
-
327
- @staticmethod
328
- def GREATER_THAN() -> Token:
329
- return Token(TokenType.OPERATOR, Operator.GREATER_THAN.value)
330
-
331
- def is_greater_than(self) -> bool:
332
- return self._type == TokenType.OPERATOR and self._value == Operator.GREATER_THAN.value
333
-
334
- @staticmethod
335
- def GREATER_THAN_OR_EQUAL() -> Token:
336
- return Token(TokenType.OPERATOR, Operator.GREATER_THAN_OR_EQUAL.value)
337
-
338
- def is_greater_than_or_equal(self) -> bool:
339
- return self._type == TokenType.OPERATOR and self._value == Operator.GREATER_THAN_OR_EQUAL.value
340
-
341
- @staticmethod
342
- def AND() -> Token:
343
- return Token(TokenType.OPERATOR, Operator.AND.value)
344
-
345
- def is_and(self) -> bool:
346
- return self._type == TokenType.OPERATOR and self._value == Operator.AND.value
347
-
348
- @staticmethod
349
- def OR() -> Token:
350
- return Token(TokenType.OPERATOR, Operator.OR.value)
351
-
352
- def is_or(self) -> bool:
353
- return self._type == TokenType.OPERATOR and self._value == Operator.OR.value
354
-
355
- @staticmethod
356
- def NOT() -> Token:
357
- return Token(TokenType.UNARY_OPERATOR, Operator.NOT.value)
358
-
359
- def is_not(self) -> bool:
360
- return self._type == TokenType.UNARY_OPERATOR and self._value == Operator.NOT.value
361
-
362
- @staticmethod
363
- def IS() -> Token:
364
- return Token(TokenType.OPERATOR, Operator.IS.value)
365
-
366
- def is_is(self) -> bool:
367
- return self._type == TokenType.OPERATOR and self._value == Operator.IS.value
368
-
369
- # Keyword tokens
370
-
371
- def is_keyword(self) -> bool:
372
- return self._type == TokenType.KEYWORD
373
-
374
- @staticmethod
375
- def WITH() -> Token:
376
- return Token(TokenType.KEYWORD, Keyword.WITH.value)
377
-
378
- def is_with(self) -> bool:
379
- return self._type == TokenType.KEYWORD and self._value == Keyword.WITH.value
380
-
381
- @staticmethod
382
- def RETURN() -> Token:
383
- return Token(TokenType.KEYWORD, Keyword.RETURN.value)
384
-
385
- def is_return(self) -> bool:
386
- return self._type == TokenType.KEYWORD and self._value == Keyword.RETURN.value
387
-
388
- @staticmethod
389
- def LOAD() -> Token:
390
- return Token(TokenType.KEYWORD, Keyword.LOAD.value)
391
-
392
- def is_load(self) -> bool:
393
- return self._type == TokenType.KEYWORD and self._value == Keyword.LOAD.value
394
-
395
- @staticmethod
396
- def CALL() -> Token:
397
- return Token(TokenType.KEYWORD, Keyword.CALL.value)
398
-
399
- def is_call(self) -> bool:
400
- return self._type == TokenType.KEYWORD and self._value == Keyword.CALL.value
401
-
402
- @staticmethod
403
- def YIELD() -> Token:
404
- return Token(TokenType.KEYWORD, Keyword.YIELD.value)
405
-
406
- def is_yield(self) -> bool:
407
- return self._type == TokenType.KEYWORD and self._value == Keyword.YIELD.value
408
-
409
- @staticmethod
410
- def JSON() -> Token:
411
- return Token(TokenType.KEYWORD, Keyword.JSON.value)
412
-
413
- def is_json(self) -> bool:
414
- return self._type == TokenType.KEYWORD and self._value == Keyword.JSON.value
415
-
416
- @staticmethod
417
- def CSV() -> Token:
418
- return Token(TokenType.KEYWORD, Keyword.CSV.value)
419
-
420
- def is_csv(self) -> bool:
421
- return self._type == TokenType.KEYWORD and self._value == Keyword.CSV.value
422
-
423
- @staticmethod
424
- def TEXT() -> Token:
425
- return Token(TokenType.KEYWORD, Keyword.TEXT.value)
426
-
427
- def is_text(self) -> bool:
428
- return self._type == TokenType.KEYWORD and self._value == Keyword.TEXT.value
429
-
430
- @staticmethod
431
- def FROM() -> Token:
432
- return Token(TokenType.KEYWORD, Keyword.FROM.value)
433
-
434
- def is_from(self) -> bool:
435
- return self._type == TokenType.KEYWORD and self._value == Keyword.FROM.value
436
-
437
- @staticmethod
438
- def HEADERS() -> Token:
439
- return Token(TokenType.KEYWORD, Keyword.HEADERS.value)
440
-
441
- def is_headers(self) -> bool:
442
- return self._type == TokenType.KEYWORD and self._value == Keyword.HEADERS.value
443
-
444
- @staticmethod
445
- def POST() -> Token:
446
- return Token(TokenType.KEYWORD, Keyword.POST.value)
447
-
448
- def is_post(self) -> bool:
449
- return self._type == TokenType.KEYWORD and self._value == Keyword.POST.value
450
-
451
- @staticmethod
452
- def UNWIND() -> Token:
453
- return Token(TokenType.KEYWORD, Keyword.UNWIND.value)
454
-
455
- def is_unwind(self) -> bool:
456
- return self._type == TokenType.KEYWORD and self._value == Keyword.UNWIND.value
457
-
458
- @staticmethod
459
- def MATCH() -> Token:
460
- return Token(TokenType.KEYWORD, Keyword.MATCH.value)
461
-
462
- def is_match(self) -> bool:
463
- return self._type == TokenType.KEYWORD and self._value == Keyword.MATCH.value
464
-
465
- @staticmethod
466
- def OPTIONAL() -> Token:
467
- return Token(TokenType.KEYWORD, Keyword.OPTIONAL.value)
468
-
469
- def is_optional(self) -> bool:
470
- return self._type == TokenType.KEYWORD and self._value == Keyword.OPTIONAL.value
471
-
472
- @staticmethod
473
- def AS() -> Token:
474
- return Token(TokenType.KEYWORD, Keyword.AS.value)
475
-
476
- def is_as(self) -> bool:
477
- return self._type == TokenType.KEYWORD and self._value == Keyword.AS.value
478
-
479
- @staticmethod
480
- def WHERE() -> Token:
481
- return Token(TokenType.KEYWORD, Keyword.WHERE.value)
482
-
483
- def is_where(self) -> bool:
484
- return self._type == TokenType.KEYWORD and self._value == Keyword.WHERE.value
485
-
486
- @staticmethod
487
- def MERGE() -> Token:
488
- return Token(TokenType.KEYWORD, Keyword.MERGE.value)
489
-
490
- def is_merge(self) -> bool:
491
- return self._type == TokenType.KEYWORD and self._value == Keyword.MERGE.value
492
-
493
- @staticmethod
494
- def CREATE() -> Token:
495
- return Token(TokenType.KEYWORD, Keyword.CREATE.value)
496
-
497
- def is_create(self) -> bool:
498
- return self._type == TokenType.KEYWORD and self._value == Keyword.CREATE.value
499
-
500
- @staticmethod
501
- def VIRTUAL() -> Token:
502
- return Token(TokenType.KEYWORD, Keyword.VIRTUAL.value)
503
-
504
- def is_virtual(self) -> bool:
505
- return self._type == TokenType.KEYWORD and self._value == Keyword.VIRTUAL.value
506
-
507
- @staticmethod
508
- def DELETE() -> Token:
509
- return Token(TokenType.KEYWORD, Keyword.DELETE.value)
510
-
511
- def is_delete(self) -> bool:
512
- return self._type == TokenType.KEYWORD and self._value == Keyword.DELETE.value
513
-
514
- @staticmethod
515
- def SET() -> Token:
516
- return Token(TokenType.KEYWORD, Keyword.SET.value)
517
-
518
- def is_set(self) -> bool:
519
- return self._type == TokenType.KEYWORD and self._value == Keyword.SET.value
520
-
521
- @staticmethod
522
- def REMOVE() -> Token:
523
- return Token(TokenType.KEYWORD, Keyword.REMOVE.value)
524
-
525
- def is_remove(self) -> bool:
526
- return self._type == TokenType.KEYWORD and self._value == Keyword.REMOVE.value
527
-
528
- @staticmethod
529
- def CASE() -> Token:
530
- return Token(TokenType.KEYWORD, Keyword.CASE.value)
531
-
532
- def is_case(self) -> bool:
533
- return self._type == TokenType.KEYWORD and self._value == Keyword.CASE.value
534
-
535
- @staticmethod
536
- def WHEN() -> Token:
537
- return Token(TokenType.KEYWORD, Keyword.WHEN.value)
538
-
539
- def is_when(self) -> bool:
540
- return self._type == TokenType.KEYWORD and self._value == Keyword.WHEN.value
541
-
542
- @staticmethod
543
- def THEN() -> Token:
544
- return Token(TokenType.KEYWORD, Keyword.THEN.value)
545
-
546
- def is_then(self) -> bool:
547
- return self._type == TokenType.KEYWORD and self._value == Keyword.THEN.value
548
-
549
- @staticmethod
550
- def ELSE() -> Token:
551
- return Token(TokenType.KEYWORD, Keyword.ELSE.value)
552
-
553
- def is_else(self) -> bool:
554
- return self._type == TokenType.KEYWORD and self._value == Keyword.ELSE.value
555
-
556
- @staticmethod
557
- def END() -> Token:
558
- return Token(TokenType.KEYWORD, Keyword.END.value)
559
-
560
- def is_end(self) -> bool:
561
- return self._type == TokenType.KEYWORD and self._value == Keyword.END.value
562
-
563
- @staticmethod
564
- def NULL() -> Token:
565
- return Token(TokenType.KEYWORD, Keyword.NULL.value)
566
-
567
- def is_null(self) -> bool:
568
- return self._type == TokenType.KEYWORD and self._value == Keyword.NULL.value
569
-
570
- @staticmethod
571
- def IN() -> Token:
572
- return Token(TokenType.KEYWORD, Keyword.IN.value)
573
-
574
- def is_in(self) -> bool:
575
- return self._type == TokenType.KEYWORD and self._value == Keyword.IN.value
576
-
577
- @staticmethod
578
- def CONTAINS() -> Token:
579
- return Token(TokenType.KEYWORD, Keyword.CONTAINS.value)
580
-
581
- def is_contains(self) -> bool:
582
- return self._type == TokenType.KEYWORD and self._value == Keyword.CONTAINS.value
583
-
584
- @staticmethod
585
- def STARTS() -> Token:
586
- return Token(TokenType.KEYWORD, Keyword.STARTS.value)
587
-
588
- def is_starts(self) -> bool:
589
- return self._type == TokenType.KEYWORD and self._value == Keyword.STARTS.value
590
-
591
- @staticmethod
592
- def ENDS() -> Token:
593
- return Token(TokenType.KEYWORD, Keyword.ENDS.value)
594
-
595
- def is_ends(self) -> bool:
596
- return self._type == TokenType.KEYWORD and self._value == Keyword.ENDS.value
597
-
598
- @staticmethod
599
- def PIPE() -> Token:
600
- return Token(TokenType.KEYWORD, Operator.PIPE.value)
601
-
602
- def is_pipe(self) -> bool:
603
- return self._type == TokenType.KEYWORD and self._value == Operator.PIPE.value
604
-
605
- @staticmethod
606
- def DISTINCT() -> Token:
607
- return Token(TokenType.KEYWORD, Keyword.DISTINCT.value)
608
-
609
- def is_distinct(self) -> bool:
610
- return self._type == TokenType.KEYWORD and self._value == Keyword.DISTINCT.value
611
-
612
- @staticmethod
613
- def LIMIT() -> Token:
614
- return Token(TokenType.KEYWORD, Keyword.LIMIT.value)
615
-
616
- def is_limit(self) -> bool:
617
- return self._type == TokenType.KEYWORD and self._value == Keyword.LIMIT.value
618
-
619
- @staticmethod
620
- def UNION() -> Token:
621
- return Token(TokenType.KEYWORD, Keyword.UNION.value)
622
-
623
- def is_union(self) -> bool:
624
- return self._type == TokenType.KEYWORD and self._value == Keyword.UNION.value
625
-
626
- @staticmethod
627
- def ALL() -> Token:
628
- return Token(TokenType.KEYWORD, Keyword.ALL.value)
629
-
630
- def is_all(self) -> bool:
631
- return self._type == TokenType.KEYWORD and self._value == Keyword.ALL.value
632
-
633
- @staticmethod
634
- def ORDER() -> Token:
635
- return Token(TokenType.KEYWORD, Keyword.ORDER.value)
636
-
637
- def is_order(self) -> bool:
638
- return self._type == TokenType.KEYWORD and self._value == Keyword.ORDER.value
639
-
640
- @staticmethod
641
- def BY() -> Token:
642
- return Token(TokenType.KEYWORD, Keyword.BY.value)
643
-
644
- def is_by(self) -> bool:
645
- return self._type == TokenType.KEYWORD and self._value == Keyword.BY.value
646
-
647
- @staticmethod
648
- def ASC() -> Token:
649
- return Token(TokenType.KEYWORD, Keyword.ASC.value)
650
-
651
- def is_asc(self) -> bool:
652
- return self._type == TokenType.KEYWORD and self._value == Keyword.ASC.value
653
-
654
- @staticmethod
655
- def DESC() -> Token:
656
- return Token(TokenType.KEYWORD, Keyword.DESC.value)
657
-
658
- def is_desc(self) -> bool:
659
- return self._type == TokenType.KEYWORD and self._value == Keyword.DESC.value
660
-
661
- # End of file token
662
-
663
- @staticmethod
664
- def EOF() -> Token:
665
- return Token(TokenType.EOF)
666
-
667
- def is_eof(self) -> bool:
668
- return self._type == TokenType.EOF
669
-
670
- # Other utility methods
671
-
672
- def is_operand(self) -> bool:
673
- return self.is_number() or self.is_boolean() or self.is_string() or self.is_null()
674
-
675
- def is_whitespace_or_comment(self) -> bool:
676
- return self.is_whitespace() or self.is_comment()
677
-
678
- def is_symbol(self) -> bool:
679
- return self._type == TokenType.SYMBOL
680
-
681
- # Static class method lookup via string
682
- @staticmethod
683
- def method(name: str) -> Optional[Token]:
684
- name_upper = name.upper()
685
- if hasattr(Token, name_upper):
686
- attr = getattr(Token, name_upper)
687
- if callable(attr):
688
- result = attr()
689
- if isinstance(result, Token):
690
- return result
691
- elif isinstance(attr, Token):
692
- return attr
693
- return None