desmost 0.1.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 (281) hide show
  1. package/dist/compiler/compile.d.ts +32 -0
  2. package/dist/compiler/compile.d.ts.map +1 -0
  3. package/dist/compiler/compile.js +101 -0
  4. package/dist/compiler/compile.js.map +1 -0
  5. package/dist/compiler/evaluate.d.ts +18 -0
  6. package/dist/compiler/evaluate.d.ts.map +1 -0
  7. package/dist/compiler/evaluate.js +83 -0
  8. package/dist/compiler/evaluate.js.map +1 -0
  9. package/dist/compiler/index.d.ts +3 -0
  10. package/dist/compiler/index.d.ts.map +1 -0
  11. package/dist/compiler/index.js +2 -0
  12. package/dist/compiler/index.js.map +1 -0
  13. package/dist/compiler/options.d.ts +54 -0
  14. package/dist/compiler/options.d.ts.map +1 -0
  15. package/dist/compiler/options.js +15 -0
  16. package/dist/compiler/options.js.map +1 -0
  17. package/dist/desmos.d.ts +12 -0
  18. package/dist/desmos.d.ts.map +1 -0
  19. package/dist/desmos.js +13 -0
  20. package/dist/desmos.js.map +1 -0
  21. package/dist/errors.d.ts +45 -0
  22. package/dist/errors.d.ts.map +1 -0
  23. package/dist/errors.js +38 -0
  24. package/dist/errors.js.map +1 -0
  25. package/dist/index.d.ts +2 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +2 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/magic/expr/index.d.ts +3 -0
  30. package/dist/magic/expr/index.d.ts.map +1 -0
  31. package/dist/magic/expr/index.js +8 -0
  32. package/dist/magic/expr/index.js.map +1 -0
  33. package/dist/magic/expr/latex.d.ts +10 -0
  34. package/dist/magic/expr/latex.d.ts.map +1 -0
  35. package/dist/magic/expr/latex.js +16 -0
  36. package/dist/magic/expr/latex.js.map +1 -0
  37. package/dist/magic/expr/text.d.ts +9 -0
  38. package/dist/magic/expr/text.d.ts.map +1 -0
  39. package/dist/magic/expr/text.js +13 -0
  40. package/dist/magic/expr/text.js.map +1 -0
  41. package/dist/magic/global/dark-mode.d.ts +7 -0
  42. package/dist/magic/global/dark-mode.d.ts.map +1 -0
  43. package/dist/magic/global/dark-mode.js +11 -0
  44. package/dist/magic/global/dark-mode.js.map +1 -0
  45. package/dist/magic/global/desmos.d.ts +9 -0
  46. package/dist/magic/global/desmos.d.ts.map +1 -0
  47. package/dist/magic/global/desmos.js +11 -0
  48. package/dist/magic/global/desmos.js.map +1 -0
  49. package/dist/magic/global/index.d.ts +3 -0
  50. package/dist/magic/global/index.d.ts.map +1 -0
  51. package/dist/magic/global/index.js +10 -0
  52. package/dist/magic/global/index.js.map +1 -0
  53. package/dist/magic/global/viewport.d.ts +16 -0
  54. package/dist/magic/global/viewport.d.ts.map +1 -0
  55. package/dist/magic/global/viewport.js +12 -0
  56. package/dist/magic/global/viewport.js.map +1 -0
  57. package/dist/magic/incantation.d.ts +74 -0
  58. package/dist/magic/incantation.d.ts.map +1 -0
  59. package/dist/magic/incantation.js +81 -0
  60. package/dist/magic/incantation.js.map +1 -0
  61. package/dist/magic/index.d.ts +6 -0
  62. package/dist/magic/index.d.ts.map +1 -0
  63. package/dist/magic/index.js +5 -0
  64. package/dist/magic/index.js.map +1 -0
  65. package/dist/magic/local/anim.d.ts +7 -0
  66. package/dist/magic/local/anim.d.ts.map +1 -0
  67. package/dist/magic/local/anim.js +11 -0
  68. package/dist/magic/local/anim.js.map +1 -0
  69. package/dist/magic/local/colour.d.ts +12 -0
  70. package/dist/magic/local/colour.d.ts.map +1 -0
  71. package/dist/magic/local/colour.js +27 -0
  72. package/dist/magic/local/colour.js.map +1 -0
  73. package/dist/magic/local/dashed.d.ts +7 -0
  74. package/dist/magic/local/dashed.d.ts.map +1 -0
  75. package/dist/magic/local/dashed.js +10 -0
  76. package/dist/magic/local/dashed.js.map +1 -0
  77. package/dist/magic/local/fill.d.ts +13 -0
  78. package/dist/magic/local/fill.d.ts.map +1 -0
  79. package/dist/magic/local/fill.js +12 -0
  80. package/dist/magic/local/fill.js.map +1 -0
  81. package/dist/magic/local/hide.d.ts +7 -0
  82. package/dist/magic/local/hide.d.ts.map +1 -0
  83. package/dist/magic/local/hide.js +10 -0
  84. package/dist/magic/local/hide.js.map +1 -0
  85. package/dist/magic/local/index.d.ts +3 -0
  86. package/dist/magic/local/index.d.ts.map +1 -0
  87. package/dist/magic/local/index.js +24 -0
  88. package/dist/magic/local/index.js.map +1 -0
  89. package/dist/magic/local/line.d.ts +15 -0
  90. package/dist/magic/local/line.d.ts.map +1 -0
  91. package/dist/magic/local/line.js +17 -0
  92. package/dist/magic/local/line.js.map +1 -0
  93. package/dist/magic/local/no-line.d.ts +7 -0
  94. package/dist/magic/local/no-line.d.ts.map +1 -0
  95. package/dist/magic/local/no-line.js +10 -0
  96. package/dist/magic/local/no-line.js.map +1 -0
  97. package/dist/magic/local/point.d.ts +15 -0
  98. package/dist/magic/local/point.d.ts.map +1 -0
  99. package/dist/magic/local/point.js +17 -0
  100. package/dist/magic/local/point.js.map +1 -0
  101. package/dist/magic/local/secret.d.ts +7 -0
  102. package/dist/magic/local/secret.d.ts.map +1 -0
  103. package/dist/magic/local/secret.js +10 -0
  104. package/dist/magic/local/secret.js.map +1 -0
  105. package/dist/magic/local/slider.d.ts +15 -0
  106. package/dist/magic/local/slider.d.ts.map +1 -0
  107. package/dist/magic/local/slider.js +13 -0
  108. package/dist/magic/local/slider.js.map +1 -0
  109. package/dist/parser/ast.d.ts +40 -0
  110. package/dist/parser/ast.d.ts.map +1 -0
  111. package/dist/parser/ast.js +13 -0
  112. package/dist/parser/ast.js.map +1 -0
  113. package/dist/parser/desmost-parser.d.ts +105 -0
  114. package/dist/parser/desmost-parser.d.ts.map +1 -0
  115. package/dist/parser/desmost-parser.js +379 -0
  116. package/dist/parser/desmost-parser.js.map +1 -0
  117. package/dist/parser/generic-parser.d.ts +62 -0
  118. package/dist/parser/generic-parser.d.ts.map +1 -0
  119. package/dist/parser/generic-parser.js +143 -0
  120. package/dist/parser/generic-parser.js.map +1 -0
  121. package/dist/parser/index.d.ts +8 -0
  122. package/dist/parser/index.d.ts.map +1 -0
  123. package/dist/parser/index.js +8 -0
  124. package/dist/parser/index.js.map +1 -0
  125. package/dist/src/compiler/compile.d.ts +32 -0
  126. package/dist/src/compiler/compile.d.ts.map +1 -0
  127. package/dist/src/compiler/compile.js +101 -0
  128. package/dist/src/compiler/compile.js.map +1 -0
  129. package/dist/src/compiler/evaluate.d.ts +18 -0
  130. package/dist/src/compiler/evaluate.d.ts.map +1 -0
  131. package/dist/src/compiler/evaluate.js +83 -0
  132. package/dist/src/compiler/evaluate.js.map +1 -0
  133. package/dist/src/compiler/index.d.ts +3 -0
  134. package/dist/src/compiler/index.d.ts.map +1 -0
  135. package/dist/src/compiler/index.js +2 -0
  136. package/dist/src/compiler/index.js.map +1 -0
  137. package/dist/src/compiler/options.d.ts +54 -0
  138. package/dist/src/compiler/options.d.ts.map +1 -0
  139. package/dist/src/compiler/options.js +15 -0
  140. package/dist/src/compiler/options.js.map +1 -0
  141. package/dist/src/desmos.d.ts +12 -0
  142. package/dist/src/desmos.d.ts.map +1 -0
  143. package/dist/src/desmos.js +13 -0
  144. package/dist/src/desmos.js.map +1 -0
  145. package/dist/src/errors.d.ts +45 -0
  146. package/dist/src/errors.d.ts.map +1 -0
  147. package/dist/src/errors.js +38 -0
  148. package/dist/src/errors.js.map +1 -0
  149. package/dist/src/index.d.ts +2 -0
  150. package/dist/src/index.d.ts.map +1 -0
  151. package/dist/src/index.js +2 -0
  152. package/dist/src/index.js.map +1 -0
  153. package/dist/src/magic/expr/index.d.ts +3 -0
  154. package/dist/src/magic/expr/index.d.ts.map +1 -0
  155. package/dist/src/magic/expr/index.js +8 -0
  156. package/dist/src/magic/expr/index.js.map +1 -0
  157. package/dist/src/magic/expr/latex.d.ts +10 -0
  158. package/dist/src/magic/expr/latex.d.ts.map +1 -0
  159. package/dist/src/magic/expr/latex.js +16 -0
  160. package/dist/src/magic/expr/latex.js.map +1 -0
  161. package/dist/src/magic/expr/text.d.ts +9 -0
  162. package/dist/src/magic/expr/text.d.ts.map +1 -0
  163. package/dist/src/magic/expr/text.js +13 -0
  164. package/dist/src/magic/expr/text.js.map +1 -0
  165. package/dist/src/magic/global/dark-mode.d.ts +7 -0
  166. package/dist/src/magic/global/dark-mode.d.ts.map +1 -0
  167. package/dist/src/magic/global/dark-mode.js +11 -0
  168. package/dist/src/magic/global/dark-mode.js.map +1 -0
  169. package/dist/src/magic/global/desmos.d.ts +9 -0
  170. package/dist/src/magic/global/desmos.d.ts.map +1 -0
  171. package/dist/src/magic/global/desmos.js +11 -0
  172. package/dist/src/magic/global/desmos.js.map +1 -0
  173. package/dist/src/magic/global/index.d.ts +3 -0
  174. package/dist/src/magic/global/index.d.ts.map +1 -0
  175. package/dist/src/magic/global/index.js +10 -0
  176. package/dist/src/magic/global/index.js.map +1 -0
  177. package/dist/src/magic/global/viewport.d.ts +16 -0
  178. package/dist/src/magic/global/viewport.d.ts.map +1 -0
  179. package/dist/src/magic/global/viewport.js +12 -0
  180. package/dist/src/magic/global/viewport.js.map +1 -0
  181. package/dist/src/magic/incantation.d.ts +74 -0
  182. package/dist/src/magic/incantation.d.ts.map +1 -0
  183. package/dist/src/magic/incantation.js +81 -0
  184. package/dist/src/magic/incantation.js.map +1 -0
  185. package/dist/src/magic/index.d.ts +6 -0
  186. package/dist/src/magic/index.d.ts.map +1 -0
  187. package/dist/src/magic/index.js +5 -0
  188. package/dist/src/magic/index.js.map +1 -0
  189. package/dist/src/magic/local/anim.d.ts +7 -0
  190. package/dist/src/magic/local/anim.d.ts.map +1 -0
  191. package/dist/src/magic/local/anim.js +11 -0
  192. package/dist/src/magic/local/anim.js.map +1 -0
  193. package/dist/src/magic/local/colour.d.ts +12 -0
  194. package/dist/src/magic/local/colour.d.ts.map +1 -0
  195. package/dist/src/magic/local/colour.js +27 -0
  196. package/dist/src/magic/local/colour.js.map +1 -0
  197. package/dist/src/magic/local/dashed.d.ts +7 -0
  198. package/dist/src/magic/local/dashed.d.ts.map +1 -0
  199. package/dist/src/magic/local/dashed.js +10 -0
  200. package/dist/src/magic/local/dashed.js.map +1 -0
  201. package/dist/src/magic/local/fill.d.ts +13 -0
  202. package/dist/src/magic/local/fill.d.ts.map +1 -0
  203. package/dist/src/magic/local/fill.js +12 -0
  204. package/dist/src/magic/local/fill.js.map +1 -0
  205. package/dist/src/magic/local/hide.d.ts +7 -0
  206. package/dist/src/magic/local/hide.d.ts.map +1 -0
  207. package/dist/src/magic/local/hide.js +10 -0
  208. package/dist/src/magic/local/hide.js.map +1 -0
  209. package/dist/src/magic/local/index.d.ts +3 -0
  210. package/dist/src/magic/local/index.d.ts.map +1 -0
  211. package/dist/src/magic/local/index.js +24 -0
  212. package/dist/src/magic/local/index.js.map +1 -0
  213. package/dist/src/magic/local/line.d.ts +15 -0
  214. package/dist/src/magic/local/line.d.ts.map +1 -0
  215. package/dist/src/magic/local/line.js +17 -0
  216. package/dist/src/magic/local/line.js.map +1 -0
  217. package/dist/src/magic/local/no-line.d.ts +7 -0
  218. package/dist/src/magic/local/no-line.d.ts.map +1 -0
  219. package/dist/src/magic/local/no-line.js +10 -0
  220. package/dist/src/magic/local/no-line.js.map +1 -0
  221. package/dist/src/magic/local/point.d.ts +15 -0
  222. package/dist/src/magic/local/point.d.ts.map +1 -0
  223. package/dist/src/magic/local/point.js +17 -0
  224. package/dist/src/magic/local/point.js.map +1 -0
  225. package/dist/src/magic/local/secret.d.ts +7 -0
  226. package/dist/src/magic/local/secret.d.ts.map +1 -0
  227. package/dist/src/magic/local/secret.js +10 -0
  228. package/dist/src/magic/local/secret.js.map +1 -0
  229. package/dist/src/magic/local/slider.d.ts +15 -0
  230. package/dist/src/magic/local/slider.d.ts.map +1 -0
  231. package/dist/src/magic/local/slider.js +13 -0
  232. package/dist/src/magic/local/slider.js.map +1 -0
  233. package/dist/src/parser/ast.d.ts +40 -0
  234. package/dist/src/parser/ast.d.ts.map +1 -0
  235. package/dist/src/parser/ast.js +13 -0
  236. package/dist/src/parser/ast.js.map +1 -0
  237. package/dist/src/parser/desmost-parser.d.ts +105 -0
  238. package/dist/src/parser/desmost-parser.d.ts.map +1 -0
  239. package/dist/src/parser/desmost-parser.js +379 -0
  240. package/dist/src/parser/desmost-parser.js.map +1 -0
  241. package/dist/src/parser/generic-parser.d.ts +62 -0
  242. package/dist/src/parser/generic-parser.d.ts.map +1 -0
  243. package/dist/src/parser/generic-parser.js +143 -0
  244. package/dist/src/parser/generic-parser.js.map +1 -0
  245. package/dist/src/parser/index.d.ts +8 -0
  246. package/dist/src/parser/index.d.ts.map +1 -0
  247. package/dist/src/parser/index.js +8 -0
  248. package/dist/src/parser/index.js.map +1 -0
  249. package/package.json +58 -0
  250. package/src/compiler/compile.ts +127 -0
  251. package/src/compiler/evaluate.ts +121 -0
  252. package/src/compiler/index.ts +2 -0
  253. package/src/compiler/options.ts +77 -0
  254. package/src/desmos.ts +13 -0
  255. package/src/errors.ts +46 -0
  256. package/src/index.ts +1 -0
  257. package/src/magic/.template.ts +22 -0
  258. package/src/magic/expr/index.ts +11 -0
  259. package/src/magic/expr/latex.ts +24 -0
  260. package/src/magic/expr/text.ts +19 -0
  261. package/src/magic/global/dark-mode.ts +17 -0
  262. package/src/magic/global/desmos.ts +20 -0
  263. package/src/magic/global/index.ts +13 -0
  264. package/src/magic/global/viewport.ts +25 -0
  265. package/src/magic/incantation.ts +142 -0
  266. package/src/magic/index.ts +6 -0
  267. package/src/magic/local/anim.ts +17 -0
  268. package/src/magic/local/colour.ts +38 -0
  269. package/src/magic/local/dashed.ts +16 -0
  270. package/src/magic/local/fill.ts +24 -0
  271. package/src/magic/local/hide.ts +16 -0
  272. package/src/magic/local/index.ts +27 -0
  273. package/src/magic/local/line.ts +29 -0
  274. package/src/magic/local/no-line.ts +16 -0
  275. package/src/magic/local/point.ts +29 -0
  276. package/src/magic/local/secret.ts +16 -0
  277. package/src/magic/local/slider.ts +27 -0
  278. package/src/parser/ast.ts +60 -0
  279. package/src/parser/desmost-parser.ts +486 -0
  280. package/src/parser/generic-parser.ts +191 -0
  281. package/src/parser/index.ts +8 -0
