@witchcraft/expressit 0.1.2 → 0.2.0

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 (285) hide show
  1. package/README.md +9 -5
  2. package/dist/Lexer.js +2 -2
  3. package/dist/Parser.d.ts +14 -29
  4. package/dist/Parser.d.ts.map +1 -1
  5. package/dist/Parser.js +120 -135
  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 +2 -3
  12. package/dist/ast/builders/delim.d.ts +1 -1
  13. package/dist/ast/builders/error.d.ts +3 -4
  14. package/dist/ast/builders/error.d.ts.map +1 -1
  15. package/dist/ast/builders/error.js +6 -2
  16. package/dist/ast/builders/expression.d.ts +3 -7
  17. package/dist/ast/builders/expression.d.ts.map +1 -1
  18. package/dist/ast/builders/expression.js +3 -5
  19. package/dist/ast/builders/group.d.ts +3 -8
  20. package/dist/ast/builders/group.d.ts.map +1 -1
  21. package/dist/ast/builders/group.js +3 -3
  22. package/dist/ast/builders/pos.d.ts +1 -2
  23. package/dist/ast/builders/pos.d.ts.map +1 -1
  24. package/dist/ast/builders/token.d.ts +3 -5
  25. package/dist/ast/builders/token.d.ts.map +1 -1
  26. package/dist/ast/builders/token.js +3 -4
  27. package/dist/ast/builders/type.d.ts +1 -1
  28. package/dist/ast/builders/variable.d.ts +3 -5
  29. package/dist/ast/builders/variable.d.ts.map +1 -1
  30. package/dist/ast/builders/variable.js +2 -3
  31. package/dist/ast/createArrayNode.d.ts +3 -0
  32. package/dist/ast/createArrayNode.d.ts.map +1 -0
  33. package/dist/ast/createArrayNode.js +12 -0
  34. package/dist/ast/createConditionNode.d.ts +11 -0
  35. package/dist/ast/createConditionNode.d.ts.map +1 -0
  36. package/dist/ast/createConditionNode.js +18 -0
  37. package/dist/ast/createExpressionNode.d.ts +3 -0
  38. package/dist/ast/createExpressionNode.d.ts.map +1 -0
  39. package/dist/ast/createExpressionNode.js +14 -0
  40. package/dist/ast/createGroupNode.d.ts +5 -0
  41. package/dist/ast/createGroupNode.d.ts.map +1 -0
  42. package/dist/ast/createGroupNode.js +14 -0
  43. package/dist/ast/createNormalizedCondition.d.ts +3 -0
  44. package/dist/ast/createNormalizedCondition.d.ts.map +1 -0
  45. package/dist/ast/createNormalizedCondition.js +10 -0
  46. package/dist/ast/createNormalizedExpression.d.ts +3 -0
  47. package/dist/ast/createNormalizedExpression.d.ts.map +1 -0
  48. package/dist/ast/createNormalizedExpression.js +10 -0
  49. package/dist/ast/createToken.d.ts +6 -0
  50. package/dist/ast/createToken.d.ts.map +1 -0
  51. package/dist/ast/createToken.js +15 -0
  52. package/dist/ast/createVariableNode.d.ts +3 -0
  53. package/dist/ast/createVariableNode.d.ts.map +1 -0
  54. package/dist/ast/createVariableNode.js +12 -0
  55. package/dist/ast/error.d.ts +3 -0
  56. package/dist/ast/error.d.ts.map +1 -0
  57. package/dist/ast/error.js +9 -0
  58. package/dist/ast/handlers.d.ts +5 -12
  59. package/dist/ast/handlers.d.ts.map +1 -1
  60. package/dist/ast/handlers.js +21 -29
  61. package/dist/ast/index.d.ts +9 -1
  62. package/dist/ast/index.d.ts.map +1 -1
  63. package/dist/ast/index.js +18 -2
  64. package/dist/defaults/defaultConditionNormalizer.d.ts +3 -0
  65. package/dist/defaults/defaultConditionNormalizer.d.ts.map +1 -0
  66. package/dist/defaults/defaultKeyParser.d.ts +3 -0
  67. package/dist/defaults/defaultKeyParser.d.ts.map +1 -0
  68. package/dist/defaults/defaultPrefixApplier.d.ts +3 -0
  69. package/dist/defaults/defaultPrefixApplier.d.ts.map +1 -0
  70. package/dist/defaults/defaultValueComparer.d.ts +3 -0
  71. package/dist/defaults/defaultValueComparer.d.ts.map +1 -0
  72. package/dist/{helpers/general → defaults}/index.d.ts +0 -2
  73. package/dist/defaults/index.d.ts.map +1 -0
  74. package/dist/{helpers/general → defaults}/index.js +0 -4
  75. package/dist/index.d.ts +2 -1
  76. package/dist/index.d.ts.map +1 -1
  77. package/dist/index.js +3 -1
  78. package/dist/{helpers/errors.d.ts → internal/ExpressitError.d.ts} +3 -2
  79. package/dist/internal/ExpressitError.d.ts.map +1 -0
  80. package/dist/{helpers/errors.js → internal/ExpressitError.js} +2 -2
  81. package/dist/internal/applyBoolean.d.ts.map +1 -0
  82. package/dist/{helpers/general → internal}/applyPrefix.d.ts +1 -1
  83. package/dist/internal/applyPrefix.d.ts.map +1 -0
  84. package/dist/{helpers/parser → internal}/checkParserOpts.d.ts +2 -1
  85. package/dist/internal/checkParserOpts.d.ts.map +1 -0
  86. package/dist/{helpers/parser → internal}/checkParserOpts.js +14 -14
  87. package/dist/internal/escapeVariableOrPrefix.d.ts +2 -0
  88. package/dist/internal/escapeVariableOrPrefix.d.ts.map +1 -0
  89. package/dist/internal/escapeVariableOrPrefix.js +38 -0
  90. package/dist/internal/extractPosition.d.ts +5 -0
  91. package/dist/internal/extractPosition.d.ts.map +1 -0
  92. package/dist/internal/getUnclosedRightParenCount.d.ts +4 -0
  93. package/dist/internal/getUnclosedRightParenCount.d.ts.map +1 -0
  94. package/dist/{helpers/parser → internal}/getUnclosedRightParenCount.js +1 -1
  95. package/dist/{helpers/parser → internal}/parseParserOptions.d.ts +1 -1
  96. package/dist/internal/parseParserOptions.d.ts.map +1 -0
  97. package/dist/{helpers/parser → internal}/parseParserOptions.js +4 -4
  98. package/dist/internal/unescape.d.ts.map +1 -0
  99. package/dist/package.json.js +7 -7
  100. package/dist/types/ast.d.ts +195 -6
  101. package/dist/types/ast.d.ts.map +1 -1
  102. package/dist/types/ast.js +2 -0
  103. package/dist/types/autocomplete.d.ts +5 -6
  104. package/dist/types/autocomplete.d.ts.map +1 -1
  105. package/dist/types/parser.d.ts +17 -22
  106. package/dist/types/parser.d.ts.map +1 -1
  107. package/dist/utils/extractTokens.d.ts +2 -4
  108. package/dist/utils/extractTokens.d.ts.map +1 -1
  109. package/dist/utils/extractTokens.js +14 -18
  110. package/dist/utils/generateParentsMap.d.ts +10 -0
  111. package/dist/utils/generateParentsMap.d.ts.map +1 -0
  112. package/dist/utils/generateParentsMap.js +73 -0
  113. package/dist/utils/getCursorInfo.d.ts +1 -1
  114. package/dist/utils/getCursorInfo.d.ts.map +1 -1
  115. package/dist/utils/getCursorInfo.js +3 -5
  116. package/dist/utils/getOppositeDelimiter.d.ts +2 -1
  117. package/dist/utils/getOppositeDelimiter.d.ts.map +1 -1
  118. package/dist/utils/getOppositeDelimiter.js +6 -5
  119. package/dist/utils/getParent.d.ts +5 -0
  120. package/dist/utils/getParent.d.ts.map +1 -0
  121. package/dist/utils/getParent.js +6 -0
  122. package/dist/utils/getSurroundingErrors.d.ts +3 -4
  123. package/dist/utils/getSurroundingErrors.d.ts.map +1 -1
  124. package/dist/utils/getSurroundingErrors.js +3 -3
  125. package/dist/utils/index.d.ts +4 -0
  126. package/dist/utils/index.d.ts.map +1 -1
  127. package/dist/utils/index.js +8 -0
  128. package/dist/utils/isNode.d.ts +10 -0
  129. package/dist/utils/isNode.d.ts.map +1 -0
  130. package/dist/utils/isNode.js +6 -0
  131. package/dist/utils/isToken.d.ts +8 -0
  132. package/dist/utils/isToken.d.ts.map +1 -0
  133. package/dist/utils/isToken.js +6 -0
  134. package/dist/utils/prettyAst.d.ts +1 -2
  135. package/dist/utils/prettyAst.d.ts.map +1 -1
  136. package/dist/utils/prettyAst.js +19 -26
  137. package/package.json +7 -7
  138. package/src/Lexer.ts +2 -2
  139. package/src/Parser.ts +158 -165
  140. package/src/ast/builders/array.ts +4 -9
  141. package/src/ast/builders/condition.ts +10 -15
  142. package/src/ast/builders/delim.ts +1 -1
  143. package/src/ast/builders/error.ts +10 -6
  144. package/src/ast/builders/expression.ts +17 -23
  145. package/src/ast/builders/group.ts +7 -11
  146. package/src/ast/builders/pos.ts +2 -3
  147. package/src/ast/builders/token.ts +6 -7
  148. package/src/ast/builders/type.ts +1 -1
  149. package/src/ast/builders/variable.ts +6 -8
  150. package/src/ast/createArrayNode.ts +17 -0
  151. package/src/ast/createConditionNode.ts +58 -0
  152. package/src/ast/createExpressionNode.ts +21 -0
  153. package/src/ast/createGroupNode.ts +46 -0
  154. package/src/ast/createNormalizedCondition.ts +12 -0
  155. package/src/ast/createNormalizedExpression.ts +9 -0
  156. package/src/ast/createToken.ts +26 -0
  157. package/src/ast/createVariableNode.ts +18 -0
  158. package/src/ast/error.ts +9 -0
  159. package/src/ast/handlers.ts +26 -37
  160. package/src/ast/index.ts +9 -1
  161. package/src/{helpers/general → defaults}/defaultConditionNormalizer.ts +1 -1
  162. package/src/{helpers/general → defaults}/defaultKeyParser.ts +1 -1
  163. package/src/{helpers/general → defaults}/defaultPrefixApplier.ts +1 -1
  164. package/src/{helpers/general → defaults}/defaultValueComparer.ts +1 -1
  165. package/src/{helpers/general → defaults}/index.ts +0 -2
  166. package/src/index.ts +2 -1
  167. package/src/{helpers/errors.ts → internal/ExpressitError.ts} +2 -2
  168. package/src/{helpers/general → internal}/applyPrefix.ts +1 -1
  169. package/src/{helpers/parser → internal}/checkParserOpts.ts +16 -15
  170. package/src/internal/escapeVariableOrPrefix.ts +36 -0
  171. package/src/{helpers/parser → internal}/extractPosition.ts +2 -2
  172. package/src/{helpers/parser → internal}/getUnclosedRightParenCount.ts +1 -2
  173. package/src/{helpers/parser → internal}/parseParserOptions.ts +5 -5
  174. package/src/types/ast.ts +292 -7
  175. package/src/types/autocomplete.ts +5 -7
  176. package/src/types/parser.ts +17 -22
  177. package/src/utils/extractTokens.ts +16 -20
  178. package/src/utils/generateParentsMap.ts +60 -0
  179. package/src/utils/getCursorInfo.ts +4 -6
  180. package/src/utils/getOppositeDelimiter.ts +11 -10
  181. package/src/utils/getParent.ts +16 -0
  182. package/src/utils/getSurroundingErrors.ts +10 -9
  183. package/src/utils/index.ts +4 -0
  184. package/src/utils/isNode.ts +12 -0
  185. package/src/utils/isToken.ts +10 -0
  186. package/src/utils/prettyAst.ts +20 -17
  187. package/dist/ast/classes/ArrayNode.d.ts +0 -18
  188. package/dist/ast/classes/ArrayNode.d.ts.map +0 -1
  189. package/dist/ast/classes/ArrayNode.js +0 -55
  190. package/dist/ast/classes/Condition.d.ts +0 -13
  191. package/dist/ast/classes/Condition.d.ts.map +0 -1
  192. package/dist/ast/classes/Condition.js +0 -21
  193. package/dist/ast/classes/ConditionNode.d.ts +0 -73
  194. package/dist/ast/classes/ConditionNode.d.ts.map +0 -1
  195. package/dist/ast/classes/ConditionNode.js +0 -101
  196. package/dist/ast/classes/ErrorToken.d.ts +0 -27
  197. package/dist/ast/classes/ErrorToken.d.ts.map +0 -1
  198. package/dist/ast/classes/ErrorToken.js +0 -47
  199. package/dist/ast/classes/Expression.d.ts +0 -13
  200. package/dist/ast/classes/Expression.d.ts.map +0 -1
  201. package/dist/ast/classes/Expression.js +0 -19
  202. package/dist/ast/classes/ExpressionNode.d.ts +0 -21
  203. package/dist/ast/classes/ExpressionNode.d.ts.map +0 -1
  204. package/dist/ast/classes/ExpressionNode.js +0 -57
  205. package/dist/ast/classes/GroupNode.d.ts +0 -64
  206. package/dist/ast/classes/GroupNode.d.ts.map +0 -1
  207. package/dist/ast/classes/GroupNode.js +0 -69
  208. package/dist/ast/classes/Node.d.ts +0 -22
  209. package/dist/ast/classes/Node.d.ts.map +0 -1
  210. package/dist/ast/classes/Node.js +0 -28
  211. package/dist/ast/classes/Token.d.ts +0 -27
  212. package/dist/ast/classes/Token.d.ts.map +0 -1
  213. package/dist/ast/classes/Token.js +0 -28
  214. package/dist/ast/classes/ValidToken.d.ts +0 -26
  215. package/dist/ast/classes/ValidToken.d.ts.map +0 -1
  216. package/dist/ast/classes/ValidToken.js +0 -49
  217. package/dist/ast/classes/VariableNode.d.ts +0 -33
  218. package/dist/ast/classes/VariableNode.d.ts.map +0 -1
  219. package/dist/ast/classes/VariableNode.js +0 -58
  220. package/dist/ast/classes/index.d.ts +0 -12
  221. package/dist/ast/classes/index.d.ts.map +0 -1
  222. package/dist/ast/classes/index.js +0 -24
  223. package/dist/helpers/errors.d.ts.map +0 -1
  224. package/dist/helpers/general/applyBoolean.d.ts.map +0 -1
  225. package/dist/helpers/general/applyPrefix.d.ts.map +0 -1
  226. package/dist/helpers/general/defaultConditionNormalizer.d.ts +0 -3
  227. package/dist/helpers/general/defaultConditionNormalizer.d.ts.map +0 -1
  228. package/dist/helpers/general/defaultKeyParser.d.ts +0 -3
  229. package/dist/helpers/general/defaultKeyParser.d.ts.map +0 -1
  230. package/dist/helpers/general/defaultPrefixApplier.d.ts +0 -3
  231. package/dist/helpers/general/defaultPrefixApplier.d.ts.map +0 -1
  232. package/dist/helpers/general/defaultValueComparer.d.ts +0 -3
  233. package/dist/helpers/general/defaultValueComparer.d.ts.map +0 -1
  234. package/dist/helpers/general/index.d.ts.map +0 -1
  235. package/dist/helpers/index.d.ts +0 -4
  236. package/dist/helpers/index.d.ts.map +0 -1
  237. package/dist/helpers/index.js +0 -8
  238. package/dist/helpers/parser/assignParents.d.ts +0 -4
  239. package/dist/helpers/parser/assignParents.d.ts.map +0 -1
  240. package/dist/helpers/parser/assignParents.js +0 -71
  241. package/dist/helpers/parser/checkParserOpts.d.ts.map +0 -1
  242. package/dist/helpers/parser/extractPosition.d.ts +0 -5
  243. package/dist/helpers/parser/extractPosition.d.ts.map +0 -1
  244. package/dist/helpers/parser/getUnclosedRightParenCount.d.ts +0 -4
  245. package/dist/helpers/parser/getUnclosedRightParenCount.d.ts.map +0 -1
  246. package/dist/helpers/parser/index.d.ts +0 -9
  247. package/dist/helpers/parser/index.d.ts.map +0 -1
  248. package/dist/helpers/parser/index.js +0 -18
  249. package/dist/helpers/parser/parseParserOptions.d.ts.map +0 -1
  250. package/dist/helpers/parser/seal.d.ts +0 -8
  251. package/dist/helpers/parser/seal.d.ts.map +0 -1
  252. package/dist/helpers/parser/seal.js +0 -10
  253. package/dist/helpers/parser/setParent.d.ts +0 -6
  254. package/dist/helpers/parser/setParent.d.ts.map +0 -1
  255. package/dist/helpers/parser/setParent.js +0 -4
  256. package/dist/helpers/parser/unescape.d.ts.map +0 -1
  257. package/src/ast/classes/ArrayNode.ts +0 -46
  258. package/src/ast/classes/Condition.ts +0 -22
  259. package/src/ast/classes/ConditionNode.ts +0 -141
  260. package/src/ast/classes/ErrorToken.ts +0 -49
  261. package/src/ast/classes/Expression.ts +0 -26
  262. package/src/ast/classes/ExpressionNode.ts +0 -62
  263. package/src/ast/classes/GroupNode.ts +0 -127
  264. package/src/ast/classes/Node.ts +0 -47
  265. package/src/ast/classes/Token.ts +0 -59
  266. package/src/ast/classes/ValidToken.ts +0 -56
  267. package/src/ast/classes/VariableNode.ts +0 -67
  268. package/src/ast/classes/index.ts +0 -13
  269. package/src/helpers/index.ts +0 -6
  270. package/src/helpers/parser/assignParents.ts +0 -51
  271. package/src/helpers/parser/index.ts +0 -10
  272. package/src/helpers/parser/seal.ts +0 -14
  273. package/src/helpers/parser/setParent.ts +0 -5
  274. /package/dist/{helpers/general → defaults}/defaultConditionNormalizer.js +0 -0
  275. /package/dist/{helpers/general → defaults}/defaultKeyParser.js +0 -0
  276. /package/dist/{helpers/general → defaults}/defaultPrefixApplier.js +0 -0
  277. /package/dist/{helpers/general → defaults}/defaultValueComparer.js +0 -0
  278. /package/dist/{helpers/general → internal}/applyBoolean.d.ts +0 -0
  279. /package/dist/{helpers/general → internal}/applyBoolean.js +0 -0
  280. /package/dist/{helpers/general → internal}/applyPrefix.js +0 -0
  281. /package/dist/{helpers/parser → internal}/extractPosition.js +0 -0
  282. /package/dist/{helpers/parser → internal}/unescape.d.ts +0 -0
  283. /package/dist/{helpers/parser → internal}/unescape.js +0 -0
  284. /package/src/{helpers/general → internal}/applyBoolean.ts +0 -0
  285. /package/src/{helpers/parser → internal}/unescape.ts +0 -0
