@witchcraft/expressit 0.1.3 → 0.2.1

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 (288) hide show
  1. package/README.md +7 -5
  2. package/dist/Lexer.js +21 -42
  3. package/dist/Parser.d.ts +14 -29
  4. package/dist/Parser.d.ts.map +1 -1
  5. package/dist/Parser.js +151 -197
  6. package/dist/ast/builders/array.d.ts +1 -3
  7. package/dist/ast/builders/array.d.ts.map +1 -1
  8. package/dist/ast/builders/array.js +3 -5
  9. package/dist/ast/builders/condition.d.ts +5 -11
  10. package/dist/ast/builders/condition.d.ts.map +1 -1
  11. package/dist/ast/builders/condition.js +4 -7
  12. package/dist/ast/builders/delim.d.ts +1 -1
  13. package/dist/ast/builders/delim.js +2 -4
  14. package/dist/ast/builders/error.d.ts +3 -4
  15. package/dist/ast/builders/error.d.ts.map +1 -1
  16. package/dist/ast/builders/error.js +6 -2
  17. package/dist/ast/builders/expression.d.ts +3 -7
  18. package/dist/ast/builders/expression.d.ts.map +1 -1
  19. package/dist/ast/builders/expression.js +4 -7
  20. package/dist/ast/builders/group.d.ts +3 -8
  21. package/dist/ast/builders/group.d.ts.map +1 -1
  22. package/dist/ast/builders/group.js +3 -3
  23. package/dist/ast/builders/pos.d.ts +1 -2
  24. package/dist/ast/builders/pos.d.ts.map +1 -1
  25. package/dist/ast/builders/pos.js +3 -6
  26. package/dist/ast/builders/token.d.ts +3 -5
  27. package/dist/ast/builders/token.d.ts.map +1 -1
  28. package/dist/ast/builders/token.js +3 -4
  29. package/dist/ast/builders/type.d.ts +1 -1
  30. package/dist/ast/builders/variable.d.ts +3 -5
  31. package/dist/ast/builders/variable.d.ts.map +1 -1
  32. package/dist/ast/builders/variable.js +4 -7
  33. package/dist/ast/createArrayNode.d.ts +3 -0
  34. package/dist/ast/createArrayNode.d.ts.map +1 -0
  35. package/dist/ast/createArrayNode.js +12 -0
  36. package/dist/ast/createConditionNode.d.ts +11 -0
  37. package/dist/ast/createConditionNode.d.ts.map +1 -0
  38. package/dist/ast/createConditionNode.js +18 -0
  39. package/dist/ast/createExpressionNode.d.ts +3 -0
  40. package/dist/ast/createExpressionNode.d.ts.map +1 -0
  41. package/dist/ast/createExpressionNode.js +14 -0
  42. package/dist/ast/createGroupNode.d.ts +5 -0
  43. package/dist/ast/createGroupNode.d.ts.map +1 -0
  44. package/dist/ast/createGroupNode.js +14 -0
  45. package/dist/ast/createNormalizedCondition.d.ts +3 -0
  46. package/dist/ast/createNormalizedCondition.d.ts.map +1 -0
  47. package/dist/ast/createNormalizedCondition.js +10 -0
  48. package/dist/ast/createNormalizedExpression.d.ts +3 -0
  49. package/dist/ast/createNormalizedExpression.d.ts.map +1 -0
  50. package/dist/ast/createNormalizedExpression.js +10 -0
  51. package/dist/ast/createToken.d.ts +6 -0
  52. package/dist/ast/createToken.d.ts.map +1 -0
  53. package/dist/ast/createToken.js +15 -0
  54. package/dist/ast/createVariableNode.d.ts +3 -0
  55. package/dist/ast/createVariableNode.d.ts.map +1 -0
  56. package/dist/ast/createVariableNode.js +12 -0
  57. package/dist/ast/error.d.ts +3 -0
  58. package/dist/ast/error.d.ts.map +1 -0
  59. package/dist/ast/error.js +8 -0
  60. package/dist/ast/handlers.d.ts +5 -12
  61. package/dist/ast/handlers.d.ts.map +1 -1
  62. package/dist/ast/handlers.js +25 -37
  63. package/dist/ast/index.d.ts +9 -1
  64. package/dist/ast/index.d.ts.map +1 -1
  65. package/dist/ast/index.js +18 -2
  66. package/dist/defaults/defaultConditionNormalizer.d.ts +3 -0
  67. package/dist/defaults/defaultConditionNormalizer.d.ts.map +1 -0
  68. package/dist/defaults/defaultKeyParser.d.ts +3 -0
  69. package/dist/defaults/defaultKeyParser.d.ts.map +1 -0
  70. package/dist/{helpers/general → defaults}/defaultKeyParser.js +1 -2
  71. package/dist/defaults/defaultPrefixApplier.d.ts +3 -0
  72. package/dist/defaults/defaultPrefixApplier.d.ts.map +1 -0
  73. package/dist/defaults/defaultValueComparer.d.ts +3 -0
  74. package/dist/defaults/defaultValueComparer.d.ts.map +1 -0
  75. package/dist/{helpers/general → defaults}/index.d.ts +0 -2
  76. package/dist/defaults/index.d.ts.map +1 -0
  77. package/dist/{helpers/general → defaults}/index.js +0 -4
  78. package/dist/examples/shortcutContextParser.js +4 -10
  79. package/dist/index.d.ts +2 -1
  80. package/dist/index.d.ts.map +1 -1
  81. package/dist/index.js +3 -1
  82. package/dist/{helpers/errors.d.ts → internal/ExpressitError.d.ts} +3 -2
  83. package/dist/internal/ExpressitError.d.ts.map +1 -0
  84. package/dist/{helpers/errors.js → internal/ExpressitError.js} +3 -6
  85. package/dist/internal/applyBoolean.d.ts.map +1 -0
  86. package/dist/{helpers/general → internal}/applyPrefix.d.ts +1 -1
  87. package/dist/internal/applyPrefix.d.ts.map +1 -0
  88. package/dist/{helpers/parser → internal}/checkParserOpts.d.ts +2 -1
  89. package/dist/internal/checkParserOpts.d.ts.map +1 -0
  90. package/dist/{helpers/parser → internal}/checkParserOpts.js +22 -30
  91. package/dist/internal/escapeVariableOrPrefix.d.ts +2 -0
  92. package/dist/internal/escapeVariableOrPrefix.d.ts.map +1 -0
  93. package/dist/internal/escapeVariableOrPrefix.js +34 -0
  94. package/dist/internal/extractPosition.d.ts +5 -0
  95. package/dist/internal/extractPosition.d.ts.map +1 -0
  96. package/dist/internal/getUnclosedRightParenCount.d.ts +4 -0
  97. package/dist/internal/getUnclosedRightParenCount.d.ts.map +1 -0
  98. package/dist/{helpers/parser → internal}/getUnclosedRightParenCount.js +1 -1
  99. package/dist/{helpers/parser → internal}/parseParserOptions.d.ts +1 -1
  100. package/dist/internal/parseParserOptions.d.ts.map +1 -0
  101. package/dist/{helpers/parser → internal}/parseParserOptions.js +4 -4
  102. package/dist/internal/unescape.d.ts.map +1 -0
  103. package/dist/package.json.js +7 -7
  104. package/dist/types/ast.d.ts +195 -6
  105. package/dist/types/ast.d.ts.map +1 -1
  106. package/dist/types/ast.js +2 -0
  107. package/dist/types/autocomplete.d.ts +5 -6
  108. package/dist/types/autocomplete.d.ts.map +1 -1
  109. package/dist/types/parser.d.ts +17 -22
  110. package/dist/types/parser.d.ts.map +1 -1
  111. package/dist/utils/extractTokens.d.ts +2 -4
  112. package/dist/utils/extractTokens.d.ts.map +1 -1
  113. package/dist/utils/extractTokens.js +14 -18
  114. package/dist/utils/generateParentsMap.d.ts +10 -0
  115. package/dist/utils/generateParentsMap.d.ts.map +1 -0
  116. package/dist/utils/generateParentsMap.js +53 -0
  117. package/dist/utils/getCursorInfo.d.ts +1 -1
  118. package/dist/utils/getCursorInfo.d.ts.map +1 -1
  119. package/dist/utils/getCursorInfo.js +11 -21
  120. package/dist/utils/getOppositeDelimiter.d.ts +2 -1
  121. package/dist/utils/getOppositeDelimiter.d.ts.map +1 -1
  122. package/dist/utils/getOppositeDelimiter.js +9 -11
  123. package/dist/utils/getParent.d.ts +5 -0
  124. package/dist/utils/getParent.d.ts.map +1 -0
  125. package/dist/utils/getParent.js +6 -0
  126. package/dist/utils/getSurroundingErrors.d.ts +3 -4
  127. package/dist/utils/getSurroundingErrors.d.ts.map +1 -1
  128. package/dist/utils/getSurroundingErrors.js +3 -3
  129. package/dist/utils/index.d.ts +4 -0
  130. package/dist/utils/index.d.ts.map +1 -1
  131. package/dist/utils/index.js +8 -0
  132. package/dist/utils/isNode.d.ts +10 -0
  133. package/dist/utils/isNode.d.ts.map +1 -0
  134. package/dist/utils/isNode.js +6 -0
  135. package/dist/utils/isToken.d.ts +8 -0
  136. package/dist/utils/isToken.d.ts.map +1 -0
  137. package/dist/utils/isToken.js +6 -0
  138. package/dist/utils/prettyAst.d.ts +1 -2
  139. package/dist/utils/prettyAst.d.ts.map +1 -1
  140. package/dist/utils/prettyAst.js +20 -28
  141. package/package.json +7 -7
  142. package/src/Lexer.ts +2 -2
  143. package/src/Parser.ts +158 -165
  144. package/src/ast/builders/array.ts +4 -9
  145. package/src/ast/builders/condition.ts +10 -15
  146. package/src/ast/builders/delim.ts +1 -1
  147. package/src/ast/builders/error.ts +10 -6
  148. package/src/ast/builders/expression.ts +17 -23
  149. package/src/ast/builders/group.ts +7 -11
  150. package/src/ast/builders/pos.ts +2 -3
  151. package/src/ast/builders/token.ts +6 -7
  152. package/src/ast/builders/type.ts +1 -1
  153. package/src/ast/builders/variable.ts +6 -8
  154. package/src/ast/createArrayNode.ts +17 -0
  155. package/src/ast/createConditionNode.ts +58 -0
  156. package/src/ast/createExpressionNode.ts +21 -0
  157. package/src/ast/createGroupNode.ts +46 -0
  158. package/src/ast/createNormalizedCondition.ts +12 -0
  159. package/src/ast/createNormalizedExpression.ts +9 -0
  160. package/src/ast/createToken.ts +26 -0
  161. package/src/ast/createVariableNode.ts +18 -0
  162. package/src/ast/error.ts +9 -0
  163. package/src/ast/handlers.ts +26 -37
  164. package/src/ast/index.ts +9 -1
  165. package/src/{helpers/general → defaults}/defaultConditionNormalizer.ts +1 -1
  166. package/src/{helpers/general → defaults}/defaultKeyParser.ts +1 -1
  167. package/src/{helpers/general → defaults}/defaultPrefixApplier.ts +1 -1
  168. package/src/{helpers/general → defaults}/defaultValueComparer.ts +1 -1
  169. package/src/{helpers/general → defaults}/index.ts +0 -2
  170. package/src/index.ts +2 -1
  171. package/src/{helpers/errors.ts → internal/ExpressitError.ts} +2 -2
  172. package/src/{helpers/general → internal}/applyPrefix.ts +1 -1
  173. package/src/{helpers/parser → internal}/checkParserOpts.ts +16 -15
  174. package/src/internal/escapeVariableOrPrefix.ts +36 -0
  175. package/src/{helpers/parser → internal}/extractPosition.ts +2 -2
  176. package/src/{helpers/parser → internal}/getUnclosedRightParenCount.ts +1 -2
  177. package/src/{helpers/parser → internal}/parseParserOptions.ts +5 -5
  178. package/src/types/ast.ts +292 -7
  179. package/src/types/autocomplete.ts +5 -7
  180. package/src/types/parser.ts +17 -22
  181. package/src/utils/extractTokens.ts +16 -20
  182. package/src/utils/generateParentsMap.ts +60 -0
  183. package/src/utils/getCursorInfo.ts +4 -6
  184. package/src/utils/getOppositeDelimiter.ts +11 -10
  185. package/src/utils/getParent.ts +16 -0
  186. package/src/utils/getSurroundingErrors.ts +10 -9
  187. package/src/utils/index.ts +4 -0
  188. package/src/utils/isNode.ts +12 -0
  189. package/src/utils/isToken.ts +10 -0
  190. package/src/utils/prettyAst.ts +20 -17
  191. package/dist/ast/classes/ArrayNode.d.ts +0 -18
  192. package/dist/ast/classes/ArrayNode.d.ts.map +0 -1
  193. package/dist/ast/classes/ArrayNode.js +0 -55
  194. package/dist/ast/classes/Condition.d.ts +0 -13
  195. package/dist/ast/classes/Condition.d.ts.map +0 -1
  196. package/dist/ast/classes/Condition.js +0 -21
  197. package/dist/ast/classes/ConditionNode.d.ts +0 -73
  198. package/dist/ast/classes/ConditionNode.d.ts.map +0 -1
  199. package/dist/ast/classes/ConditionNode.js +0 -101
  200. package/dist/ast/classes/ErrorToken.d.ts +0 -27
  201. package/dist/ast/classes/ErrorToken.d.ts.map +0 -1
  202. package/dist/ast/classes/ErrorToken.js +0 -47
  203. package/dist/ast/classes/Expression.d.ts +0 -13
  204. package/dist/ast/classes/Expression.d.ts.map +0 -1
  205. package/dist/ast/classes/Expression.js +0 -19
  206. package/dist/ast/classes/ExpressionNode.d.ts +0 -21
  207. package/dist/ast/classes/ExpressionNode.d.ts.map +0 -1
  208. package/dist/ast/classes/ExpressionNode.js +0 -57
  209. package/dist/ast/classes/GroupNode.d.ts +0 -64
  210. package/dist/ast/classes/GroupNode.d.ts.map +0 -1
  211. package/dist/ast/classes/GroupNode.js +0 -69
  212. package/dist/ast/classes/Node.d.ts +0 -22
  213. package/dist/ast/classes/Node.d.ts.map +0 -1
  214. package/dist/ast/classes/Node.js +0 -28
  215. package/dist/ast/classes/Token.d.ts +0 -27
  216. package/dist/ast/classes/Token.d.ts.map +0 -1
  217. package/dist/ast/classes/Token.js +0 -28
  218. package/dist/ast/classes/ValidToken.d.ts +0 -26
  219. package/dist/ast/classes/ValidToken.d.ts.map +0 -1
  220. package/dist/ast/classes/ValidToken.js +0 -49
  221. package/dist/ast/classes/VariableNode.d.ts +0 -33
  222. package/dist/ast/classes/VariableNode.d.ts.map +0 -1
  223. package/dist/ast/classes/VariableNode.js +0 -58
  224. package/dist/ast/classes/index.d.ts +0 -12
  225. package/dist/ast/classes/index.d.ts.map +0 -1
  226. package/dist/ast/classes/index.js +0 -24
  227. package/dist/helpers/errors.d.ts.map +0 -1
  228. package/dist/helpers/general/applyBoolean.d.ts.map +0 -1
  229. package/dist/helpers/general/applyPrefix.d.ts.map +0 -1
  230. package/dist/helpers/general/defaultConditionNormalizer.d.ts +0 -3
  231. package/dist/helpers/general/defaultConditionNormalizer.d.ts.map +0 -1
  232. package/dist/helpers/general/defaultKeyParser.d.ts +0 -3
  233. package/dist/helpers/general/defaultKeyParser.d.ts.map +0 -1
  234. package/dist/helpers/general/defaultPrefixApplier.d.ts +0 -3
  235. package/dist/helpers/general/defaultPrefixApplier.d.ts.map +0 -1
  236. package/dist/helpers/general/defaultValueComparer.d.ts +0 -3
  237. package/dist/helpers/general/defaultValueComparer.d.ts.map +0 -1
  238. package/dist/helpers/general/index.d.ts.map +0 -1
  239. package/dist/helpers/index.d.ts +0 -4
  240. package/dist/helpers/index.d.ts.map +0 -1
  241. package/dist/helpers/index.js +0 -8
  242. package/dist/helpers/parser/assignParents.d.ts +0 -4
  243. package/dist/helpers/parser/assignParents.d.ts.map +0 -1
  244. package/dist/helpers/parser/assignParents.js +0 -71
  245. package/dist/helpers/parser/checkParserOpts.d.ts.map +0 -1
  246. package/dist/helpers/parser/extractPosition.d.ts +0 -5
  247. package/dist/helpers/parser/extractPosition.d.ts.map +0 -1
  248. package/dist/helpers/parser/getUnclosedRightParenCount.d.ts +0 -4
  249. package/dist/helpers/parser/getUnclosedRightParenCount.d.ts.map +0 -1
  250. package/dist/helpers/parser/index.d.ts +0 -9
  251. package/dist/helpers/parser/index.d.ts.map +0 -1
  252. package/dist/helpers/parser/index.js +0 -18
  253. package/dist/helpers/parser/parseParserOptions.d.ts.map +0 -1
  254. package/dist/helpers/parser/seal.d.ts +0 -8
  255. package/dist/helpers/parser/seal.d.ts.map +0 -1
  256. package/dist/helpers/parser/seal.js +0 -10
  257. package/dist/helpers/parser/setParent.d.ts +0 -6
  258. package/dist/helpers/parser/setParent.d.ts.map +0 -1
  259. package/dist/helpers/parser/setParent.js +0 -4
  260. package/dist/helpers/parser/unescape.d.ts.map +0 -1
  261. package/src/ast/classes/ArrayNode.ts +0 -46
  262. package/src/ast/classes/Condition.ts +0 -22
  263. package/src/ast/classes/ConditionNode.ts +0 -141
  264. package/src/ast/classes/ErrorToken.ts +0 -49
  265. package/src/ast/classes/Expression.ts +0 -26
  266. package/src/ast/classes/ExpressionNode.ts +0 -62
  267. package/src/ast/classes/GroupNode.ts +0 -127
  268. package/src/ast/classes/Node.ts +0 -47
  269. package/src/ast/classes/Token.ts +0 -59
  270. package/src/ast/classes/ValidToken.ts +0 -56
  271. package/src/ast/classes/VariableNode.ts +0 -67
  272. package/src/ast/classes/index.ts +0 -13
  273. package/src/helpers/index.ts +0 -6
  274. package/src/helpers/parser/assignParents.ts +0 -51
  275. package/src/helpers/parser/index.ts +0 -10
  276. package/src/helpers/parser/seal.ts +0 -14
  277. package/src/helpers/parser/setParent.ts +0 -5
  278. /package/dist/{helpers/general → defaults}/defaultConditionNormalizer.js +0 -0
  279. /package/dist/{helpers/general → defaults}/defaultPrefixApplier.js +0 -0
  280. /package/dist/{helpers/general → defaults}/defaultValueComparer.js +0 -0
  281. /package/dist/{helpers/general → internal}/applyBoolean.d.ts +0 -0
  282. /package/dist/{helpers/general → internal}/applyBoolean.js +0 -0
  283. /package/dist/{helpers/general → internal}/applyPrefix.js +0 -0
  284. /package/dist/{helpers/parser → internal}/extractPosition.js +0 -0
  285. /package/dist/{helpers/parser → internal}/unescape.d.ts +0 -0
  286. /package/dist/{helpers/parser → internal}/unescape.js +0 -0
  287. /package/src/{helpers/general → internal}/applyBoolean.ts +0 -0
  288. /package/src/{helpers/parser → internal}/unescape.ts +0 -0
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ### 🚧 WORK IN PROGRESS 🚧
2
2
  [![NPM Version (with latest tag)](https://img.shields.io/npm/v/%40witchcraft%2Fexpressit/latest)](https://www.npmjs.com/package/@witchcraft/expressit/v/latest)
3
- [![NPM Version (with beta tag)](https://img.shields.io/npm/v/%40witchcraft%2Fexpressit/beta)](https://www.npmjs.com/package/@witchcraft/expressit/v/beta)
3
+ <!-- [![NPM Version (with beta tag)](https://img.shields.io/npm/v/%40witchcraft%2Fexpressit/beta)](https://www.npmjs.com/package/@witchcraft/expressit/v/beta) -->
4
4
  [![Build](https://github.com/witchcraftjs/expressit/actions/workflows/build.yml/badge.svg)](https://github.com/witchcraftjs/expressit/actions/workflows/build.yml)
5
5
  [![Docs](https://github.com/witchcraftjs/expressit/workflows/Docs/badge.svg)](https://github.com/witchcraftjs/expressit/actions/workflows/docs.yml)
6
6
  [![Release](https://github.com/witchcraftjs/expressit/actions/workflows/release.yml/badge.svg)](https://github.com/witchcraftjs/expressit/actions/workflows/release.yml)
@@ -34,7 +34,7 @@ pnpm install @witchcraft/expressit
34
34
  - **Other Useful Utility Functions:**
35
35
  - `extractTokens`, `getCursorInfo`, `getOppositeDelimiter`, `getSurroundingErrors` - useful for adding custom syntax highlighting.
36
36
  - `prettyAst` - pretty prints a compact version of the ast for debugging
37
- - other minor helpers - `isDelimiter`, `isQuote`, etc.
37
+ - other minor utilities - `isDelimiter`, `isQuote`, etc.
38
38
  - **Pre-Configured Parsers** - Includes a pre-configured boolean parser (intended for parsing shortcut contexts in a similar way to VS Code).
39
39
  - **Lots of Docs and Tests**
40
40
 
@@ -43,7 +43,6 @@ pnpm install @witchcraft/expressit
43
43
  ```ts
44
44
  // while you can import from "@witchcraft/expressit", if using something like vite, it's recommended you do not use barrel imports.
45
45
  import { Parser } from "@witchcraft/expressit/Parser.js"
46
- import { ErrorToken } from "@witchcraft/expressit/classes/ErrorToken.js"
47
46
 
48
47
  const parser = new Parser({/* opts */})
49
48
  const context = {
@@ -57,8 +56,11 @@ const parser = new Parser({/* opts */})
57
56
 
58
57
  const ast = parser.parse(input)
59
58
 
60
- if (ast instanceof ErrorToken || !ast.valid) {
59
+ if (!ast.valid) {
61
60
  // ...show regular errors (no input, missing tokens, etc)
61
+ if (ast.isToken) {
62
+ // empty input
63
+ }
62
64
  } else {
63
65
  // validation can be controlled by parser options
64
66
  const errors = parser.validate(ast)
@@ -67,7 +69,7 @@ const parser = new Parser({/* opts */})
67
69
 
68
70
  // ON AUTOCOMPLETE
69
71
  const suggestions = parser.autosuggest(input, ast, cursor)
70
- const completions = parser.autocomplete(suggestions, {
72
+ const completions = parser.autocomplete(ast,suggestions, {
71
73
  // known possible suggestions
72
74
  variables: ["c", "d", "e"],
73
75
  // can also be values, prefixes, keywords, properties, etc
package/dist/Lexer.js CHANGED
@@ -1,13 +1,10 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
4
  import { isBlank } from "@alanscodelog/utils/isBlank.js";
8
5
  import { pushIfNotIn } from "@alanscodelog/utils/pushIfNotIn.js";
9
- import { checkParserOpts } from "./helpers/parser/checkParserOpts.js";
10
- import { parseParserOptions } from "./helpers/parser/parseParserOptions.js";
6
+ import { checkParserOpts } from "./internal/checkParserOpts.js";
7
+ import { parseParserOptions } from "./internal/parseParserOptions.js";
11
8
  const regexFlags = /^[a-zA-Z]+/;
12
9
  const BRACKET_PREFIX = "BRACKET";
13
10
  var $T = /* @__PURE__ */ (($T2) => {
@@ -76,8 +73,7 @@ function matchWhileCharNotEqualToUnescaped(char) {
76
73
  end++;
77
74
  c = input[end];
78
75
  }
79
- if (start === end)
80
- return false;
76
+ if (start === end) return false;
81
77
  return input.slice(start, end);
82
78
  };
83
79
  }
@@ -119,12 +115,9 @@ class Lexer {
119
115
  const syms = [...symOrs, ...symAnds, ...symNots];
120
116
  const customPropertyOperators = opts.customPropertyOperators ?? [];
121
117
  const expandedPropertySeparator = opts.expandedPropertySeparator ?? "";
122
- if (expandedPropertySeparator)
123
- syms.push(expandedPropertySeparator);
124
- if (customPropertyOperators.length > 0)
125
- pushIfNotIn(syms, customPropertyOperators);
126
- if (opts.regexValues)
127
- syms.push("\\/");
118
+ if (expandedPropertySeparator) syms.push(expandedPropertySeparator);
119
+ if (customPropertyOperators.length > 0) pushIfNotIn(syms, customPropertyOperators);
120
+ if (opts.regexValues) syms.push("\\/");
128
121
  if (opts.arrayValues) {
129
122
  syms.push("\\[");
130
123
  }
@@ -169,8 +162,7 @@ class Lexer {
169
162
  end++;
170
163
  c = input[end];
171
164
  }
172
- if (start === end)
173
- return false;
165
+ if (start === end) return false;
174
166
  return input.slice(start, end);
175
167
  }
176
168
  }),
@@ -196,8 +188,7 @@ class Lexer {
196
188
  end += match.input.length;
197
189
  }
198
190
  return input.slice(start, end);
199
- } else
200
- return false;
191
+ } else return false;
201
192
  }
202
193
  }),
203
194
  [
@@ -210,10 +201,8 @@ class Lexer {
210
201
  let inGroup = 0;
211
202
  let prevEscaped = false;
212
203
  while (c !== void 0 && (c !== "/" || inGroup > 0 || prevEscaped)) {
213
- if (c === "[")
214
- inGroup++;
215
- if (c === "]" && inGroup > 0)
216
- inGroup--;
204
+ if (c === "[") inGroup++;
205
+ if (c === "]" && inGroup > 0) inGroup--;
217
206
  if (c === "\\") {
218
207
  if (!prevEscaped) {
219
208
  prevEscaped = true;
@@ -226,8 +215,7 @@ class Lexer {
226
215
  end++;
227
216
  c = input[end];
228
217
  }
229
- if (start === end)
230
- return false;
218
+ if (start === end) return false;
231
219
  return input.slice(start, end);
232
220
  }
233
221
  }),
@@ -253,8 +241,7 @@ class Lexer {
253
241
  case "MAIN":
254
242
  return "NOT_SINGLE";
255
243
  default:
256
- if (mode.startsWith(BRACKET_PREFIX))
257
- return "BRACKET_MAIN";
244
+ if (mode.startsWith(BRACKET_PREFIX)) return "BRACKET_MAIN";
258
245
  return "MAIN";
259
246
  }
260
247
  },
@@ -267,8 +254,7 @@ class Lexer {
267
254
  push: (mode, tokens) => {
268
255
  const previous = tokens[tokens.length - 2];
269
256
  if ((previous == null ? void 0 : previous.type) === "VALUE_NOT_DOUBLE" || (previous == null ? void 0 : previous.type) === "VALUE_UNQUOTED") {
270
- if (mode.startsWith(BRACKET_PREFIX))
271
- return "BRACKET_MAIN";
257
+ if (mode.startsWith(BRACKET_PREFIX)) return "BRACKET_MAIN";
272
258
  return "MAIN";
273
259
  }
274
260
  switch (mode) {
@@ -277,8 +263,7 @@ class Lexer {
277
263
  case "MAIN":
278
264
  return "NOT_DOUBLE";
279
265
  default:
280
- if (mode.startsWith(BRACKET_PREFIX))
281
- return "BRACKET_MAIN";
266
+ if (mode.startsWith(BRACKET_PREFIX)) return "BRACKET_MAIN";
282
267
  return "MAIN";
283
268
  }
284
269
  },
@@ -299,8 +284,7 @@ class Lexer {
299
284
  case "MAIN":
300
285
  return "NOT_BACKTICK";
301
286
  default:
302
- if (mode.startsWith(BRACKET_PREFIX))
303
- return "BRACKET_MAIN";
287
+ if (mode.startsWith(BRACKET_PREFIX)) return "BRACKET_MAIN";
304
288
  return "MAIN";
305
289
  }
306
290
  },
@@ -350,8 +334,7 @@ class Lexer {
350
334
  break;
351
335
  }
352
336
  }
353
- if (found)
354
- break;
337
+ if (found) break;
355
338
  }
356
339
  if (c === " " || c === " " || c === "(" || c === ")" || c === "'" || c === '"' || c === "`" || c === "\\" || mode === "BRACKET_MAIN" && c === "]") {
357
340
  break;
@@ -359,8 +342,7 @@ class Lexer {
359
342
  end++;
360
343
  c = input[end];
361
344
  }
362
- if (start === end)
363
- return false;
345
+ if (start === end) return false;
364
346
  return input.slice(start, end);
365
347
  }
366
348
  }),
@@ -424,8 +406,7 @@ class Lexer {
424
406
  matches: (_c, input, start) => {
425
407
  for (const op of opts.expandedPropertySeparator) {
426
408
  const chars = input.slice(start, start + op.length);
427
- if (chars === op)
428
- return op;
409
+ if (chars === op) return op;
429
410
  }
430
411
  return false;
431
412
  }
@@ -439,8 +420,7 @@ class Lexer {
439
420
  matches: (_c, input, start) => {
440
421
  for (const op of opts.customPropertyOperators ?? []) {
441
422
  const chars = input.slice(start, start + op.length);
442
- if (chars === op)
443
- return op;
423
+ if (chars === op) return op;
444
424
  }
445
425
  return false;
446
426
  }
@@ -930,8 +910,7 @@ class Lexer {
930
910
  const newIndex = index + matchLength;
931
911
  const val = match === true ? c : match;
932
912
  const token = createToken(type, val, index, newIndex - 1);
933
- if (!t.skip)
934
- tokens.push(token);
913
+ if (!t.skip) tokens.push(token);
935
914
  if (t.push) {
936
915
  mode = typeof t.push === "function" ? t.push(mode, tokens) : t.push;
937
916
  branch = branches[mode];
package/dist/Parser.d.ts CHANGED
@@ -1,13 +1,6 @@
1
- import type { AddParameters } from "@alanscodelog/utils/types";
2
- import { ArrayNode } from "./ast/classes/ArrayNode.js";
3
- import { ConditionNode } from "./ast/classes/ConditionNode.js";
4
- import { GroupNode } from "./ast/classes/GroupNode.js";
5
- import { Condition, Expression } from "./ast/classes/index.js";
6
- import { ValidToken } from "./ast/classes/ValidToken.js";
7
- import { VariableNode } from "./ast/classes/VariableNode.js";
8
1
  import * as handle from "./ast/handlers.js";
9
2
  import { $C, $T, type Token, type TokenCategoryType, type TokenType } from "./Lexer.js";
10
- import type { ParserResults } from "./types/ast.js";
3
+ import type { ArrayNode, ConditionNode, GroupNode, NormalizedCondition, NormalizedExpression, ParserResults, ValidToken, VariableNode } from "./types/ast.js";
11
4
  import { type AnyToken, type Completion, type Position, type Suggestion, TOKEN_TYPE } from "./types/index.js";
12
5
  import type { FullParserOptions, ParserOptions } from "./types/parser.js";
13
6
  /**
@@ -47,16 +40,8 @@ export declare class Parser<T extends {} = {}> {
47
40
  shift: number;
48
41
  rawInput: string;
49
42
  }): ParserResults;
50
- subParserOne?: Parser<T> & {
51
- parse: AddParameters<Parser<T>["parse"], [{
52
- seal: boolean;
53
- }]>;
54
- };
55
- subParserTwo?: Parser<T> & {
56
- parse: AddParameters<Parser<T>["parse"], [{
57
- seal: boolean;
58
- }]>;
59
- };
43
+ subParserOne?: Parser<T>;
44
+ subParserTwo?: Parser<T>;
60
45
  createSubParserIfNotExists(opts: ParserOptions<T>, which?: "One" | "Two"): Parser["subParserOne"];
61
46
  transformCategoryToken<TC extends $C>(token: Token, categoryToken: TokenCategoryType<TC>): Token<TC>;
62
47
  getCategoryTokens<TType extends $C>(type: TType): TokenCategoryType<TType>["entries"] | undefined;
@@ -118,31 +103,31 @@ export declare class Parser<T extends {} = {}> {
118
103
  ruleBracketR(): ValidToken<TOKEN_TYPE.BRACKETR> | undefined;
119
104
  ruleNot(): ValidToken<TOKEN_TYPE.NOT> | undefined;
120
105
  /**
121
- * Given a list of @see Suggestion entries, the parser options, and a list of variables, prefixes, operators, etc, and the preferred quote type, returns a list of @see Completion entries.
106
+ * Given the ast, a list of {@link Suggestion} entries, the parser options, and a list of variables, prefixes, operators, etc, and the preferred quote type, returns a list of {@link Completion} entries.
122
107
  *
123
108
  * It takes care of suggesting the correct delimiters for fixes, quoting variables/prefixes if it would not be possible to parse them unquoted, and separating symbol from non-symbol (word) operators.
124
109
  *
125
- * Does not add whitespace or group requirements. The suggestion information is still in the completion if you wish to show these. But they should not be added to the completion value if using @see autoreplace which will take care of it.
110
+ * Does not add whitespace or group requirements. The suggestion information is still in the completion if you wish to show these. But they should not be added to the completion value if using {@link autoreplace} which will take care of it.
126
111
  *
127
- * Is not aware of existing values. You will have to use @see getCursorInfo to understand the context in which the suggestion was made, so that, for example, you could filter out used regex flags.
112
+ * Is not aware of existing values. You will have to use {@link getCursorInfo} to understand the context in which the suggestion was made, so that, for example, you could filter out used regex flags.
128
113
  */
129
- autocomplete(suggestions: Suggestion[], { values, arrayValues, variables, prefixes, properties, expandedPropertyOperators, customPropertyOperators, keywords, regexFlags, quote, }?: Partial<Record<"variables" | "values" | "arrayValues" | "prefixes" | "properties" | "regexFlags" | "expandedPropertyOperators" | "customPropertyOperators", string[]>> & {
114
+ autocomplete(ast: ParserResults, suggestions: Suggestion[], { values, arrayValues, variables, prefixes, properties, expandedPropertyOperators, customPropertyOperators, keywords, regexFlags, quote, }?: Partial<Record<"variables" | "values" | "arrayValues" | "prefixes" | "properties" | "regexFlags" | "expandedPropertyOperators" | "customPropertyOperators", string[]>> & {
130
115
  quote?: string;
131
116
  keywords?: FullParserOptions<T>["keywords"];
132
117
  }): Completion[];
133
118
  /**
134
- * Given the input string and a @see Completion consisting of the value of the replacement and a @see Suggestion entry, returns the replacement string and the new position of the cursor.
119
+ * Given the input string and a {@link Completion} consisting of the value of the replacement and a {@link Suggestion} entry, returns the replacement string and the new position of the cursor.
135
120
  *
136
- * The value passed should be escaped if it's needed (or quoted). @see autocomplete already takes care of quoting variables if you're using it.
121
+ * The value passed should be escaped if it's needed (or quoted). {@link autocomplete} already takes care of quoting variables if you're using it.
137
122
  */
138
123
  autoreplace(input: string, { value, suggestion }: Completion): {
139
124
  replacement: string;
140
125
  cursor: number;
141
126
  };
142
127
  /**
143
- * Returns a list of suggestions ( @see Suggestion ). These are not a list of autocomplete entries (with values), but more a list of entries describing possible suggestions. This list can then be passed to @see Parser["autocomplete"] to build a list to show users, from which you can then pick an entry to pass to @see Parser["autoreplace"] .
128
+ * Returns a list of suggestions ( {@link Suggestion} ). These are not a list of autocomplete entries (with values), but more a list of entries describing possible suggestions. This list can then be passed to {@link Parser}["autocomplete"] to build a list to show users, from which you can then pick an entry to pass to {@link Parser}["autoreplace"] .
144
129
  *
145
- * The list returned is "unsorted", but there is still some logic to the order. Fixes for errors are suggested first, in the order returned by @see getSurroundingErrors. Regular suggestions come after in the following order: prefixes if enabled, variables, boolean symbol operators, then boolean word operators.
130
+ * The list returned is "unsorted", but there is still some logic to the order. Fixes for errors are suggested first, in the order returned by {@link getSurroundingErrors}. Regular suggestions come after in the following order: prefixes if enabled, variables, boolean symbol operators, then boolean word operators.
146
131
  *
147
132
  * When the cursor is between two tokens that have possible suggestions, only suggestion types for the token before are returned. For example:
148
133
  *
@@ -167,7 +152,7 @@ export declare class Parser<T extends {} = {}> {
167
152
  *
168
153
  * How the ast is evaluated for different operators can be controlled by the {@link ParserOptions.valueComparer valueComparer} option.
169
154
  */
170
- evaluate(ast: Expression<any, any> | Condition<any, any>, context: Record<string, any>): boolean;
155
+ evaluate(ast: NormalizedExpression<any, any> | NormalizedCondition<any, any>, context: Record<string, any>): boolean;
171
156
  /**
172
157
  * Given the set of indexes returned by {@link getBestIndex}, the set of existing indexes in a database, and the index to sort by\*, will return a list of the best/shortest sets of indexes.
173
158
  *
@@ -195,11 +180,11 @@ export declare class Parser<T extends {} = {}> {
195
180
  *
196
181
  * Queries like `(a || b) && (a || c)` would require all the variables to be indexed `[Set(a), Set(b), Set(c)]`.
197
182
  */
198
- getIndexes(ast: Condition | Expression): Set<string>[];
183
+ getIndexes(ast: NormalizedCondition | NormalizedExpression): Set<string>[];
199
184
  /**
200
185
  * Normalizes the ast by applying {@link GroupNode GroupNodes} and converting {@link ConditionNode ConditionNodes} to {@link NormalizedConditionNode NormalizedConditionNodes}.
201
186
  */
202
- normalize<TType extends string, TValue>(ast: ParserResults): Condition<TType, TValue> | Expression<TType, TValue>;
187
+ normalize<TType extends string, TValue>(ast: ParserResults): NormalizedCondition<TType, TValue> | NormalizedExpression<TType, TValue>;
203
188
  /**
204
189
  * Allows pre-validating ASTs for syntax highlighting purposes.
205
190
  * Works similar to evaluate. Internally it will use the prefixApplier, keyParser, and valueValidator (instead of comparer).
@@ -1 +1 @@
1
- {"version":3,"file":"Parser.d.ts","sourceRoot":"","sources":["../src/Parser.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,2BAA2B,CAAA;AAI5E,OAAO,EAAE,SA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