@@ -0,0 +1,10 @@
1
+ import { Incantation } from "../incantation";
2
+ export class DashedIncantation extends Incantation {
3
+ description = "Render a block as a dashed line.";
4
+ identifier = "dashed";
5
+ apply(target) {
6
+ super.require_expr_type(target.type, "expression");
7
+ target.lineStyle = Desmos.Styles.DASHED;
8
+ }
9
+ }
10
+ //# sourceMappingURL=dashed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dashed.js","sourceRoot":"","sources":["../../../../src/magic/local/dashed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAc,MAAM,gBAAgB,CAAC;AAGzD,MAAM,OAAO,iBAAkB,SAAQ,WAAkB;IAErC,WAAW,GACzB,kCAAkC,CAAA;IAEpB,UAAU,GAAG,QAAQ,CAAA;IAE9B,KAAK,CAAC,MAA8B;QAE3C,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QACnD,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;IAC1C,CAAC;CACF"}
@@ -0,0 +1,13 @@
1
+ import { Incantation, ArgIncantation, type LOCAL } from "../incantation";
2
+ interface FillOptions {
3
+ opacity: number;
4
+ }
5
+ export declare class FillIncantation extends ArgIncantation<LOCAL> {
6
+ readonly description = "Change fill styles for a rendered block.";
7
+ readonly identifier = "fill";
8
+ readonly requires_arg = true;
9
+ readonly arg_type = Incantation.ArgType.OBJECT;
10
+ apply(target: Desmos.ExpressionState, data: FillOptions): void;
11
+ }
12
+ export {};
13
+ //# sourceMappingURL=fill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fill.d.ts","sourceRoot":"","sources":["../../../../src/magic/local/fill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGzE,UAAU,WAAW;IAEnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAGD,qBAAa,eAAgB,SAAQ,cAAc,CAAC,KAAK,CAAC;IAExD,SAAkB,WAAW,8CACiB;IAE9C,SAAkB,UAAU,UAAW;IACvC,SAAkB,YAAY,QAAO;IACrC,SAAkB,QAAQ,8BAAiC;IAElD,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,IAAI,EAAE,WAAW,QAI/D;CACF"}
@@ -0,0 +1,12 @@
1
+ import { Incantation, ArgIncantation } from "../incantation";
2
+ export class FillIncantation extends ArgIncantation {
3
+ description = "Change fill styles for a rendered block.";
4
+ identifier = "fill";
5
+ requires_arg = true;
6
+ arg_type = Incantation.ArgType.OBJECT;
7
+ apply(target, data) {
8
+ super.require_expr_type(target.type, "expression");
9
+ target.fillOpacity = data.opacity;
10
+ }
11
+ }
12
+ //# sourceMappingURL=fill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fill.js","sourceRoot":"","sources":["../../../../src/magic/local/fill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAc,MAAM,gBAAgB,CAAC;AASzE,MAAM,OAAO,eAAgB,SAAQ,cAAqB;IAEtC,WAAW,GACzB,0CAA0C,CAAA;IAE5B,UAAU,GAAK,MAAM,CAAA;IACrB,YAAY,GAAG,IAAI,CAAA;IACnB,QAAQ,GAAO,WAAW,CAAC,OAAO,CAAC,MAAM,CAAA;IAElD,KAAK,CAAC,MAA8B,EAAE,IAAiB;QAE9D,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QACnD,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC;IACpC,CAAC;CACF"}
@@ -0,0 +1,7 @@
1
+ import { Incantation, type LOCAL } from "../incantation";
2
+ export declare class HideIncantation extends Incantation<LOCAL> {
3
+ readonly description = "Hide rendering for a block. This includes graphs, points, polygons, etc.";
4
+ readonly identifier = "hide";
5
+ apply(target: Desmos.ExpressionState): void;
6
+ }
7
+ //# sourceMappingURL=hide.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hide.d.ts","sourceRoot":"","sources":["../../../../src/magic/local/hide.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGzD,qBAAa,eAAgB,SAAQ,WAAW,CAAC,KAAK,CAAC;IAErD,SAAkB,WAAW,8EACiD;IAE9E,SAAkB,UAAU,UAAS;IAErC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,QAInC;CACF"}
@@ -0,0 +1,10 @@
1
+ import { Incantation } from "../incantation";
2
+ export class HideIncantation extends Incantation {
3
+ description = "Hide rendering for a block. This includes graphs, points, polygons, etc.";
4
+ identifier = "hide";
5
+ apply(target) {
6
+ super.require_expr_type(target.type, "expression");
7
+ target.hidden = true;
8
+ }
9
+ }
10
+ //# sourceMappingURL=hide.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hide.js","sourceRoot":"","sources":["../../../../src/magic/local/hide.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAc,MAAM,gBAAgB,CAAC;AAGzD,MAAM,OAAO,eAAgB,SAAQ,WAAkB;IAEnC,WAAW,GACzB,0EAA0E,CAAA;IAE5D,UAAU,GAAG,MAAM,CAAA;IAErC,KAAK,CAAC,MAA8B;QAElC,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QACnD,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC;IACvB,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ import { Incantation, type LOCAL } from "../incantation";
2
+ export declare const LOCAL_INCANTATIONS: Incantation<LOCAL>[];
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/magic/local/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAczD,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,KAAK,CAAC,EAYlD,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { Incantation } from "../incantation";
2
+ import { AnimIncantation } from "./anim";
3
+ import { ColourIncantation } from "./colour";
4
+ import { DashedIncantation } from "./dashed";
5
+ import { FillIncantation } from "./fill";
6
+ import { HideIncantation } from "./hide";
7
+ import { LineIncantation } from "./line";
8
+ import { NoLineIncantation } from "./no-line";
9
+ import { PointIncantation } from "./point";
10
+ import { SecretIncantation } from "./secret";
11
+ import { SliderIncantation } from "./slider";
12
+ export const LOCAL_INCANTATIONS = [
13
+ new AnimIncantation(),
14
+ new ColourIncantation(),
15
+ new DashedIncantation(),
16
+ new FillIncantation(),
17
+ new HideIncantation(),
18
+ new LineIncantation(),
19
+ new NoLineIncantation(),
20
+ new PointIncantation(),
21
+ new SecretIncantation(),
22
+ new SliderIncantation(),
23
+ ];
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/magic/local/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAc,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAG7C,MAAM,CAAC,MAAM,kBAAkB,GAC/B;IACE,IAAI,eAAe,EAAE;IACrB,IAAI,iBAAiB,EAAE;IACvB,IAAI,iBAAiB,EAAE;IACvB,IAAI,eAAe,EAAE;IACrB,IAAI,eAAe,EAAE;IACrB,IAAI,eAAe,EAAE;IACrB,IAAI,iBAAiB,EAAE;IACvB,IAAI,gBAAgB,EAAE;IACtB,IAAI,iBAAiB,EAAE;IACvB,IAAI,iBAAiB,EAAE;CACxB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { Incantation, ArgIncantation, type LOCAL } from "../incantation";
2
+ interface LineOptions {
3
+ style?: keyof typeof Desmos.Styles;
4
+ width?: number;
5
+ opacity?: number;
6
+ }
7
+ export declare class LineIncantation extends ArgIncantation<LOCAL> {
8
+ readonly description = "Change line styles for a rendered block.";
9
+ readonly identifier = "line";
10
+ readonly requires_arg = true;
11
+ readonly arg_type = Incantation.ArgType.OBJECT;
12
+ apply(target: Desmos.ExpressionState, data: LineOptions): void;
13
+ }
14
+ export {};
15
+ //# sourceMappingURL=line.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../../../src/magic/local/line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGzE,UAAU,WAAW;IAEnB,KAAK,CAAC,EAAI,MAAM,OAAO,MAAM,CAAC,MAAM,CAAC;IACrC,KAAK,CAAC,EAAI,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAGD,qBAAa,eAAgB,SAAQ,cAAc,CAAC,KAAK,CAAC;IAExD,SAAkB,WAAW,8CACiB;IAE9C,SAAkB,UAAU,UAAW;IACvC,SAAkB,YAAY,QAAO;IACrC,SAAkB,QAAQ,8BAAiC;IAElD,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,IAAI,EAAE,WAAW,QAO/D;CACF"}
@@ -0,0 +1,17 @@
1
+ import { Incantation, ArgIncantation } from "../incantation";
2
+ export class LineIncantation extends ArgIncantation {
3
+ description = "Change line styles for a rendered block.";
4
+ identifier = "line";
5
+ requires_arg = true;
6
+ arg_type = Incantation.ArgType.OBJECT;
7
+ apply(target, data) {
8
+ super.require_expr_type(target.type, "expression");
9
+ if (data.style != undefined)
10
+ target.lineStyle = data.style;
11
+ if (data.width != undefined)
12
+ target.lineWidth = data.width;
13
+ if (data.opacity != undefined)
14
+ target.lineOpacity = data.opacity;
15
+ }
16
+ }
17
+ //# sourceMappingURL=line.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"line.js","sourceRoot":"","sources":["../../../../src/magic/local/line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAc,MAAM,gBAAgB,CAAC;AAWzE,MAAM,OAAO,eAAgB,SAAQ,cAAqB;IAEtC,WAAW,GACzB,0CAA0C,CAAA;IAE5B,UAAU,GAAK,MAAM,CAAA;IACrB,YAAY,GAAG,IAAI,CAAA;IACnB,QAAQ,GAAO,WAAW,CAAC,OAAO,CAAC,MAAM,CAAA;IAElD,KAAK,CAAC,MAA8B,EAAE,IAAiB;QAE9D,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAEnD,IAAI,IAAI,CAAC,KAAK,IAAI,SAAS;YAAI,MAAM,CAAC,SAAS,GAAK,IAAI,CAAC,KAAK,CAAC;QAC/D,IAAI,IAAI,CAAC,KAAK,IAAI,SAAS;YAAI,MAAM,CAAC,SAAS,GAAK,IAAI,CAAC,KAAK,CAAC;QAC/D,IAAI,IAAI,CAAC,OAAO,IAAI,SAAS;YAAE,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC;IACnE,CAAC;CACF"}
@@ -0,0 +1,7 @@
1
+ import { Incantation, type LOCAL } from "../incantation";
2
+ export declare class NoLineIncantation extends Incantation<LOCAL> {
3
+ readonly description = "Disable rendering lines for a block.";
4
+ readonly identifier = "no-line";
5
+ apply(target: Desmos.ExpressionState): void;
6
+ }
7
+ //# sourceMappingURL=no-line.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-line.d.ts","sourceRoot":"","sources":["../../../../src/magic/local/no-line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGzD,qBAAa,iBAAkB,SAAQ,WAAW,CAAC,KAAK,CAAC;IAEvD,SAAkB,WAAW,0CACa;IAE1C,SAAkB,UAAU,aAAY;IAE/B,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,QAI5C;CACF"}
@@ -0,0 +1,10 @@
1
+ import { Incantation } from "../incantation";
2
+ export class NoLineIncantation extends Incantation {
3
+ description = "Disable rendering lines for a block.";
4
+ identifier = "no-line";
5
+ apply(target) {
6
+ super.require_expr_type(target.type, "expression");
7
+ target.lines = false;
8
+ }
9
+ }
10
+ //# sourceMappingURL=no-line.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-line.js","sourceRoot":"","sources":["../../../../src/magic/local/no-line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAc,MAAM,gBAAgB,CAAC;AAGzD,MAAM,OAAO,iBAAkB,SAAQ,WAAkB;IAErC,WAAW,GACzB,sCAAsC,CAAA;IAExB,UAAU,GAAG,SAAS,CAAA;IAE/B,KAAK,CAAC,MAA8B;QAE3C,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QACnD,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;CACF"}
@@ -0,0 +1,15 @@
1
+ import { Incantation, ArgIncantation, type LOCAL } from "../incantation";
2
+ interface PointStyles {
3
+ style?: keyof typeof Desmos.Styles;
4
+ size?: number;
5
+ opacity?: number;
6
+ }
7
+ export declare class PointIncantation extends ArgIncantation<LOCAL> {
8
+ readonly description = "";
9
+ readonly identifier = "point";
10
+ readonly requires_arg = true;
11
+ readonly arg_type = Incantation.ArgType.OBJECT;
12
+ apply(target: Desmos.ExpressionState, data: Partial<PointStyles>): void;
13
+ }
14
+ export {};
15
+ //# sourceMappingURL=point.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../../src/magic/local/point.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGzE,UAAU,WAAW;IAEnB,KAAK,CAAC,EAAI,MAAM,OAAO,MAAM,CAAC,MAAM,CAAC;IACrC,IAAI,CAAC,EAAK,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAGD,qBAAa,gBAAiB,SAAQ,cAAc,CAAC,KAAK,CAAC;IAEzD,SAAkB,WAAW,MACvB;IAEN,SAAkB,UAAU,WAAY;IACxC,SAAkB,YAAY,QAAO;IACrC,SAAkB,QAAQ,8BAAiC;IAElD,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,QAOxE;CACF"}
@@ -0,0 +1,17 @@
1
+ import { Incantation, ArgIncantation } from "../incantation";
2
+ export class PointIncantation extends ArgIncantation {
3
+ description = "";
4
+ identifier = "point";
5
+ requires_arg = true;
6
+ arg_type = Incantation.ArgType.OBJECT;
7
+ apply(target, data) {
8
+ super.require_expr_type(target.type, "expression");
9
+ if (data.style != undefined)
10
+ target.pointStyle = data.style;
11
+ if (data.size != undefined)
12
+ target.pointSize = data.size;
13
+ if (data.opacity != undefined)
14
+ target.pointOpacity = data.opacity;
15
+ }
16
+ }
17
+ //# sourceMappingURL=point.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"point.js","sourceRoot":"","sources":["../../../../src/magic/local/point.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAc,MAAM,gBAAgB,CAAC;AAWzE,MAAM,OAAO,gBAAiB,SAAQ,cAAqB;IAEvC,WAAW,GACzB,EAAE,CAAA;IAEY,UAAU,GAAK,OAAO,CAAA;IACtB,YAAY,GAAG,IAAI,CAAA;IACnB,QAAQ,GAAO,WAAW,CAAC,OAAO,CAAC,MAAM,CAAA;IAElD,KAAK,CAAC,MAA8B,EAAE,IAA0B;QAEvE,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAEnD,IAAI,IAAI,CAAC,KAAK,IAAM,SAAS;YAAG,MAAM,CAAC,UAAU,GAAK,IAAI,CAAC,KAAK,CAAC;QACjE,IAAI,IAAI,CAAC,IAAI,IAAO,SAAS;YAAG,MAAM,CAAC,SAAS,GAAM,IAAI,CAAC,IAAI,CAAC;QAChE,IAAI,IAAI,CAAC,OAAO,IAAI,SAAS;YAAG,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC;IACrE,CAAC;CACF"}
@@ -0,0 +1,7 @@
1
+ import { Incantation, type LOCAL } from "../incantation";
2
+ export declare class SecretIncantation extends Incantation<LOCAL> {
3
+ readonly description = "Turn a block into a secret expression, which is hidden from the end user.";
4
+ readonly identifier = "secret";
5
+ apply(target: Desmos.ExpressionState): void;
6
+ }
7
+ //# sourceMappingURL=secret.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secret.d.ts","sourceRoot":"","sources":["../../../../src/magic/local/secret.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGzD,qBAAa,iBAAkB,SAAQ,WAAW,CAAC,KAAK,CAAC;IAEvD,SAAkB,WAAW,+EACkD;IAE/E,SAAkB,UAAU,YAAW;IAE9B,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,QAI5C;CACF"}
@@ -0,0 +1,10 @@
1
+ import { Incantation } from "../incantation";
2
+ export class SecretIncantation extends Incantation {
3
+ description = "Turn a block into a secret expression, which is hidden from the end user.";
4
+ identifier = "secret";
5
+ apply(target) {
6
+ super.require_expr_type(target.type, "expression");
7
+ target.secret = true;
8
+ }
9
+ }
10
+ //# sourceMappingURL=secret.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secret.js","sourceRoot":"","sources":["../../../../src/magic/local/secret.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAc,MAAM,gBAAgB,CAAC;AAGzD,MAAM,OAAO,iBAAkB,SAAQ,WAAkB;IAErC,WAAW,GACzB,2EAA2E,CAAA;IAE7D,UAAU,GAAG,QAAQ,CAAA;IAE9B,KAAK,CAAC,MAA8B;QAE3C,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QACnD,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC;IACvB,CAAC;CACF"}
@@ -0,0 +1,15 @@
1
+ import { Incantation, ArgIncantation, type LOCAL } from "../incantation";
2
+ interface SliderBounds {
3
+ min?: number | string;
4
+ max?: number | string;
5
+ step?: number | string;
6
+ }
7
+ export declare class SliderIncantation extends ArgIncantation<LOCAL> {
8
+ readonly description = "Set the bounds of the slider for a variable.";
9
+ readonly identifier = "slider";
10
+ readonly requires_arg = true;
11
+ readonly arg_type = Incantation.ArgType.OBJECT;
12
+ apply(target: Desmos.ExpressionState, data: SliderBounds): void;
13
+ }
14
+ export {};
15
+ //# sourceMappingURL=slider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slider.d.ts","sourceRoot":"","sources":["../../../../src/magic/local/slider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGzE,UAAU,YAAY;IAEpB,GAAG,CAAC,EAAG,MAAM,GAAG,MAAM,CAAC;IACvB,GAAG,CAAC,EAAG,MAAM,GAAG,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAGD,qBAAa,iBAAkB,SAAQ,cAAc,CAAC,KAAK,CAAC;IAE1D,SAAkB,WAAW,kDACqB;IAElD,SAAkB,UAAU,YAAa;IACzC,SAAkB,YAAY,QAAO;IACrC,SAAkB,QAAQ,8BAAiC;IAElD,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,IAAI,EAAE,YAAY,QAKhE;CACF"}
@@ -0,0 +1,13 @@
1
+ import { Incantation, ArgIncantation } from "../incantation";
2
+ export class SliderIncantation extends ArgIncantation {
3
+ description = "Set the bounds of the slider for a variable.";
4
+ identifier = "slider";
5
+ requires_arg = true;
6
+ arg_type = Incantation.ArgType.OBJECT;
7
+ apply(target, data) {
8
+ super.require_expr_type(target.type, "expression");
9
+ // @ts-expect-error: outdated types
10
+ target.sliderBounds = data;
11
+ }
12
+ }
13
+ //# sourceMappingURL=slider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slider.js","sourceRoot":"","sources":["../../../../src/magic/local/slider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAc,MAAM,gBAAgB,CAAC;AAWzE,MAAM,OAAO,iBAAkB,SAAQ,cAAqB;IAExC,WAAW,GACzB,8CAA8C,CAAA;IAEhC,UAAU,GAAK,QAAQ,CAAA;IACvB,YAAY,GAAG,IAAI,CAAA;IACnB,QAAQ,GAAO,WAAW,CAAC,OAAO,CAAC,MAAM,CAAA;IAElD,KAAK,CAAC,MAA8B,EAAE,IAAkB;QAE/D,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QACnD,mCAAmC;QACnC,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC;IAC7B,CAAC;CACF"}
@@ -0,0 +1,40 @@
1
+ import { UnrecoverableError } from "../errors";
2
+ import { Incantation, ArgIncantation } from "../magic";
3
+ export declare namespace Ast {
4
+ /** What kind of parse result this is. */
5
+ enum Kind {
6
+ EXPRESSION = "Expression",
7
+ INCANTATION_INVOCATION = "Incantation-Invocation",
8
+ INVALID_INCANTATION = "Invalid-Incantation"
9
+ }
10
+ /** A Desmos expression to add to the calculator. */
11
+ interface Expression {
12
+ kind: Kind.EXPRESSION;
13
+ data: Desmos.ExpressionState;
14
+ incantations: Array<IncantationInvocation<Incantation.Effect.LOCAL> | InvalidInvocation>;
15
+ }
16
+ /** A pending incantation invocation that requires applying its argument (if any), then applying its effect. */
17
+ type IncantationInvocation<Effect extends Incantation.Effect = Incantation.Effect> = {
18
+ kind: Kind.INCANTATION_INVOCATION;
19
+ incantation: Incantation<Effect>;
20
+ arg_raw: undefined;
21
+ } | {
22
+ kind: Kind.INCANTATION_INVOCATION;
23
+ incantation: ArgIncantation<Effect>;
24
+ arg_raw: string | undefined;
25
+ };
26
+ /**
27
+ * An invalid invantation invocation that raised an error when parsed.
28
+ *
29
+ * This will be propogated to the user as an extra Desmos text expression (unless they have `errors: false` configured).
30
+ */
31
+ interface InvalidInvocation {
32
+ kind: Kind.INVALID_INCANTATION;
33
+ incantation: Incantation;
34
+ arg_raw?: string;
35
+ error: UnrecoverableError;
36
+ }
37
+ }
38
+ /** An abstract object produced by parsing a block of source code. */
39
+ export type Ast = Ast.Expression | Ast.IncantationInvocation | Ast.InvalidInvocation;
40
+ //# sourceMappingURL=ast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../../src/parser/ast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAGvD,yBAAiB,GAAG,CACpB;IACE,yCAAyC;IACzC,KAAY,IAAI;QAEd,UAAU,eAA2B;QACrC,sBAAsB,2BAA2B;QACjD,mBAAmB,wBAA2B;KAC/C;IAGD,oDAAoD;IACpD,UAAiB,UAAU;QAEzB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAA;QACrB,IAAI,EAAE,MAAM,CAAC,eAAe,CAAA;QAC5B,YAAY,EAAE,KAAK,CACf,qBAAqB,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,GAC/C,iBAAiB,CAClB,CAAA;KACJ;IAGD,+GAA+G;IAC/G,KAAY,qBAAqB,CAAC,MAAM,SAAS,WAAW,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,IACpF;QACA,IAAI,EAAE,IAAI,CAAC,sBAAsB,CAAA;QACjC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;QAChC,OAAO,EAAE,SAAS,CAAA;KACnB,GACC;QACA,IAAI,EAAE,IAAI,CAAC,sBAAsB,CAAA;QACjC,WAAW,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;QACnC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;KAC5B,CAAC;IAEJ;;;;OAIG;IACH,UAAiB,iBAAiB;QAEhC,IAAI,EAAE,IAAI,CAAC,mBAAmB,CAAA;QAC9B,WAAW,EAAE,WAAW,CAAA;QACxB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,KAAK,EAAE,kBAAkB,CAAA;KAC1B;CACF;AAED,qEAAqE;AACrE,MAAM,MAAM,GAAG,GACX,GAAG,CAAC,UAAU,GACd,GAAG,CAAC,qBAAqB,GACzB,GAAG,CAAC,iBAAiB,CACxB"}
@@ -0,0 +1,13 @@
1
+ import { UnrecoverableError } from "../errors";
2
+ import { Incantation, ArgIncantation } from "../magic";
3
+ export var Ast;
4
+ (function (Ast) {
5
+ /** What kind of parse result this is. */
6
+ let Kind;
7
+ (function (Kind) {
8
+ Kind["EXPRESSION"] = "Expression";
9
+ Kind["INCANTATION_INVOCATION"] = "Incantation-Invocation";
10
+ Kind["INVALID_INCANTATION"] = "Invalid-Incantation";
11
+ })(Kind = Ast.Kind || (Ast.Kind = {}));
12
+ })(Ast || (Ast = {}));
13
+ //# sourceMappingURL=ast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast.js","sourceRoot":"","sources":["../../../src/parser/ast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAGvD,MAAM,KAAW,GAAG,CAgDnB;AAhDD,WAAiB,GAAG;IAElB,yCAAyC;IACzC,IAAY,IAKX;IALD,WAAY,IAAI;QAEd,iCAAqC,CAAA;QACrC,yDAAiD,CAAA;QACjD,mDAA8C,CAAA;IAChD,CAAC,EALW,IAAI,GAAJ,IAAA,IAAI,KAAJ,IAAA,IAAI,QAKf;AAwCH,CAAC,EAhDgB,GAAG,KAAH,GAAG,QAgDnB"}
@@ -0,0 +1,105 @@
1
+ import { GenericParser } from "./generic-parser";
2
+ import { Ast } from "./ast";
3
+ import type { Recoverable, Unrecoverable, MaybeRecoverable } from "../errors";
4
+ import { Incantation } from "../magic";
5
+ import type { GLOBAL, LOCAL } from "../magic";
6
+ import type { DesmostOptions } from "../compiler";
7
+ /**
8
+ * A stateful lazy parser for Desmost.
9
+ */
10
+ export declare class DesmostParser extends GenericParser {
11
+ constructor(source: string, options?: DesmostOptions);
12
+ /**
13
+ * Parse the next semantic block of source code, producing an `Ast` object, or `null` if the parser has successfully reached the end of the source code.
14
+ */
15
+ parse_next(): Ast | null;
16
+ /**
17
+ * Parse Desmost syntax before the `::` separator, which may be:
18
+ *
19
+ * - 1 global incantation
20
+ * - 1+ local incantations
21
+ */
22
+ parse_pre_sep(): Unrecoverable<{
23
+ global: Ast.IncantationInvocation<GLOBAL> | Ast.InvalidInvocation;
24
+ } | {
25
+ local: Array<Ast.IncantationInvocation<LOCAL> | Ast.InvalidInvocation>;
26
+ }>;
27
+ /**
28
+ * Parse the Desmost `::` separator.
29
+ */
30
+ parse_sep(): Unrecoverable<void>;
31
+ /**
32
+ * Parse Desmost syntax after the `::` separator, which may be:
33
+ *
34
+ * - 1 line of LaTeX
35
+ * - 1 expression incantation
36
+ */
37
+ parse_post_sep(): Unrecoverable<Ast.Expression>;
38
+ /**
39
+ * Parse a single line of LaTeX.
40
+ */
41
+ parse_latex_line(): Unrecoverable<Ast.Expression>;
42
+ /**
43
+ * Attempt to parse a global incantation invocation.
44
+ */
45
+ try_parse_global_incantation(): Recoverable<Ast.IncantationInvocation<GLOBAL> | Ast.InvalidInvocation>;
46
+ /**
47
+ * Attempt to parse a local incantation invocation.
48
+ */
49
+ try_parse_local_incantation(): Recoverable<Ast.IncantationInvocation<LOCAL> | Ast.InvalidInvocation>;
50
+ try_parse_expr_incantation(): MaybeRecoverable<Ast.Expression>;
51
+ /**
52
+ * Attempt to parse an incantation identifier.
53
+ */
54
+ try_parse_identifier<Effect extends Incantation.Effect>(incantations: Incantation<Effect>[]): Recoverable<Incantation<Effect>>;
55
+ /**
56
+ * Parse an argument to an incantation, enclosed in `{}`.
57
+ *
58
+ * ```ts
59
+ * /incantation{ arg }
60
+ * ^^^^^^^
61
+ * ```
62
+ *
63
+ * ## Notes
64
+ *
65
+ * We don't actually care for what type the argument is since we won't be evaluating it, we just want to find the closing `}`.
66
+ *
67
+ * However, the argument itself might be *meant* to contain a `}`. So we need a way to accurately identify the actual closing brace:
68
+ *
69
+ * ```ts
70
+ * /incantation{ field: { value: 1 } }
71
+ * ^ ^
72
+ * ```
73
+ *
74
+ * A well-formed argument always has matching pairs of `{}`, so we'll keep a stack. It starts with the opening `{`. When the stack is depleted, we must've reached the end of the argument.
75
+ *
76
+ * However, there's still more edge cases:
77
+ *
78
+ * ```ts
79
+ * /label{ text: "This }s weird" }
80
+ * ^
81
+ * ```
82
+ *
83
+ * `{` and `}` can appear in strings, and they won't necessarily be matched, so we'll ignore them by also tracking string contexts.
84
+ *
85
+ * ```ts
86
+ * /latex{ \{ x, y ) }
87
+ * ^
88
+ * ```
89
+ *
90
+ * `{` and `}` in LaTeX can be escaped with `\{` or `\}`, and these won't necessarily be matched, so we'll ignore them by also tracking backslash escapes.
91
+ *
92
+ * If the user truly mismatches `{}`, then, well ...parsing will fail catastrophically!
93
+ */
94
+ parse_incantation_arg(
95
+ /**
96
+ * The type of argument to parse.
97
+ *
98
+ * Parsing strategy varies for different types:
99
+ *
100
+ * - String / LaTeX: Track only balanced `{}` and escaped `\{\}`.
101
+ * - JavaScript object: The above, plus balanced string quotes.
102
+ */
103
+ arg_type: Incantation.ArgType): Unrecoverable<string>;
104
+ }
105
+ //# sourceMappingURL=desmost-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"desmost-parser.d.ts","sourceRoot":"","sources":["../../../src/parser/desmost-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAG5B,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE9E,OAAO,EACL,WAAW,EAEZ,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAQ,MAAM,UAAU,CAAC;AAEpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD;;GAEG;AACH,qBAAa,aAAc,SAAQ,aAAa;IAE9C,YAAY,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,EAGnD;IAKD;;OAEG;IACI,UAAU,IAAI,GAAG,GAAG,IAAI,CAgC9B;IAED;;;;;OAKG;IACH,aAAa,IACX,aAAa,CACT;QAAE,MAAM,EAAE,GAAG,CAAC,qBAAqB,CAAC,MAAM,CAAC,GACjC,GAAG,CAAC,iBAAiB,CAAC;KACjC,GACC;QAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,qBAAqB,CAAC,KAAK,CAAC,GAC/B,GAAG,CAAC,iBAAiB,CAAC,CAAC;KACxC,CACF,CAkCF;IAED;;OAEG;IACH,SAAS,IAAI,aAAa,CAAC,IAAI,CAAC,CAM/B;IAED;;;;;OAKG;IACH,cAAc,IAAI,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,CA4B9C;IAKD;;OAEG;IACH,gBAAgB,IAAI,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,CAahD;IAGD;;OAEG;IACH,4BAA4B,IAC1B,WAAW,CACT,GAAG,CAAC,qBAAqB,CAAC,MAAM,CAAC,GACjC,GAAG,CAAC,iBAAiB,CACtB,CAwCF;IAED;;OAEG;IACH,2BAA2B,IACzB,WAAW,CACT,GAAG,CAAC,qBAAqB,CAAC,KAAK,CAAC,GAChC,GAAG,CAAC,iBAAiB,CACtB,CAwCF;IAED,0BAA0B,IAAI,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,CA4B7D;IAED;;OAEG;IACH,oBAAoB,CAAC,MAAM,SAAS,WAAW,CAAC,MAAM,EACpD,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,GAClC,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAwBlC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACH,qBAAqB;IACnB;;;;;;;OAOG;IACH,QAAQ,EAAE,WAAW,CAAC,OAAO,GAC5B,aAAa,CAAC,MAAM,CAAC,CAgFvB;CAEF"}