@@ -1,20 +1,14 @@
1
- import { type AnyToken, type TOKEN_TYPE } from "../../types/ast.js";
2
- import type { ArrayNode } from "../classes/ArrayNode.js";
3
- import { ConditionNode } from "../classes/ConditionNode.js";
4
- import type { ErrorToken } from "../classes/ErrorToken.js";
5
- import type { GroupNode } from "../classes/GroupNode.js";
6
- import type { ValidToken } from "../classes/ValidToken.js";
7
- import type { VariableNode } from "../classes/VariableNode.js";
1
+ import { type AnyToken, type ArrayNode, type ConditionNode, type ErrorToken, type GroupNode, type TOKEN_TYPE, type ValidToken, type VariableNode } from "../../types/ast.js";
8
2
  /**
9
- * Creates a @see ConditionNode
3
+ * Creates a {@link ConditionNode}
10
4
  *
11
- * @param variable An existing @see VariableNode
5
+ * @param variable An existing {@link VariableNode}
12
6
  *
13
- * @param not Defaults to plain true condition. To negate it you must pass an existing "not" operator @see ValidToken which will be set as the node's operator and set the node's value to false.
7
+ * @param not Defaults to plain true condition. To negate it you must pass an existing "not" operator {@link ValidToken} which will be set as the node's operator and set the node's value to false.
14
8
  *
15
9
  * @param property Set the property for a property operator. A property operator must be passed if this is passed.
16
10
  * @param propertyOperator Set the operator for a property condition. A property must have been passed. The property operator must be a valid token. There is no case where it would not be. If using an operator that is the same as a separator, if used as an operator, should be set as an operator.
17
11
  * @param sep Pass separator tokens for expanded property conditions.
18
12
  */
19
- export declare function condition(value: VariableNode | GroupNode | ArrayNode | ErrorToken<TOKEN_TYPE.VALUE>, not?: true | ValidToken<TOKEN_TYPE.NOT>, property?: VariableNode | ErrorToken<TOKEN_TYPE.VALUE>, propertyOperator?: AnyToken<TOKEN_TYPE.OP_CUSTOM | TOKEN_TYPE.VALUE>, { right, left }?: Partial<Record<"right" | "left", ValidToken<TOKEN_TYPE.OP_EXPANDED_SEP>>>): ConditionNode;
13
+ export declare function condition(value: VariableNode | GroupNode | ArrayNode | ErrorToken, not?: true | ValidToken<TOKEN_TYPE.NOT>, property?: VariableNode | ErrorToken, propertyOperator?: AnyToken<TOKEN_TYPE.OP_CUSTOM | TOKEN_TYPE.VALUE>, { right, left }?: Partial<Record<"right" | "left", ValidToken<TOKEN_TYPE.OP_EXPANDED_SEP>>>): ConditionNode;
20
14
  //# sourceMappingURL=condition.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"condition.d.ts","sourceRoot":"","sources":["../../../src/ast/builders/condition.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,QAAQ,EAAiB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAClF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAE9D;;;;;;;;;;GAUG;AAEH,wBAAgB,SAAS,CACxB,KAAK,EACH,YAAY,GACZ,SAAS,GACT,SAAS,GACT,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,EAC9B,GAAG,GAAE,IAAI,GAAG,UAAU,CAAC,UAAU,CAAC,GAAG,CAAQ,EAC7C,QAAQ,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,EACtD,gBAAgB,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,EACpE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAE,OAAO,CAAC,MAAM,CAAC,OAAO,GAAG,MAAM,EAAE,UAAU,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAO,GAC9F,aAAa,CAsBf"}
1
+ {"version":3,"file":"condition.d.ts","sourceRoot":"","sources":["../../../src/ast/builders/condition.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,KAAK,aAAa,EAAE,KAAK,UAAU,EAAmB,KAAK,SAAS,EAAiB,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAG5M;;;;;;;;;;GAUG;AAEH,wBAAgB,SAAS,CACxB,KAAK,EACH,YAAY,GACZ,SAAS,GACT,SAAS,GACT,UAAU,EACZ,GAAG,GAAE,IAAI,GAAG,UAAU,CAAC,UAAU,CAAC,GAAG,CAAQ,EAC7C,QAAQ,CAAC,EAAE,YAAY,GAAG,UAAU,EACpC,gBAAgB,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,EACpE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAE,OAAO,CAAC,MAAM,CAAC,OAAO,GAAG,MAAM,EAAE,UAAU,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAO,GAC9F,aAAa,CAsBf"}
@@ -1,5 +1,5 @@
1
1
  import { pos } from "./pos.js";
2
- import { ConditionNode } from "../classes/ConditionNode.js";
2
+ import { createConditionNode } from "../createConditionNode.js";
3
3
  function condition(value, not = true, property, propertyOperator, { right, left } = {}) {
4
4
  const position = pos(value);
5
5
  const notStart = not === true ? void 0 : not.start;
@@ -20,8 +20,7 @@ function condition(value, not = true, property, propertyOperator, { right, left
20
20
  if (left)
21
21
  node.sep.left = left;
22
22
  }
23
- const instance = new ConditionNode(node);
24
- return instance;
23
+ return createConditionNode(node);
25
24
  }
26
25
  export {
27
26
  condition
@@ -1,6 +1,6 @@
1
1
  import { type ExtractTokenType } from "../../types/ast.js";
2
2
  /**
3
- * Faster way, more intuitive way to generate the options for matching delimiters (e.g. quotes and parens) for functions like @see variable and @see group .
3
+ * Faster way, more intuitive way to generate the options for matching delimiters (e.g. quotes and parens) for functions like {@link variable} and {@link group} .
4
4
  */
5
5
  export declare function delim<TLeft extends boolean | string, TRight extends boolean | string, TType extends TLeft extends string ? ExtractTokenType<TLeft> : TRight extends string ? ExtractTokenType<TRight> : undefined>(left?: TLeft, right?: TRight): {
6
6
  left: TLeft extends string ? true : TLeft;
@@ -1,9 +1,8 @@
1
- import { TOKEN_TYPE } from "../../types/ast.js";
2
- import { ErrorToken } from "../classes/ErrorToken.js";
1
+ import { type ErrorToken, TOKEN_TYPE } from "../../types/ast.js";
3
2
  /**
4
3
  * Creates an error token.
5
4
  *
6
- * @param expected Can be passed an array of @see ValidToken_TYPE or strings, in which case it will use @see type internally. So instead of `[TOKEN_TYPE.VALUE]` we can do `[""]` and instead of `[TOKEN_TYPE.PARENR]` we can do `[")"]`.
5
+ * @param expected Can be passed an array of {@link ValidToken_TYPE} or strings, in which case it will use {@link type} internally. So instead of `[TOKEN_TYPE.VALUE]` we can do `[""]` and instead of `[TOKEN_TYPE.PARENR]` we can do `[")"]`.
7
6
  */
8
- export declare function error<T extends TOKEN_TYPE>(pos: number, expected: T[]): ErrorToken<T>;
7
+ export declare function error<T extends TOKEN_TYPE>(pos: number, expected: T[]): ErrorToken;
9
8
  //# sourceMappingURL=error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/ast/builders/error.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAGrD;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/ast/builders/error.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,UAAU,EAAC,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAI/D;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,UAAU,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { type } from "./type.js";
2
2
  import { TOKEN_TYPE } from "../../types/ast.js";
3
- import { ErrorToken } from "../classes/ErrorToken.js";
3
+ import { createToken } from "../createToken.js";
4
4
  function error(pos, expected_) {
5
5
  const expected = expected_.map((item) => {
6
6
  if (TOKEN_TYPE[item] === void 0) {
@@ -9,7 +9,11 @@ function error(pos, expected_) {
9
9
  return item;
10
10
  }
11
11
  });
12
- return new ErrorToken({ expected, start: pos, end: pos });
12
+ return createToken({
13
+ expected,
14
+ start: pos,
15
+ end: pos
16
+ });
13
17
  }
14
18
  export {
15
19
  error
@@ -1,12 +1,8 @@
1
- import { type AnyToken, TOKEN_TYPE, type TokenBooleanTypes } from "../../types/ast.js";
2
- import type { ConditionNode } from "../classes/ConditionNode.js";
3
- import type { ErrorToken } from "../classes/ErrorToken.js";
4
- import { ExpressionNode } from "../classes/ExpressionNode.js";
5
- import type { GroupNode } from "../classes/GroupNode.js";
1
+ import { type AnyToken, type ConditionNode, type ErrorToken, type ExpressionNode, type GroupNode, type TokenBooleanTypes } from "../../types/ast.js";
6
2
  /**
7
- * Creates an @see ExpressionNode, can be passed nothing for any of the tokens to automatically create error tokens.
3
+ * Creates an {@link ExpressionNode}, can be passed nothing for any of the tokens to automatically create error tokens.
8
4
  *
9
5
  * Also automatically sets the correct start/end positions from valid tokens (e.g. for start, searching left to right for a valid token and vice versa) assuming at least one is defined.
10
6
  */
11
- export declare function expression(left: ConditionNode | ExpressionNode | GroupNode | ErrorToken<TOKEN_TYPE.VALUE> | undefined, operator: AnyToken<TokenBooleanTypes> | undefined, right: ConditionNode | ExpressionNode | GroupNode | ErrorToken<TOKEN_TYPE.VALUE> | undefined): ExpressionNode;
7
+ export declare function expression(left: ConditionNode | ExpressionNode | GroupNode | ErrorToken | undefined, operator: AnyToken<TokenBooleanTypes> | undefined, right: ConditionNode | ExpressionNode | GroupNode | ErrorToken | undefined): ExpressionNode;
12
8
  //# sourceMappingURL=expression.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"expression.d.ts","sourceRoot":"","sources":["../../../src/ast/builders/expression.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,QAAQ,EAAiB,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACrG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAGxD;;;;GAIG;AACH,wBAAgB,UAAU,CACzB,IAAI,EACJ,aAAa,GACb,cAAc,GACd,SAAS,GACT,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,GAC5B,SAAS,EACT,QAAQ,EACR,QAAQ,CAAC,iBAAiB,CAAC,GAC3B,SAAS,EACT,KAAK,EACL,aAAa,GACb,cAAc,GACd,SAAS,GACT,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,GAC5B,SAAS,GACP,cAAc,CAkChB"}
1
+ {"version":3,"file":"expression.d.ts","sourceRoot":"","sources":["../../../src/ast/builders/expression.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,KAAK,cAAc,EAAC,KAAK,SAAS,EAA6B,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAI9K;;;;GAIG;AACH,wBAAgB,UAAU,CACzB,IAAI,EACH,aAAa,GACb,cAAc,GACd,SAAS,GACT,UAAU,GACV,SAAS,EACV,QAAQ,EACP,QAAQ,CAAC,iBAAiB,CAAC,GAC3B,SAAS,EACV,KAAK,EACJ,aAAa,GACb,cAAc,GACd,SAAS,GACT,UAAU,GACV,SAAS,GACR,cAAc,CA+BhB"}
@@ -1,7 +1,7 @@
1
1
  import { pos } from "./pos.js";
2
2
  import { token } from "./token.js";
3
3
  import { TOKEN_TYPE } from "../../types/ast.js";
4
- import { ExpressionNode } from "../classes/ExpressionNode.js";
4
+ import { createExpressionNode } from "../createExpressionNode.js";
5
5
  function expression(left, operator, right) {
6
6
  const start = (left == null ? void 0 : left.start) ?? (operator == null ? void 0 : operator.start) ?? (right == null ? void 0 : right.start);
7
7
  const end = (right == null ? void 0 : right.end) ?? (operator == null ? void 0 : operator.end) ?? (left == null ? void 0 : left.end);
@@ -17,14 +17,12 @@ function expression(left, operator, right) {
17
17
  if (right === void 0) {
18
18
  right = token(TOKEN_TYPE.VALUE, void 0, { start: op.end });
19
19
  }
20
- const node = {
20
+ return createExpressionNode({
21
21
  left,
22
22
  operator: op,
23
23
  right,
24
24
  ...position
25
- };
26
- const instance = new ExpressionNode(node);
27
- return instance;
25
+ });
28
26
  }
29
27
  export {
30
28
  expression
@@ -1,19 +1,14 @@
1
- import { type Position, TOKEN_TYPE } from "../../types/ast.js";
2
- import type { ConditionNode } from "../classes/ConditionNode.js";
3
- import type { ErrorToken } from "../classes/ErrorToken.js";
4
- import type { ExpressionNode } from "../classes/ExpressionNode.js";
5
- import { GroupNode } from "../classes/GroupNode.js";
6
- import type { ValidToken } from "../classes/ValidToken.js";
1
+ import { type ConditionNode, type ErrorToken, type ExpressionNode, type GroupNode, type Position, TOKEN_TYPE, type ValidToken } from "../../types/ast.js";
7
2
  /**
8
3
  * Creates a group.
9
4
  *
10
5
  * Automatically creates error tokens if missing condition or parens (not prefix because it is optional). Will look at the position of prefix if available.
11
6
  *
12
- * @param paren Use to add parens to group, usually by using @see delim . If either `right` or `left` are false or undefined, error tokens will be created. Unlike @see variable, if undefined is passed for parens, parens are created by default.
7
+ * @param paren Use to add parens to group, usually by using {@link delim} . If either `right` or `left` are false or undefined, error tokens will be created. Unlike {@link variable}, if undefined is passed for parens, parens are created by default.
13
8
  *
14
9
  * The positions of the parens can be adjusted with the last two parameters by passing positions.
15
10
  */
16
- export declare function group(prefix: ConditionNode | ValidToken<TOKEN_TYPE.NOT> | undefined, expression: ConditionNode | ExpressionNode | GroupNode | ErrorToken<TOKEN_TYPE.VALUE> | undefined, paren?: {
11
+ export declare function group(prefix: ConditionNode | ValidToken<TOKEN_TYPE.NOT> | undefined, expression: ConditionNode | ExpressionNode | GroupNode | ErrorToken | undefined, paren?: {
17
12
  left?: boolean;
18
13
  right?: boolean;
19
14
  }, parenLeftPos?: Position, parenRightPos?: Position): GroupNode;
@@ -1 +1 @@
1
- {"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../../src/ast/builders/group.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,QAAQ,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D;;;;;;;;GAQG;AAEH,wBAAgB,KAAK,CACpB,MAAM,EACJ,aAAa,GACb,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,GAC1B,SAAS,EAEX,UAAU,EACR,aAAa,GACb,cAAc,GACd,SAAS,GACT,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,GAC5B,SAAS,EAEX,KAAK,GAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAgC,EACxE,YAAY,CAAC,EAAE,QAAQ,EACvB,aAAa,CAAC,EAAE,QAAQ,GACtB,SAAS,CA2CX"}
1
+ {"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../../src/ast/builders/group.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,KAAK,cAAc,EAAkB,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAGzK;;;;;;;;GAQG;AAEH,wBAAgB,KAAK,CACpB,MAAM,EACJ,aAAa,GACb,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,GAC1B,SAAS,EAEX,UAAU,EACR,aAAa,GACb,cAAc,GACd,SAAS,GACT,UAAU,GACV,SAAS,EAEX,KAAK,GAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAgC,EACxE,YAAY,CAAC,EAAE,QAAQ,EACvB,aAAa,CAAC,EAAE,QAAQ,GACtB,SAAS,CA2CX"}
@@ -1,12 +1,13 @@
1
1
  import { token } from "./token.js";
2
2
  import { TOKEN_TYPE } from "../../types/ast.js";
3
- import { GroupNode } from "../classes/GroupNode.js";
3
+ import { createGroupNode } from "../createGroupNode.js";
4
4
  function group(prefix, expression, paren = { right: true, left: true }, parenLeftPos, parenRightPos) {
5
5
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
6
6
  if (expression === void 0) {
7
7
  expression = token(TOKEN_TYPE.VALUE, void 0, (prefix == null ? void 0 : prefix.end) !== void 0 ? { start: prefix.end } : void 0);
8
8
  }
9
9
  const node = {
10
+ prefix: void 0,
10
11
  expression
11
12
  };
12
13
  if (prefix) {
@@ -39,8 +40,7 @@ function group(prefix, expression, paren = { right: true, left: true }, parenLef
39
40
  }
40
41
  node.start = ((_e = node.prefix) == null ? void 0 : _e.start) ?? ((_g = (_f = node.paren) == null ? void 0 : _f.left) == null ? void 0 : _g.start) ?? ((_h = node.expression) == null ? void 0 : _h.start) ?? ((_i = node.paren) == null ? void 0 : _i.right.start);
41
42
  node.end = ((_k = (_j = node.paren) == null ? void 0 : _j.right) == null ? void 0 : _k.end) ?? ((_l = node.expression) == null ? void 0 : _l.end) ?? ((_m = node.paren) == null ? void 0 : _m.left.end) ?? ((_n = node.prefix) == null ? void 0 : _n.end);
42
- const instance = new GroupNode(node);
43
- return instance;
43
+ return createGroupNode(node);
44
44
  }
45
45
  export {
46
46
  group
@@ -1,5 +1,4 @@
1
- import type { AnyToken, AST_TYPE, EmptyObj, Position, TOKEN_TYPE } from "../../types/ast.js";
2
- import type { Node } from "../classes/Node.js";
1
+ import type { AnyToken, AST_TYPE, EmptyObj, Node, Position, TOKEN_TYPE } from "../../types/ast.js";
3
2
  /**
4
3
  * Can either:
5
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"pos.d.ts","sourceRoot":"","sources":["../../../src/ast/builders/pos.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC5F,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAE9C;;;;;;GAMG;AACH,wBAAgB,GAAG,CAAC,KAAK,SAAS,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,EACxE,IAAI,EAAE,KAAK,EACX,IAAI,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,GAClB,KAAK,SAAS;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GACjD,QAAQ,GACR,QAAQ,CAAA;AACX,wBAAgB,GAAG,CAAC,KAAK,SAAS,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,EACxE,IAAI,EAAE,KAAK,EACX,IAAI,CAAC,EAAE,SAAS,GAAG;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,GAGlC,KAAK,SAAS,QAAQ,GACpB,QAAQ,GACR,KAAK,SAAS,QAAQ,CAAC,UAA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AC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAA"}
@@ -1,12 +1,10 @@
1
- import type { EmptyObj, Position, TOKEN_TYPE } from "../../types/ast.js";
2
- import { ErrorToken } from "../classes/ErrorToken.js";
3
- import { ValidToken } from "../classes/ValidToken.js";
1
+ import type { EmptyObj, ErrorToken, Position, TOKEN_TYPE, ValidToken } from "../../types/ast.js";
4
2
  /**
5
- * Creates a @see ValidToken or of the given type with the given value. If no value is given, creates an @see ErrorToken instead.
3
+ * Creates a {@link ValidToken} or of the given type with the given value. If no value is given, creates an {@link ErrorToken} instead.
6
4
  *
7
5
  * Can be passed multiple types when creating an error token to set the expected field.
8
6
  *
9
7
  * If the token is an error token, just `start` or `end` can be passed, and the other position will be filled to the same value.
10
8
  */
11
- export declare function token<TValue extends string | undefined, TType extends TOKEN_TYPE = TOKEN_TYPE>(type: TValue extends undefined ? TType | TType[] : TType, value: TValue, position?: Position | Partial<Position> | EmptyObj): TValue extends undefined ? ErrorToken<TType> : ValidToken<TType>;
9
+ export declare function token<TValue extends string | undefined, TType extends TOKEN_TYPE = TOKEN_TYPE>(type: TValue extends undefined ? TType | TType[] : TType, value: TValue, position?: Position | Partial<Position> | EmptyObj): TValue extends undefined ? ErrorToken : ValidToken<TType>;
12
10
  //# sourceMappingURL=token.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../src/ast/builders/token.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAY,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAClF,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAGrD;;;;;;GAMG;AAEH,wBAAgB,KAAK,CACpB,MAAM,SAAS,MAAM,GAAG,SAAS,EACjC,KAAK,SAAS,UAAU,GAAG,UAAU,EAErC,IAAI,EAAE,MAAM,SAAS,SAAS,GAAG,KAAK,GAAG,KAAK,EAAE,GAAG,KAAK,EACxD,KAAK,EAAE,MAAM,EACb,QAAQ,GAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAa,GACpD,MAAM,SAAS,SAAS,GACxB,UAAU,CAAC,KAAK,CAAC,GACjB,UAAU,CAAC,KAAK,CAAC,CAmBnB"}
1
+ {"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../src/ast/builders/token.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAY,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAI1G;;;;;;GAMG;AAEH,wBAAgB,KAAK,CACpB,MAAM,SAAS,MAAM,GAAG,SAAS,EACjC,KAAK,SAAS,UAAU,GAAG,UAAU,EAErC,IAAI,EAAE,MAAM,SAAS,SAAS,GAAG,KAAK,GAAG,KAAK,EAAE,GAAG,KAAK,EACxD,KAAK,EAAE,MAAM,EACb,QAAQ,GAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAa,GACpD,MAAM,SAAS,SAAS,GACxB,UAAU,GACV,UAAU,CAAC,KAAK,CAAC,CAmBnB"}
@@ -1,19 +1,18 @@
1
1
  import { isArray } from "@alanscodelog/utils/isArray.js";
2
2
  import { pos } from "./pos.js";
3
- import { ErrorToken } from "../classes/ErrorToken.js";
4
- import { ValidToken } from "../classes/ValidToken.js";
3
+ import { createToken } from "../createToken.js";
5
4
  function token(type, value, position = {}) {
6
5
  position = pos(position, { fill: true });
7
6
  let token2;
8
7
  if (value !== void 0) {
9
- token2 = new ValidToken({
8
+ token2 = createToken({
10
9
  type,
11
10
  value,
12
11
  start: position.start,
13
12
  end: position.end
14
13
  });
15
14
  } else {
16
- token2 = new ErrorToken({
15
+ token2 = createToken({
17
16
  expected: isArray(type) ? type : [type],
18
17
  start: position.start,
19
18
  end: position.end
@@ -1,6 +1,6 @@
1
1
  import { type ExtractTokenType } from "../../types/ast.js";
2
2
  /**
3
- * Given a the string value of an operator or single delimiter token, returns the corresponding @see ValidToken_TYPE .
3
+ * Given a the string value of an operator or single delimiter token, returns the corresponding {@link ValidToken_TYPE} .
4
4
  */
5
5
  export declare function type<T extends string>(operatorSymbol: T): ExtractTokenType<T>;
6
6
  //# sourceMappingURL=type.d.ts.map
@@ -1,10 +1,8 @@
1
- import { type AnyToken, type EmptyObj, type Position, TOKEN_TYPE, type TokenQuoteTypes } from "../../types/ast.js";
2
- import type { ValidToken } from "../classes/ValidToken.js";
3
- import { VariableNode } from "../classes/VariableNode.js";
1
+ import { type AnyToken, type EmptyObj, type Position, TOKEN_TYPE, type TokenQuoteTypes, type ValidToken, type VariableNode } from "../../types/ast.js";
4
2
  /**
5
- * Creates an @see VariableNode .
3
+ * Creates an {@link VariableNode} .
6
4
  *
7
- * @param quote Use to add quotes to the variable, usually by using @see delim . If false or undefined, no quotes are added. Otherwise at least `type` must be passed. If one side is defined but not the other, error tokens will be created with the given type.
5
+ * @param quote Use to add quotes to the variable, usually by using {@link delim} . If false or undefined, no quotes are added. Otherwise at least `type` must be passed. If one side is defined but not the other, error tokens will be created with the given type.
8
6
  *
9
7
  * @param position Refers to position of the value (in case it needs to be created) not the node. Quote positions are automatically calculated from this if used. If value is already a token, there's no need to pass a position, it can be extracted from the token.
10
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"variable.d.ts","sourceRoot":"","sources":["../../../src/ast/builders/variable.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAClH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAGzD;;;;;;GAMG;AAEH,wBAAgB,QAAQ,CACvB,MAAM,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,SAAS,EAChD,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,EAC1C,KAAK,CAAC,EAAE;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EAClF,QAAQ,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAC5B,YAAY,CAyDd"}
1
+ {"version":3,"file":"variable.d.ts","sourceRoot":"","sources":["../../../src/ast/builders/variable.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAkB,KAAK,QAAQ,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAItK;;;;;;GAMG;AAEH,wBAAgB,QAAQ,CACvB,MAAM,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,SAAS,EAChD,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,EAC1C,KAAK,CAAC,EAAE;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EAClF,QAAQ,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAC5B,YAAY,CAwDd"}
@@ -1,7 +1,7 @@
1
1
  import { pos } from "./pos.js";
2
2
  import { token } from "./token.js";
3
3
  import { TOKEN_TYPE } from "../../types/ast.js";
4
- import { VariableNode } from "../classes/VariableNode.js";
4
+ import { createVariableNode } from "../createVariableNode.js";
5
5
  function variable(prefix, value, quote, position) {
6
6
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
7
7
  if (typeof value === "string") {
@@ -40,8 +40,7 @@ function variable(prefix, value, quote, position) {
40
40
  }
41
41
  node.start = ((_b = node.prefix) == null ? void 0 : _b.start) ?? ((_c = node.quote) == null ? void 0 : _c.left.start) ?? ((_d = node.value) == null ? void 0 : _d.start) ?? ((_e = node.quote) == null ? void 0 : _e.right.start);
42
42
  node.end = ((_g = (_f = node.quote) == null ? void 0 : _f.flags) == null ? void 0 : _g.end) ?? ((_h = node.quote) == null ? void 0 : _h.right.end) ?? ((_i = node.value) == null ? void 0 : _i.end) ?? ((_j = node.quote) == null ? void 0 : _j.left.end);
43
- const instance = new VariableNode(node);
44
- return instance;
43
+ return createVariableNode(node);
45
44
  }
46
45
  function quoteFromType(type) {
47
46
  switch (type) {
@@ -0,0 +1,3 @@
1
+ import { type ArrayNode, type RawNode } from "../types/ast.js";
2
+ export declare function createArrayNode<TValid extends boolean = boolean>(raw: RawNode<ArrayNode<TValid>>): ArrayNode<TValid>;
3
+ //# sourceMappingURL=createArrayNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createArrayNode.d.ts","sourceRoot":"","sources":["../../src/ast/createArrayNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAY,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAGxE,wBAAgB,eAAe,CAAC,MAAM,SAAS,OAAO,GAAG,OAAO,EAC/D,GAAG,EAAE,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,GAC7B,SAAS,CAAC,MAAM,CAAC,CAWnB"}
@@ -0,0 +1,12 @@
1
+ import { AST_TYPE } from "../types/ast.js";
2
+ function createArrayNode(raw) {
3
+ return {
4
+ type: AST_TYPE.ARRAY,
5
+ isNode: true,
6
+ valid: raw.values.every((val) => val.valid) && raw.bracket.left.valid && raw.bracket.right.valid,
7
+ ...raw
8
+ };
9
+ }
10
+ export {
11
+ createArrayNode
12
+ };
@@ -0,0 +1,11 @@
1
+ import { type ConditionNode, type TOKEN_TYPE, type ValidToken } from "../types/ast.js";
2
+ export declare function createConditionNode<TValid extends boolean = boolean, TOperator extends ValidToken<TOKEN_TYPE.NOT> | undefined = ValidToken<TOKEN_TYPE.NOT> | undefined>(raw: {
3
+ operator?: TOperator;
4
+ property?: ConditionNode<TValid>["property"];
5
+ propertyOperator?: ConditionNode<TValid>["propertyOperator"];
6
+ sep?: ConditionNode<TValid>["sep"];
7
+ value: ConditionNode<TValid>["value"];
8
+ start: number;
9
+ end: number;
10
+ }): ConditionNode<TValid>;
11
+ //# sourceMappingURL=createConditionNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createConditionNode.d.ts","sourceRoot":"","sources":["../../src/ast/createConditionNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAIhG,wBAAgB,mBAAmB,CAClC,MAAM,SAAS,OAAO,GAAG,OAAO,EAChC,SAAS,SACR,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,SAAS,GACtC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,SAAS,EACtC,GAAG,EAAE;IACN,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,QAAQ,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAA;IAC5C,gBAAgB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,kBAAkB,CAAC,CAAA;IAC5D,GAAG,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAA;IAClC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;IACrC,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;CACX,GACE,aAAa,CAAC,MAAM,CAAC,CAuCvB"}
@@ -0,0 +1,18 @@
1
+ import { AST_TYPE } from "../types/ast.js";
2
+ import { isNode } from "../utils/isNode.js";
3
+ function createConditionNode(raw) {
4
+ var _a, _b, _c, _d, _e;
5
+ const valid = (raw.operator === void 0 || ((_a = raw.operator) == null ? void 0 : _a.valid)) && isNode(raw.value) && raw.value.valid && (raw.property === void 0 && raw.propertyOperator === void 0 && raw.sep === void 0 || raw.property !== void 0 && "type" in raw.property && raw.property.type === AST_TYPE.VARIABLE && (((_b = raw.propertyOperator) == null ? void 0 : _b.valid) === true || ((_d = (_c = raw.sep) == null ? void 0 : _c.left) == null ? void 0 : _d.valid) === true && (raw.sep.right === void 0 || ((_e = raw.sep) == null ? void 0 : _e.right.valid))));
6
+ return {
7
+ property: void 0,
8
+ propertyOperator: void 0,
9
+ sep: void 0,
10
+ ...raw,
11
+ isNode: true,
12
+ type: AST_TYPE.CONDITION,
13
+ valid
14
+ };
15
+ }
16
+ export {
17
+ createConditionNode
18
+ };
@@ -0,0 +1,3 @@
1
+ import { type ExpressionNode, type RawNode } from "../types/ast.js";
2
+ export declare function createExpressionNode<TValid extends boolean = boolean>(raw: RawNode<ExpressionNode<TValid>>): ExpressionNode<TValid>;
3
+ //# sourceMappingURL=createExpressionNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createExpressionNode.d.ts","sourceRoot":"","sources":["../../src/ast/createExpressionNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,cAAc,EAAC,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAI5E,wBAAgB,oBAAoB,CAAC,MAAM,SAAS,OAAO,GAAG,OAAO,EACpE,GAAG,EAAE,OAAO,CAAE,cAAc,CAAC,MAAM,CAAC,CAAC,GACnC,cAAc,CAAC,MAAM,CAAC,CAcxB"}
@@ -0,0 +1,14 @@
1
+ import { AST_TYPE } from "../types/ast.js";
2
+ import { isNode } from "../utils/isNode.js";
3
+ function createExpressionNode(raw) {
4
+ const valid = raw.operator.valid && isNode(raw.left) && raw.left.valid && isNode(raw.right) && raw.right.valid;
5
+ return {
6
+ ...raw,
7
+ isNode: true,
8
+ valid,
9
+ type: AST_TYPE.EXPRESSION
10
+ };
11
+ }
12
+ export {
13
+ createExpressionNode
14
+ };
@@ -0,0 +1,5 @@
1
+ import { type ConditionNode, type GroupNode, type RawNode, type TOKEN_TYPE, type ValidToken } from "../types/ast.js";
2
+ export declare function createGroupNode<TValid extends boolean = boolean, TPrefixable extends boolean = true, TPrefix extends TPrefixable extends true ? ConditionNode<TValid> | ValidToken<TOKEN_TYPE.NOT> | undefined : ValidToken<TOKEN_TYPE.NOT> | undefined = TPrefixable extends true ? ConditionNode<TValid> | ValidToken<TOKEN_TYPE.NOT> | undefined : ValidToken<TOKEN_TYPE.NOT>>(raw: {
3
+ prefix: TPrefix;
4
+ } & RawNode<GroupNode<TValid>>): GroupNode<TValid, TPrefixable, TPrefix>;
5
+ //# sourceMappingURL=createGroupNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createGroupNode.d.ts","sourceRoot":"","sources":["../../src/ast/createGroupNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAK9H,wBAAgB,eAAe,CAC9B,MAAM,SAAS,OAAO,GAAG,OAAO,EAChC,WAAW,SAAS,OAAO,GAAG,IAAI,EAClC,OAAO,SACN,WAAW,SAAS,IAAI,GACrB,aAAa,CAAC,MAAM,CAAC,GACvB,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,GAC1B,SAAS,GACP,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,GAC5B,SAAS,GACV,WAAW,SAAS,IAAI,GACrB,aAAa,CAAC,MAAM,CAAC,GACvB,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,GAC1B,SAAS,GACP,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,EAC7B,GAAG,EAAE;IACN,MAAM,EAAE,OAAO,CAAA;CACf,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,CAsBvE"}
@@ -0,0 +1,14 @@
1
+ import { AST_TYPE } from "../types/ast.js";
2
+ import { isNode } from "../utils/isNode.js";
3
+ import { isToken } from "../utils/isToken.js";
4
+ function createGroupNode(raw) {
5
+ return {
6
+ ...raw,
7
+ isNode: true,
8
+ valid: (raw.prefix === void 0 || isToken(raw.prefix) && raw.prefix.valid || isNode(raw.prefix) && raw.prefix.valid) && isNode(raw.expression) && raw.expression.valid && (raw.paren === void 0 || raw.paren.left.valid && raw.paren.right.valid),
9
+ type: AST_TYPE.GROUP
10
+ };
11
+ }
12
+ export {
13
+ createGroupNode
14
+ };
@@ -0,0 +1,3 @@
1
+ import { type NormalizedCondition } from "../types/ast.js";
2
+ export declare function createCondition<TOp extends string = string, TValue = any>(raw: Omit<NormalizedCondition<TOp, TValue>, "type">): NormalizedCondition<TOp, TValue>;
3
+ //# sourceMappingURL=createNormalizedCondition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createNormalizedCondition.d.ts","sourceRoot":"","sources":["../../src/ast/createNormalizedCondition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAGpE,wBAAgB,eAAe,CAC9B,GAAG,SAAS,MAAM,GAAG,MAAM,EAC3B,MAAM,GAAG,GAAG,EACX,GAAG,EAAE,IAAI,CAAC,mBAAmB,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,GAAG,mBAAmB,CAAC,GAAG,EAAE,MAAM,CAAC,CAKvF"}
@@ -0,0 +1,10 @@
1
+ import { AST_TYPE } from "../types/ast.js";
2
+ function createCondition(raw) {
3
+ return {
4
+ ...raw,
5
+ type: AST_TYPE.NORMALIZED_CONDITION
6
+ };
7
+ }
8
+ export {
9
+ createCondition
10
+ };
@@ -0,0 +1,3 @@
1
+ import { type NormalizedExpression } from "../types/ast.js";
2
+ export declare function createExpression<TType extends string = string, TValue = any>(raw: Omit<NormalizedExpression<TType, TValue>, "type">): NormalizedExpression<TType, TValue>;
3
+ //# sourceMappingURL=createNormalizedExpression.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createNormalizedExpression.d.ts","sourceRoot":"","sources":["../../src/ast/createNormalizedExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAGrE,wBAAgB,gBAAgB,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,MAAM,GAAG,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,GAAG,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,CAKzK"}
@@ -0,0 +1,10 @@
1
+ import { AST_TYPE } from "../types/ast.js";
2
+ function createExpression(raw) {
3
+ return {
4
+ ...raw,
5
+ type: AST_TYPE.NORMALIZED_EXPRESSION
6
+ };
7
+ }
8
+ export {
9
+ createExpression
10
+ };
@@ -0,0 +1,6 @@
1
+ import type { ErrorToken, RawToken, TOKEN_TYPE, ValidToken } from "../types/ast.js";
2
+ export declare function createToken<TType extends TOKEN_TYPE>(raw: {
3
+ type: TType;
4
+ } & RawToken<ValidToken>): ValidToken<TType>;
5
+ export declare function createToken(raw: RawToken<ErrorToken>): ErrorToken;
6
+ //# sourceMappingURL=createToken.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createToken.d.ts","sourceRoot":"","sources":["../../src/ast/createToken.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAGnF,wBAAgB,WAAW,CAC1B,KAAK,SAAS,UAAU,EACvB,GAAG,EAAE;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CAAA;AACjE,wBAAgB,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,UAAU,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { ExpressitError } from "../internal/ExpressitError.js";
2
+ import { ERROR_CODES } from "../types/errors.js";
3
+ function createToken(raw) {
4
+ if (raw.start === void 0 || raw.end === void 0) {
5
+ throw new ExpressitError(ERROR_CODES.PARSER_POSITION_ERROR, raw);
6
+ }
7
+ return {
8
+ ...raw,
9
+ valid: typeof raw.expected === "undefined",
10
+ isToken: true
11
+ };
12
+ }
13
+ export {
14
+ createToken
15
+ };
@@ -0,0 +1,3 @@
1
+ import { type RawNode, type VariableNode } from "../types/ast.js";
2
+ export declare function createVariableNode<TValid extends boolean = boolean>(raw: RawNode<VariableNode<TValid>>): VariableNode<TValid>;
3
+ //# sourceMappingURL=createVariableNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createVariableNode.d.ts","sourceRoot":"","sources":["../../src/ast/createVariableNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE3E,wBAAgB,kBAAkB,CAClC,MAAM,SAAS,OAAO,GAAG,OAAO,EAC9B,GAAG,EAAE,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,GAAG,YAAY,CAAC,MAAM,CAAC,CAa1D"}
@@ -0,0 +1,12 @@
1
+ import { AST_TYPE } from "../types/ast.js";
2
+ function createVariableNode(raw) {
3
+ return {
4
+ ...raw,
5
+ isNode: true,
6
+ valid: raw.value.valid && (raw.quote === void 0 || raw.quote.left.valid && raw.quote.right.valid),
7
+ type: AST_TYPE.VARIABLE
8
+ };
9
+ }
10
+ export {
11
+ createVariableNode
12
+ };
@@ -0,0 +1,3 @@
1
+ import { type ErrorToken, type TOKEN_TYPE } from "../types/ast.js";
2
+ export declare function error<T extends TOKEN_TYPE>(pos: number, expected: T[]): ErrorToken;
3
+ //# sourceMappingURL=error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/ast/error.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,UAAU,EAAC,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjE,wBAAgB,KAAK,CAAC,CAAC,SAAS,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,UAAU,CAGlF"}
@@ -0,0 +1,9 @@
1
+ import { createToken } from "./createToken.js";
2
+ function error(pos, expected) {
3
+ if (pos === void 0)
4
+ throw new Error("should never happen, passed undefined position for error token");
5
+ return createToken({ expected, start: pos, end: pos });
6
+ }
7
+ export {
8
+ error
9
+ };
@@ -1,16 +1,9 @@
1
- import { ArrayNode } from "./classes/ArrayNode.js";
2
- import { ConditionNode } from "./classes/ConditionNode.js";
3
- import { ErrorToken } from "./classes/ErrorToken.js";
4
- import { ExpressionNode } from "./classes/ExpressionNode.js";
5
- import { GroupNode } from "./classes/GroupNode.js";
6
- import { ValidToken } from "./classes/ValidToken.js";
7
- import { VariableNode } from "./classes/VariableNode.js";
8
- import { type AnyToken, type Position, TOKEN_TYPE, type TokenBooleanTypes, type TokenQuoteTypes } from "../types/ast.js";
9
- declare function error<T extends TOKEN_TYPE>(pos: number, expected: T[]): ErrorToken<T>;
1
+ import { type AnyToken, type ArrayNode, type ConditionNode, type ErrorToken, type ExpressionNode, type GroupNode, type Position, TOKEN_TYPE, type TokenBooleanTypes, type TokenQuoteTypes, type ValidToken, type VariableNode } from "../types/ast.js";
2
+ declare function error<T extends TOKEN_TYPE>(pos: number, expected: T[]): ErrorToken;
10
3
  export declare const token: {
11
- value: <TVal extends string | undefined>(value: TVal, pos: Position) => TVal extends string ? ValidToken<TOKEN_TYPE.VALUE> : ErrorToken<TOKEN_TYPE.VALUE>;
12
- custom: <TVal_1 extends string | undefined>(value: TVal_1, pos: Position) => TVal_1 extends string ? ValidToken<TOKEN_TYPE.OP_CUSTOM> : ErrorToken<TOKEN_TYPE.OP_CUSTOM>;
13
- sep: <TVal_2 extends string | undefined>(value: TVal_2, pos: Position) => TVal_2 extends string ? ValidToken<TOKEN_TYPE.OP_EXPANDED_SEP> : ErrorToken<TOKEN_TYPE.OP_EXPANDED_SEP>;
4
+ value: <TVal extends string | undefined>(value: TVal, pos: Position) => TVal extends string ? ValidToken<TOKEN_TYPE.VALUE> : ErrorToken;
5
+ custom: <TVal_1 extends string | undefined>(value: TVal_1, pos: Position) => TVal_1 extends string ? ValidToken<TOKEN_TYPE.OP_CUSTOM> : ErrorToken;
6
+ sep: <TVal_2 extends string | undefined>(value: TVal_2, pos: Position) => TVal_2 extends string ? ValidToken<TOKEN_TYPE.OP_EXPANDED_SEP> : ErrorToken;
14
7
  };
15
8
  /** We want to handle all the types outside the grammar file. This makes it easier without trying to check the value. */
16
9
  export declare const delimiter: {
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/ast/handlers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAExD,OAAO,EAAE,KAAK,QAAQ,EAA8B,KAAK,QAAQ,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAqD,KAAK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