@forgecharts/sdk 1.1.27 → 1.1.29

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 (356) hide show
  1. package/dist/__tests__/backwardCompatibility.test.d.ts +14 -0
  2. package/dist/__tests__/backwardCompatibility.test.d.ts.map +1 -0
  3. package/dist/__tests__/candleInvariant.test.d.ts +20 -0
  4. package/dist/__tests__/candleInvariant.test.d.ts.map +1 -0
  5. package/dist/__tests__/public-api-surface.d.ts +13 -0
  6. package/dist/__tests__/public-api-surface.d.ts.map +1 -0
  7. package/dist/__tests__/timeframeBoundary.test.d.ts +17 -0
  8. package/dist/__tests__/timeframeBoundary.test.d.ts.map +1 -0
  9. package/dist/api/DrawingManager.d.ts +20 -0
  10. package/dist/api/DrawingManager.d.ts.map +1 -0
  11. package/dist/api/EventBus.d.ts +19 -0
  12. package/dist/api/EventBus.d.ts.map +1 -0
  13. package/dist/api/IndicatorDAG.d.ts +85 -0
  14. package/dist/api/IndicatorDAG.d.ts.map +1 -0
  15. package/dist/api/IndicatorRegistry.d.ts +22 -0
  16. package/dist/api/IndicatorRegistry.d.ts.map +1 -0
  17. package/dist/api/LayoutManager.d.ts +30 -0
  18. package/dist/api/LayoutManager.d.ts.map +1 -0
  19. package/dist/api/PaneManager.d.ts +42 -0
  20. package/dist/api/PaneManager.d.ts.map +1 -0
  21. package/dist/api/ReferenceAPI.d.ts +78 -0
  22. package/dist/api/ReferenceAPI.d.ts.map +1 -0
  23. package/dist/api/TChart.d.ts +345 -0
  24. package/dist/api/TChart.d.ts.map +1 -0
  25. package/{src/api/createChart.ts → dist/api/createChart.d.ts} +2 -7
  26. package/dist/api/createChart.d.ts.map +1 -0
  27. package/dist/api/drawing tools/fib gann menu/fibRetracement.d.ts +4 -0
  28. package/dist/api/drawing tools/fib gann menu/fibRetracement.d.ts.map +1 -0
  29. package/dist/api/drawing tools/lines menu/crossLine.d.ts +4 -0
  30. package/dist/api/drawing tools/lines menu/crossLine.d.ts.map +1 -0
  31. package/dist/api/drawing tools/lines menu/disjointChannel.d.ts +17 -0
  32. package/dist/api/drawing tools/lines menu/disjointChannel.d.ts.map +1 -0
  33. package/dist/api/drawing tools/lines menu/extendedLine.d.ts +4 -0
  34. package/dist/api/drawing tools/lines menu/extendedLine.d.ts.map +1 -0
  35. package/dist/api/drawing tools/lines menu/flatTopBottom.d.ts +4 -0
  36. package/dist/api/drawing tools/lines menu/flatTopBottom.d.ts.map +1 -0
  37. package/dist/api/drawing tools/lines menu/horizontal.d.ts +4 -0
  38. package/dist/api/drawing tools/lines menu/horizontal.d.ts.map +1 -0
  39. package/dist/api/drawing tools/lines menu/horizontalRay.d.ts +4 -0
  40. package/dist/api/drawing tools/lines menu/horizontalRay.d.ts.map +1 -0
  41. package/dist/api/drawing tools/lines menu/infoLine.d.ts +4 -0
  42. package/dist/api/drawing tools/lines menu/infoLine.d.ts.map +1 -0
  43. package/dist/api/drawing tools/lines menu/insidePitchfork.d.ts +4 -0
  44. package/dist/api/drawing tools/lines menu/insidePitchfork.d.ts.map +1 -0
  45. package/dist/api/drawing tools/lines menu/modifiedSchiffPitchfork.d.ts +4 -0
  46. package/dist/api/drawing tools/lines menu/modifiedSchiffPitchfork.d.ts.map +1 -0
  47. package/dist/api/drawing tools/lines menu/parallelChannel.d.ts +4 -0
  48. package/dist/api/drawing tools/lines menu/parallelChannel.d.ts.map +1 -0
  49. package/dist/api/drawing tools/lines menu/pitchfork.d.ts +4 -0
  50. package/dist/api/drawing tools/lines menu/pitchfork.d.ts.map +1 -0
  51. package/dist/api/drawing tools/lines menu/ray.d.ts +4 -0
  52. package/dist/api/drawing tools/lines menu/ray.d.ts.map +1 -0
  53. package/dist/api/drawing tools/lines menu/regressionTrend.d.ts +4 -0
  54. package/dist/api/drawing tools/lines menu/regressionTrend.d.ts.map +1 -0
  55. package/dist/api/drawing tools/lines menu/schiffPitchfork.d.ts +4 -0
  56. package/dist/api/drawing tools/lines menu/schiffPitchfork.d.ts.map +1 -0
  57. package/dist/api/drawing tools/lines menu/trendAngle.d.ts +4 -0
  58. package/dist/api/drawing tools/lines menu/trendAngle.d.ts.map +1 -0
  59. package/dist/api/drawing tools/lines menu/trendline.d.ts +4 -0
  60. package/dist/api/drawing tools/lines menu/trendline.d.ts.map +1 -0
  61. package/dist/api/drawing tools/lines menu/vertical.d.ts +4 -0
  62. package/dist/api/drawing tools/lines menu/vertical.d.ts.map +1 -0
  63. package/{src/api/drawing tools/pointers menu/crosshair.ts → dist/api/drawing tools/pointers menu/crosshair.d.ts } +8 -9
  64. package/dist/api/drawing tools/pointers menu/crosshair.d.ts.map +1 -0
  65. package/dist/api/drawing tools/pointers menu/cursor.d.ts +15 -0
  66. package/dist/api/drawing tools/pointers menu/cursor.d.ts.map +1 -0
  67. package/{src/api/drawing tools/pointers menu/demonstration.ts → dist/api/drawing tools/pointers menu/demonstration.d.ts } +12 -17
  68. package/dist/api/drawing tools/pointers menu/demonstration.d.ts.map +1 -0
  69. package/{src/api/drawing tools/pointers menu/dot.ts → dist/api/drawing tools/pointers menu/dot.d.ts } +10 -13
  70. package/dist/api/drawing tools/pointers menu/dot.d.ts.map +1 -0
  71. package/dist/api/drawing tools/shapes menu/rectangle.d.ts +4 -0
  72. package/dist/api/drawing tools/shapes menu/rectangle.d.ts.map +1 -0
  73. package/dist/api/drawing tools/shapes menu/text.d.ts +4 -0
  74. package/dist/api/drawing tools/shapes menu/text.d.ts.map +1 -0
  75. package/dist/api/drawingUtils.d.ts +22 -0
  76. package/dist/api/drawingUtils.d.ts.map +1 -0
  77. package/dist/core/CanvasLayer.d.ts +26 -0
  78. package/dist/core/CanvasLayer.d.ts.map +1 -0
  79. package/dist/core/Chart.d.ts +164 -0
  80. package/dist/core/Chart.d.ts.map +1 -0
  81. package/dist/core/CoordTransform.d.ts +168 -0
  82. package/dist/core/CoordTransform.d.ts.map +1 -0
  83. package/dist/core/Crosshair.d.ts +30 -0
  84. package/dist/core/Crosshair.d.ts.map +1 -0
  85. package/dist/core/IndicatorEngine.d.ts +51 -0
  86. package/dist/core/IndicatorEngine.d.ts.map +1 -0
  87. package/dist/core/InteractionManager.d.ts +197 -0
  88. package/dist/core/InteractionManager.d.ts.map +1 -0
  89. package/dist/core/PriceScale.d.ts +27 -0
  90. package/dist/core/PriceScale.d.ts.map +1 -0
  91. package/dist/core/Series.d.ts +40 -0
  92. package/dist/core/Series.d.ts.map +1 -0
  93. package/dist/core/TimeScale.d.ts +43 -0
  94. package/dist/core/TimeScale.d.ts.map +1 -0
  95. package/dist/datafeed/DatafeedConnector.d.ts +89 -0
  96. package/dist/datafeed/DatafeedConnector.d.ts.map +1 -0
  97. package/dist/engine/CandleEngine.d.ts +207 -0
  98. package/dist/engine/CandleEngine.d.ts.map +1 -0
  99. package/dist/engine/__tests__/CandleEngine.test.d.ts +2 -0
  100. package/dist/engine/__tests__/CandleEngine.test.d.ts.map +1 -0
  101. package/dist/engine/candleInvariants.d.ts +66 -0
  102. package/dist/engine/candleInvariants.d.ts.map +1 -0
  103. package/{src/engine/mergeUtils.ts → dist/engine/mergeUtils.d.ts} +15 -52
  104. package/dist/engine/mergeUtils.d.ts.map +1 -0
  105. package/dist/engine/timeframeUtils.d.ts +80 -0
  106. package/dist/engine/timeframeUtils.d.ts.map +1 -0
  107. package/dist/index.d.ts +40 -0
  108. package/dist/index.d.ts.map +1 -0
  109. package/dist/index.js +8101 -0
  110. package/dist/index.js.map +1 -0
  111. package/{src/internal.ts → dist/internal.d.ts} +1 -13
  112. package/dist/internal.d.ts.map +1 -0
  113. package/dist/internal.js +8852 -0
  114. package/dist/internal.js.map +1 -0
  115. package/dist/licensing/ChartRuntimeResolver.d.ts +233 -0
  116. package/dist/licensing/ChartRuntimeResolver.d.ts.map +1 -0
  117. package/dist/licensing/LicenseManager.d.ts +55 -0
  118. package/dist/licensing/LicenseManager.d.ts.map +1 -0
  119. package/dist/licensing/__tests__/ChartRuntimeResolver.test.d.ts +13 -0
  120. package/dist/licensing/__tests__/ChartRuntimeResolver.test.d.ts.map +1 -0
  121. package/dist/licensing/__tests__/LicenseManager.test.d.ts +12 -0
  122. package/dist/licensing/__tests__/LicenseManager.test.d.ts.map +1 -0
  123. package/dist/licensing/licenseTypes.d.ts +18 -0
  124. package/dist/licensing/licenseTypes.d.ts.map +1 -0
  125. package/dist/pine/PineCompiler.d.ts +35 -0
  126. package/dist/pine/PineCompiler.d.ts.map +1 -0
  127. package/dist/pine/diagnostics.d.ts +20 -0
  128. package/dist/pine/diagnostics.d.ts.map +1 -0
  129. package/{src/pine/index.ts → dist/pine/index.d.ts} +4 -3
  130. package/dist/pine/index.d.ts.map +1 -0
  131. package/dist/pine/pine-ast.d.ts +142 -0
  132. package/dist/pine/pine-ast.d.ts.map +1 -0
  133. package/dist/pine/pine-lexer.d.ts +41 -0
  134. package/dist/pine/pine-lexer.d.ts.map +1 -0
  135. package/dist/pine/pine-parser.d.ts +51 -0
  136. package/dist/pine/pine-parser.d.ts.map +1 -0
  137. package/dist/pine/pine-transpiler.d.ts +33 -0
  138. package/dist/pine/pine-transpiler.d.ts.map +1 -0
  139. package/dist/pixi/LayerName.d.ts +18 -0
  140. package/dist/pixi/LayerName.d.ts.map +1 -0
  141. package/dist/pixi/PixiCandlestickRenderer.d.ts +23 -0
  142. package/dist/pixi/PixiCandlestickRenderer.d.ts.map +1 -0
  143. package/dist/pixi/PixiChart.d.ts +72 -0
  144. package/dist/pixi/PixiChart.d.ts.map +1 -0
  145. package/dist/pixi/PixiCrosshairRenderer.d.ts +29 -0
  146. package/dist/pixi/PixiCrosshairRenderer.d.ts.map +1 -0
  147. package/dist/pixi/PixiDrawingRenderer.d.ts +17 -0
  148. package/dist/pixi/PixiDrawingRenderer.d.ts.map +1 -0
  149. package/dist/pixi/PixiGridRenderer.d.ts +22 -0
  150. package/dist/pixi/PixiGridRenderer.d.ts.map +1 -0
  151. package/dist/pixi/PixiLayerManager.d.ts +56 -0
  152. package/dist/pixi/PixiLayerManager.d.ts.map +1 -0
  153. package/dist/react/canvas/ChartCanvas.d.ts +85 -0
  154. package/dist/react/canvas/ChartCanvas.d.ts.map +1 -0
  155. package/dist/react/canvas/ChartContextMenu.d.ts +18 -0
  156. package/dist/react/canvas/ChartContextMenu.d.ts.map +1 -0
  157. package/dist/react/canvas/ChartSettingsDialog.d.ts +25 -0
  158. package/dist/react/canvas/ChartSettingsDialog.d.ts.map +1 -0
  159. package/dist/react/canvas/IndicatorLabel.d.ts +21 -0
  160. package/dist/react/canvas/IndicatorLabel.d.ts.map +1 -0
  161. package/dist/react/canvas/IndicatorPane.d.ts +32 -0
  162. package/dist/react/canvas/IndicatorPane.d.ts.map +1 -0
  163. package/dist/react/canvas/PointerOverlay.d.ts +23 -0
  164. package/dist/react/canvas/PointerOverlay.d.ts.map +1 -0
  165. package/dist/react/canvas/toolbars/LeftToolbar.d.ts +19 -0
  166. package/dist/react/canvas/toolbars/LeftToolbar.d.ts.map +1 -0
  167. package/dist/react/hooks/useChartCapabilities.d.ts +21 -0
  168. package/dist/react/hooks/useChartCapabilities.d.ts.map +1 -0
  169. package/{src/react/index.ts → dist/react/index.d.ts} +2 -23
  170. package/dist/react/index.d.ts.map +1 -0
  171. package/dist/react/index.js +11559 -0
  172. package/dist/react/index.js.map +1 -0
  173. package/{src/react/internal.ts → dist/react/internal.d.ts} +2 -26
  174. package/dist/react/internal.d.ts.map +1 -0
  175. package/dist/react/internal.js +12148 -0
  176. package/dist/react/internal.js.map +1 -0
  177. package/dist/react/shell/ManagedAppShell.d.ts +91 -0
  178. package/dist/react/shell/ManagedAppShell.d.ts.map +1 -0
  179. package/dist/react/trading/TradingBridge.d.ts +86 -0
  180. package/dist/react/trading/TradingBridge.d.ts.map +1 -0
  181. package/dist/react/workspace/ChartWorkspace.d.ts +73 -0
  182. package/dist/react/workspace/ChartWorkspace.d.ts.map +1 -0
  183. package/dist/react/workspace/FloatingPanel.d.ts +18 -0
  184. package/dist/react/workspace/FloatingPanel.d.ts.map +1 -0
  185. package/dist/react/workspace/IndicatorsDialog.d.ts +8 -0
  186. package/dist/react/workspace/IndicatorsDialog.d.ts.map +1 -0
  187. package/dist/react/workspace/LayoutMenu.d.ts +33 -0
  188. package/dist/react/workspace/LayoutMenu.d.ts.map +1 -0
  189. package/dist/react/workspace/SymbolSearchDialog.d.ts +10 -0
  190. package/dist/react/workspace/SymbolSearchDialog.d.ts.map +1 -0
  191. package/dist/react/workspace/TabBar.d.ts +17 -0
  192. package/dist/react/workspace/TabBar.d.ts.map +1 -0
  193. package/dist/react/workspace/toolbars/BottomToolbar.d.ts +19 -0
  194. package/dist/react/workspace/toolbars/BottomToolbar.d.ts.map +1 -0
  195. package/dist/react/workspace/toolbars/RightToolbar.d.ts +8 -0
  196. package/dist/react/workspace/toolbars/RightToolbar.d.ts.map +1 -0
  197. package/dist/react/workspace/toolbars/TopToolbar.d.ts +41 -0
  198. package/dist/react/workspace/toolbars/TopToolbar.d.ts.map +1 -0
  199. package/dist/renderers/CandlestickRenderer.d.ts +13 -0
  200. package/dist/renderers/CandlestickRenderer.d.ts.map +1 -0
  201. package/dist/renderers/HistogramRenderer.d.ts +11 -0
  202. package/dist/renderers/HistogramRenderer.d.ts.map +1 -0
  203. package/dist/renderers/LineRenderer.d.ts +12 -0
  204. package/dist/renderers/LineRenderer.d.ts.map +1 -0
  205. package/dist/theme/colors.d.ts +4 -0
  206. package/dist/theme/colors.d.ts.map +1 -0
  207. package/dist/tools/barDivergenceCheck.d.ts +120 -0
  208. package/dist/tools/barDivergenceCheck.d.ts.map +1 -0
  209. package/dist/trading/TradingOverlayStore.d.ts +86 -0
  210. package/dist/trading/TradingOverlayStore.d.ts.map +1 -0
  211. package/dist/trading/UnmanagedIngestion.d.ts +91 -0
  212. package/dist/trading/UnmanagedIngestion.d.ts.map +1 -0
  213. package/dist/trading/__tests__/ManagedTradingController.test.d.ts +18 -0
  214. package/dist/trading/__tests__/ManagedTradingController.test.d.ts.map +1 -0
  215. package/dist/trading/__tests__/TradingOverlayStore.test.d.ts +16 -0
  216. package/dist/trading/__tests__/TradingOverlayStore.test.d.ts.map +1 -0
  217. package/dist/trading/__tests__/UnmanagedIngestion.test.d.ts +16 -0
  218. package/dist/trading/__tests__/UnmanagedIngestion.test.d.ts.map +1 -0
  219. package/dist/trading/managed/ManagedTradingController.d.ts +110 -0
  220. package/dist/trading/managed/ManagedTradingController.d.ts.map +1 -0
  221. package/dist/trading/managed/managedCapabilities.d.ts +45 -0
  222. package/dist/trading/managed/managedCapabilities.d.ts.map +1 -0
  223. package/dist/trading/managed/managedTypes.d.ts +122 -0
  224. package/dist/trading/managed/managedTypes.d.ts.map +1 -0
  225. package/dist/trading/tradingTypes.d.ts +89 -0
  226. package/dist/trading/tradingTypes.d.ts.map +1 -0
  227. package/dist/tscript/TScriptIndicator.d.ts +41 -0
  228. package/dist/tscript/TScriptIndicator.d.ts.map +1 -0
  229. package/dist/tscript/ast.d.ts +89 -0
  230. package/dist/tscript/ast.d.ts.map +1 -0
  231. package/dist/tscript/lexer.d.ts +36 -0
  232. package/dist/tscript/lexer.d.ts.map +1 -0
  233. package/dist/tscript/parser.d.ts +50 -0
  234. package/dist/tscript/parser.d.ts.map +1 -0
  235. package/dist/tscript/runtime.d.ts +123 -0
  236. package/dist/tscript/runtime.d.ts.map +1 -0
  237. package/dist/tscript/series.d.ts +49 -0
  238. package/dist/tscript/series.d.ts.map +1 -0
  239. package/dist/types/IChart.d.ts +48 -0
  240. package/dist/types/IChart.d.ts.map +1 -0
  241. package/{src/types/IRenderer.ts → dist/types/IRenderer.d.ts} +2 -8
  242. package/dist/types/IRenderer.d.ts.map +1 -0
  243. package/dist/types/ISeries.d.ts +26 -0
  244. package/dist/types/ISeries.d.ts.map +1 -0
  245. package/package.json +5 -1
  246. package/src/__tests__/backwardCompatibility.test.ts +0 -191
  247. package/src/__tests__/candleInvariant.test.ts +0 -500
  248. package/src/__tests__/public-api-surface.ts +0 -76
  249. package/src/__tests__/timeframeBoundary.test.ts +0 -583
  250. package/src/api/DrawingManager.ts +0 -188
  251. package/src/api/EventBus.ts +0 -53
  252. package/src/api/IndicatorDAG.ts +0 -389
  253. package/src/api/IndicatorRegistry.ts +0 -47
  254. package/src/api/LayoutManager.ts +0 -72
  255. package/src/api/PaneManager.ts +0 -129
  256. package/src/api/ReferenceAPI.ts +0 -195
  257. package/src/api/TChart.ts +0 -881
  258. package/src/api/drawing tools/fib gann menu/fibRetracement.ts +0 -27
  259. package/src/api/drawing tools/lines menu/crossLine.ts +0 -21
  260. package/src/api/drawing tools/lines menu/disjointChannel.ts +0 -74
  261. package/src/api/drawing tools/lines menu/extendedLine.ts +0 -22
  262. package/src/api/drawing tools/lines menu/flatTopBottom.ts +0 -45
  263. package/src/api/drawing tools/lines menu/horizontal.ts +0 -24
  264. package/src/api/drawing tools/lines menu/horizontalRay.ts +0 -25
  265. package/src/api/drawing tools/lines menu/infoLine.ts +0 -127
  266. package/src/api/drawing tools/lines menu/insidePitchfork.ts +0 -21
  267. package/src/api/drawing tools/lines menu/modifiedSchiffPitchfork.ts +0 -18
  268. package/src/api/drawing tools/lines menu/parallelChannel.ts +0 -47
  269. package/src/api/drawing tools/lines menu/pitchfork.ts +0 -15
  270. package/src/api/drawing tools/lines menu/ray.ts +0 -28
  271. package/src/api/drawing tools/lines menu/regressionTrend.ts +0 -157
  272. package/src/api/drawing tools/lines menu/schiffPitchfork.ts +0 -18
  273. package/src/api/drawing tools/lines menu/trendAngle.ts +0 -64
  274. package/src/api/drawing tools/lines menu/trendline.ts +0 -16
  275. package/src/api/drawing tools/lines menu/vertical.ts +0 -16
  276. package/src/api/drawing tools/pointers menu/cursor.ts +0 -16
  277. package/src/api/drawing tools/shapes menu/rectangle.ts +0 -24
  278. package/src/api/drawing tools/shapes menu/text.ts +0 -30
  279. package/src/api/drawingUtils.ts +0 -82
  280. package/src/core/CanvasLayer.ts +0 -77
  281. package/src/core/Chart.ts +0 -917
  282. package/src/core/CoordTransform.ts +0 -282
  283. package/src/core/Crosshair.ts +0 -207
  284. package/src/core/IndicatorEngine.ts +0 -216
  285. package/src/core/InteractionManager.ts +0 -899
  286. package/src/core/PriceScale.ts +0 -133
  287. package/src/core/Series.ts +0 -132
  288. package/src/core/TimeScale.ts +0 -175
  289. package/src/datafeed/DatafeedConnector.ts +0 -300
  290. package/src/engine/CandleEngine.ts +0 -458
  291. package/src/engine/__tests__/CandleEngine.test.ts +0 -402
  292. package/src/engine/candleInvariants.ts +0 -172
  293. package/src/engine/timeframeUtils.ts +0 -118
  294. package/src/index.ts +0 -190
  295. package/src/licensing/ChartRuntimeResolver.ts +0 -380
  296. package/src/licensing/LicenseManager.ts +0 -131
  297. package/src/licensing/__tests__/ChartRuntimeResolver.test.ts +0 -207
  298. package/src/licensing/__tests__/LicenseManager.test.ts +0 -180
  299. package/src/licensing/licenseTypes.ts +0 -19
  300. package/src/pine/PineCompiler.ts +0 -68
  301. package/src/pine/diagnostics.ts +0 -30
  302. package/src/pine/pine-ast.ts +0 -163
  303. package/src/pine/pine-lexer.ts +0 -265
  304. package/src/pine/pine-parser.ts +0 -439
  305. package/src/pine/pine-transpiler.ts +0 -301
  306. package/src/pixi/LayerName.ts +0 -35
  307. package/src/pixi/PixiCandlestickRenderer.ts +0 -125
  308. package/src/pixi/PixiChart.ts +0 -425
  309. package/src/pixi/PixiCrosshairRenderer.ts +0 -134
  310. package/src/pixi/PixiDrawingRenderer.ts +0 -121
  311. package/src/pixi/PixiGridRenderer.ts +0 -136
  312. package/src/pixi/PixiLayerManager.ts +0 -102
  313. package/src/react/canvas/ChartCanvas.tsx +0 -984
  314. package/src/react/canvas/ChartContextMenu.tsx +0 -60
  315. package/src/react/canvas/ChartSettingsDialog.tsx +0 -133
  316. package/src/react/canvas/IndicatorLabel.tsx +0 -347
  317. package/src/react/canvas/IndicatorPane.tsx +0 -503
  318. package/src/react/canvas/PointerOverlay.tsx +0 -126
  319. package/src/react/canvas/toolbars/LeftToolbar.tsx +0 -1096
  320. package/src/react/hooks/useChartCapabilities.ts +0 -76
  321. package/src/react/shell/ManagedAppShell.tsx +0 -699
  322. package/src/react/trading/TradingBridge.ts +0 -156
  323. package/src/react/workspace/ChartWorkspace.tsx +0 -228
  324. package/src/react/workspace/FloatingPanel.tsx +0 -131
  325. package/src/react/workspace/IndicatorsDialog.tsx +0 -246
  326. package/src/react/workspace/LayoutMenu.tsx +0 -345
  327. package/src/react/workspace/SymbolSearchDialog.tsx +0 -377
  328. package/src/react/workspace/TabBar.tsx +0 -87
  329. package/src/react/workspace/toolbars/BottomToolbar.tsx +0 -372
  330. package/src/react/workspace/toolbars/RightToolbar.tsx +0 -46
  331. package/src/react/workspace/toolbars/TopToolbar.tsx +0 -431
  332. package/src/renderers/CandlestickRenderer.ts +0 -130
  333. package/src/renderers/HistogramRenderer.ts +0 -63
  334. package/src/renderers/LineRenderer.ts +0 -77
  335. package/src/theme/colors.ts +0 -21
  336. package/src/tools/barDivergenceCheck.ts +0 -305
  337. package/src/trading/TradingOverlayStore.ts +0 -161
  338. package/src/trading/UnmanagedIngestion.ts +0 -156
  339. package/src/trading/__tests__/ManagedTradingController.test.ts +0 -338
  340. package/src/trading/__tests__/TradingOverlayStore.test.ts +0 -323
  341. package/src/trading/__tests__/UnmanagedIngestion.test.ts +0 -205
  342. package/src/trading/managed/ManagedTradingController.ts +0 -292
  343. package/src/trading/managed/managedCapabilities.ts +0 -98
  344. package/src/trading/managed/managedTypes.ts +0 -151
  345. package/src/trading/tradingTypes.ts +0 -135
  346. package/src/tscript/TScriptIndicator.ts +0 -54
  347. package/src/tscript/ast.ts +0 -105
  348. package/src/tscript/lexer.ts +0 -190
  349. package/src/tscript/parser.ts +0 -334
  350. package/src/tscript/runtime.ts +0 -525
  351. package/src/tscript/series.ts +0 -84
  352. package/src/types/IChart.ts +0 -56
  353. package/src/types/ISeries.ts +0 -30
  354. package/tsconfig.json +0 -23
  355. package/tsup.config.ts +0 -16
  356. package/vitest.config.ts +0 -25
@@ -1,54 +0,0 @@
1
- /**
2
- * TScriptIndicator — compiles and executes a TScript program, exposing its
3
- * plot() outputs as IndicatorPoint arrays compatible with the DAG DAGResult format.
4
- *
5
- * @example
6
- * ```ts
7
- * const ind = new TScriptIndicator(`
8
- * indicator("My SMA")
9
- * length = input(14)
10
- * value = sma(close, length)
11
- * plot(value)
12
- * `);
13
- *
14
- * const plots = ind.run(bars);
15
- * // plots[0] → IndicatorPoint[] for the first plot() call
16
- * ```
17
- */
18
-
19
- import type { OHLCV } from '@forgecharts/types';
20
- import { TScriptRuntime } from './runtime';
21
- import type { IndicatorPoint } from '../core/IndicatorEngine';
22
-
23
- export class TScriptIndicator {
24
- private readonly _runtime: TScriptRuntime;
25
-
26
- /** Title from the `indicator("...")` declaration, or `'Script'` if absent. */
27
- readonly title: string;
28
-
29
- constructor(src: string) {
30
- this._runtime = new TScriptRuntime(src);
31
- this.title = this._runtime.title;
32
- }
33
-
34
- /**
35
- * Execute the script over the full bar history.
36
- *
37
- * Each call resets internal state and replays every bar from scratch,
38
- * ensuring the output is deterministic regardless of prior calls.
39
- *
40
- * @returns array of plot series — `plots[0]` corresponds to the first
41
- * `plot()` call in source, `plots[1]` to the second, etc.
42
- */
43
- run(bars: readonly OHLCV[]): IndicatorPoint[][] {
44
- return this._runtime.run(bars);
45
- }
46
-
47
- /**
48
- * Reset all persistent series state (ring buffers) without re-parsing.
49
- * Call when the chart symbol or timeframe changes.
50
- */
51
- reset(): void {
52
- this._runtime.reset();
53
- }
54
- }
@@ -1,105 +0,0 @@
1
- /**
2
- * TScript Abstract Syntax Tree node types.
3
- *
4
- * Grammar (simplified):
5
- * program → stmt*
6
- * stmt → indicator_decl | assign | expr_stmt
7
- * assign → IDENT '=' expr
8
- * indicator → 'indicator' '(' STRING ')'
9
- * expr → ternary
10
- * ternary → or ('?' expr ':' expr)?
11
- * or → and ('or' and)*
12
- * and → not ('and' not)*
13
- * not → 'not' comparison | comparison
14
- * comparison → addition (('<'|'>'|'<='|'>='|'=='|'!=') addition)*
15
- * addition → multiplication (('+' | '-') multiplication)*
16
- * multiplication→ unary (('*' | '/' | '%') unary)*
17
- * unary → '-' unary | primary
18
- * primary → NUMBER | STRING | BOOL | IDENT ('[' expr ']')? | call | '(' expr ')'
19
- * call → IDENT '(' args ')'
20
- */
21
-
22
- // ─── Literal / leaf nodes ─────────────────────────────────────────────────────
23
-
24
- export type NumberLit = { kind: 'NumberLit'; value: number };
25
- export type StringLit = { kind: 'StringLit'; value: string };
26
- export type BoolLit = { kind: 'BoolLit'; value: boolean };
27
- export type Identifier = { kind: 'Identifier'; name: string };
28
-
29
- // ─── Expression nodes ─────────────────────────────────────────────────────────
30
-
31
- export type IndexExpr = {
32
- kind: 'IndexExpr';
33
- series: Expr; // the base series (usually an Identifier)
34
- index: Expr; // bar-lookback, e.g. close[1]
35
- };
36
-
37
- export type CallExpr = {
38
- kind: 'CallExpr';
39
- callee: string;
40
- args: Expr[];
41
- };
42
-
43
- export type BinaryExpr = {
44
- kind: 'BinaryExpr';
45
- op: '+' | '-' | '*' | '/' | '%' | '<' | '>' | '<=' | '>=' | '==' | '!=';
46
- left: Expr;
47
- right: Expr;
48
- };
49
-
50
- export type UnaryExpr = {
51
- kind: 'UnaryExpr';
52
- op: '-' | 'not';
53
- operand: Expr;
54
- };
55
-
56
- export type TernaryExpr = {
57
- kind: 'TernaryExpr';
58
- condition: Expr;
59
- consequent: Expr;
60
- alternate: Expr;
61
- };
62
-
63
- export type LogicalExpr = {
64
- kind: 'LogicalExpr';
65
- op: 'and' | 'or';
66
- left: Expr;
67
- right: Expr;
68
- };
69
-
70
- export type Expr =
71
- | NumberLit
72
- | StringLit
73
- | BoolLit
74
- | Identifier
75
- | IndexExpr
76
- | CallExpr
77
- | BinaryExpr
78
- | UnaryExpr
79
- | TernaryExpr
80
- | LogicalExpr;
81
-
82
- // ─── Statement nodes ──────────────────────────────────────────────────────────
83
-
84
- export type IndicatorDecl = {
85
- kind: 'IndicatorDecl';
86
- title: string;
87
- };
88
-
89
- export type AssignStmt = {
90
- kind: 'AssignStmt';
91
- name: string;
92
- value: Expr;
93
- };
94
-
95
- export type ExprStmt = {
96
- kind: 'ExprStmt';
97
- expr: Expr;
98
- };
99
-
100
- export type Stmt = IndicatorDecl | AssignStmt | ExprStmt;
101
-
102
- export type Program = {
103
- kind: 'Program';
104
- stmts: Stmt[];
105
- };
@@ -1,190 +0,0 @@
1
- /**
2
- * TScript Lexer — converts source text into a flat token stream.
3
- *
4
- * Token types:
5
- * NUMBER — 42, 3.14, .5
6
- * STRING — "hello" or 'hello'
7
- * BOOL — true / false
8
- * IDENT — identifier or keyword
9
- * OP — single/double-char operator
10
- * LPAREN, RPAREN, LBRACKET, RBRACKET, COMMA, EQ, NEWLINE
11
- * EOF
12
- */
13
-
14
- export type TokenKind =
15
- | 'NUMBER' | 'STRING' | 'BOOL' | 'IDENT'
16
- | 'PLUS' | 'MINUS' | 'STAR' | 'SLASH' | 'PERCENT'
17
- | 'LT' | 'GT' | 'LTE' | 'GTE' | 'EQEQ' | 'NEQ'
18
- | 'QMARK' | 'COLON'
19
- | 'LPAREN' | 'RPAREN' | 'LBRACKET' | 'RBRACKET'
20
- | 'COMMA' | 'EQ'
21
- | 'NEWLINE' | 'EOF';
22
-
23
- export type Token = {
24
- kind: TokenKind;
25
- value: string; // raw matched text
26
- line: number;
27
- col: number;
28
- };
29
-
30
- // Keywords that are NOT identifiers
31
- const KEYWORDS = new Set(['true', 'false', 'and', 'or', 'not', 'indicator', 'input', 'plot', 'na']);
32
-
33
- export class Lexer {
34
- private _src: string;
35
- private _pos: number = 0;
36
- private _line: number = 1;
37
- private _col: number = 1;
38
-
39
- constructor(src: string) {
40
- this._src = src;
41
- }
42
-
43
- tokenize(): Token[] {
44
- const tokens: Token[] = [];
45
- while (this._pos < this._src.length) {
46
- this._skipWhitespaceAndComments();
47
- if (this._pos >= this._src.length) break;
48
-
49
- const ch = this._src[this._pos]!;
50
-
51
- // Newline as statement separator
52
- if (ch === '\n') {
53
- tokens.push(this._make('NEWLINE', '\n'));
54
- this._pos++;
55
- this._line++;
56
- this._col = 1;
57
- continue;
58
- }
59
-
60
- // Numbers
61
- if (ch >= '0' && ch <= '9' || (ch === '.' && this._peek(1) >= '0' && this._peek(1) <= '9')) {
62
- tokens.push(this._readNumber());
63
- continue;
64
- }
65
-
66
- // Strings
67
- if (ch === '"' || ch === "'") {
68
- tokens.push(this._readString(ch));
69
- continue;
70
- }
71
-
72
- // Identifiers / keywords
73
- if (this._isAlpha(ch)) {
74
- tokens.push(this._readIdent());
75
- continue;
76
- }
77
-
78
- // Two-char operators first
79
- const two = this._src.slice(this._pos, this._pos + 2);
80
- if (two === '<=' ) { tokens.push(this._make('LTE', two)); this._pos += 2; this._col += 2; continue; }
81
- if (two === '>=' ) { tokens.push(this._make('GTE', two)); this._pos += 2; this._col += 2; continue; }
82
- if (two === '==' ) { tokens.push(this._make('EQEQ', two)); this._pos += 2; this._col += 2; continue; }
83
- if (two === '!=' ) { tokens.push(this._make('NEQ', two)); this._pos += 2; this._col += 2; continue; }
84
-
85
- // Single-char operators
86
- const ops: Record<string, TokenKind> = {
87
- '+': 'PLUS', '-': 'MINUS', '*': 'STAR', '/': 'SLASH', '%': 'PERCENT',
88
- '<': 'LT', '>': 'GT',
89
- '?': 'QMARK', ':': 'COLON',
90
- '(': 'LPAREN', ')': 'RPAREN',
91
- '[': 'LBRACKET', ']': 'RBRACKET',
92
- ',': 'COMMA',
93
- '=': 'EQ',
94
- };
95
- if (ch in ops) {
96
- tokens.push(this._make(ops[ch]!, ch));
97
- this._pos++;
98
- this._col++;
99
- continue;
100
- }
101
-
102
- throw new SyntaxError(`[TScript] Unexpected character '${ch}' at ${this._line}:${this._col}`);
103
- }
104
- tokens.push(this._make('EOF', ''));
105
- return tokens;
106
- }
107
-
108
- // ─── Private helpers ────────────────────────────────────────────────────────
109
-
110
- private _make(kind: TokenKind, value: string): Token {
111
- return { kind, value, line: this._line, col: this._col };
112
- }
113
-
114
- private _peek(offset: number): string {
115
- return this._src[this._pos + offset] ?? '';
116
- }
117
-
118
- private _isAlpha(ch: string): boolean {
119
- return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch === '_';
120
- }
121
-
122
- private _isAlphaNum(ch: string): boolean {
123
- return this._isAlpha(ch) || (ch >= '0' && ch <= '9');
124
- }
125
-
126
- private _skipWhitespaceAndComments(): void {
127
- while (this._pos < this._src.length) {
128
- const ch = this._src[this._pos]!;
129
- // Skip spaces/tabs/carriage-returns but NOT newlines (they are tokens)
130
- if (ch === ' ' || ch === '\t' || ch === '\r') {
131
- this._pos++; this._col++;
132
- continue;
133
- }
134
- // Line comment: // ... to end of line
135
- if (ch === '/' && this._peek(1) === '/') {
136
- while (this._pos < this._src.length && this._src[this._pos] !== '\n') {
137
- this._pos++; this._col++;
138
- }
139
- continue;
140
- }
141
- break;
142
- }
143
- }
144
-
145
- private _readNumber(): Token {
146
- const start = this._pos;
147
- const startCol = this._col;
148
- while (this._pos < this._src.length) {
149
- const c = this._src[this._pos]!;
150
- if ((c >= '0' && c <= '9') || c === '.') { this._pos++; this._col++; }
151
- else break;
152
- }
153
- const raw = this._src.slice(start, this._pos);
154
- return { kind: 'NUMBER', value: raw, line: this._line, col: startCol };
155
- }
156
-
157
- private _readString(quote: string): Token {
158
- const startCol = this._col;
159
- this._pos++; this._col++; // skip opening quote
160
- let result = '';
161
- while (this._pos < this._src.length && this._src[this._pos] !== quote) {
162
- if (this._src[this._pos] === '\\') {
163
- this._pos++; this._col++;
164
- const esc = this._src[this._pos] ?? '';
165
- result += esc === 'n' ? '\n' : esc === 't' ? '\t' : esc;
166
- } else {
167
- result += this._src[this._pos];
168
- }
169
- this._pos++; this._col++;
170
- }
171
- this._pos++; this._col++; // skip closing quote
172
- return { kind: 'STRING', value: result, line: this._line, col: startCol };
173
- }
174
-
175
- private _readIdent(): Token {
176
- const start = this._pos;
177
- const startCol = this._col;
178
- while (this._pos < this._src.length && this._isAlphaNum(this._src[this._pos]!)) {
179
- this._pos++; this._col++;
180
- }
181
- const name = this._src.slice(start, this._pos);
182
- if (name === 'true' || name === 'false') {
183
- return { kind: 'BOOL', value: name, line: this._line, col: startCol };
184
- }
185
- // Keywords like 'and', 'or', 'not', 'indicator' stay as IDENT so parser can
186
- // recognise them by value rather than needing dedicated token kinds.
187
- void KEYWORDS; // referenced for documentation only
188
- return { kind: 'IDENT', value: name, line: this._line, col: startCol };
189
- }
190
- }
@@ -1,334 +0,0 @@
1
- /**
2
- * TScript Parser — recursive-descent, produces a typed AST.
3
- *
4
- * Precedence (low → high):
5
- * ternary ? :
6
- * or
7
- * and
8
- * not
9
- * comparison < > <= >= == !=
10
- * addition + -
11
- * multiply * / %
12
- * unary - (prefix)
13
- * primary literals, identifiers, index [], call()
14
- */
15
-
16
- import type {
17
- Program, Stmt, Expr,
18
- IndicatorDecl, AssignStmt, ExprStmt,
19
- NumberLit, StringLit, BoolLit, Identifier,
20
- IndexExpr, CallExpr, BinaryExpr, UnaryExpr,
21
- TernaryExpr, LogicalExpr,
22
- } from './ast';
23
- import { Lexer } from './lexer';
24
- import type { Token, TokenKind } from './lexer';
25
-
26
- export class Parser {
27
- private _tokens: Token[];
28
- private _pos: number = 0;
29
-
30
- constructor(src: string) {
31
- this._tokens = new Lexer(src).tokenize().filter((t) => t.kind !== 'NEWLINE' || this._isStatementBoundary(t));
32
- // Re-filter: keep NEWLINEs as statement separators but collapse runs
33
- this._tokens = this._collapseNewlines(new Lexer(src).tokenize());
34
- }
35
-
36
- parse(): Program {
37
- const stmts: Stmt[] = [];
38
- this._skipNewlines();
39
- while (!this._check('EOF')) {
40
- stmts.push(this._stmt());
41
- this._skipNewlines();
42
- }
43
- return { kind: 'Program', stmts };
44
- }
45
-
46
- // ─── Statements ─────────────────────────────────────────────────────────────
47
-
48
- private _stmt(): Stmt {
49
- // indicator("title")
50
- if (this._checkIdent('indicator')) {
51
- return this._indicatorDecl();
52
- }
53
-
54
- // assignment: IDENT = expr (but not IDENT == ...)
55
- if (this._check('IDENT') && this._peekKind(1) === 'EQ') {
56
- return this._assign();
57
- }
58
-
59
- return this._exprStmt();
60
- }
61
-
62
- private _indicatorDecl(): IndicatorDecl {
63
- this._consumeIdent('indicator');
64
- this._consume('LPAREN', "Expected '(' after 'indicator'");
65
- const title = this._consume('STRING', "Expected string title in indicator()").value;
66
- this._consume('RPAREN', "Expected ')' after indicator title");
67
- this._consumeNewlineOrEOF();
68
- return { kind: 'IndicatorDecl', title };
69
- }
70
-
71
- private _assign(): AssignStmt {
72
- const name = this._consume('IDENT', 'Expected identifier').value;
73
- this._consume('EQ', "Expected '='");
74
- const value = this._expr();
75
- this._consumeNewlineOrEOF();
76
- return { kind: 'AssignStmt', name, value };
77
- }
78
-
79
- private _exprStmt(): ExprStmt {
80
- const expr = this._expr();
81
- this._consumeNewlineOrEOF();
82
- return { kind: 'ExprStmt', expr };
83
- }
84
-
85
- // ─── Expressions ────────────────────────────────────────────────────────────
86
-
87
- private _expr(): Expr {
88
- return this._ternary();
89
- }
90
-
91
- private _ternary(): Expr {
92
- let left = this._or();
93
- if (this._match('QMARK')) {
94
- const consequent = this._expr();
95
- this._consume('COLON', "Expected ':' in ternary expression");
96
- const alternate = this._expr();
97
- const node: TernaryExpr = { kind: 'TernaryExpr', condition: left, consequent, alternate };
98
- left = node;
99
- }
100
- return left;
101
- }
102
-
103
- private _or(): Expr {
104
- let left = this._and();
105
- while (this._checkIdent('or')) {
106
- this._advance();
107
- const right = this._and();
108
- const node: LogicalExpr = { kind: 'LogicalExpr', op: 'or', left, right };
109
- left = node;
110
- }
111
- return left;
112
- }
113
-
114
- private _and(): Expr {
115
- let left = this._not();
116
- while (this._checkIdent('and')) {
117
- this._advance();
118
- const right = this._not();
119
- const node: LogicalExpr = { kind: 'LogicalExpr', op: 'and', left, right };
120
- left = node;
121
- }
122
- return left;
123
- }
124
-
125
- private _not(): Expr {
126
- if (this._checkIdent('not')) {
127
- this._advance();
128
- const operand = this._comparison();
129
- const node: UnaryExpr = { kind: 'UnaryExpr', op: 'not', operand };
130
- return node;
131
- }
132
- return this._comparison();
133
- }
134
-
135
- private _comparison(): Expr {
136
- let left = this._addition();
137
- while (true) {
138
- if (this._match('LTE')) { left = this._binop('<=', left, this._addition()); continue; }
139
- if (this._match('GTE')) { left = this._binop('>=', left, this._addition()); continue; }
140
- if (this._match('EQEQ')) { left = this._binop('==', left, this._addition()); continue; }
141
- if (this._match('NEQ')) { left = this._binop('!=', left, this._addition()); continue; }
142
- if (this._match('LT')) { left = this._binop('<', left, this._addition()); continue; }
143
- if (this._match('GT')) { left = this._binop('>', left, this._addition()); continue; }
144
- break;
145
- }
146
- return left;
147
- }
148
-
149
- private _addition(): Expr {
150
- let left = this._multiplication();
151
- while (true) {
152
- if (this._match('PLUS')) { left = this._binop('+', left, this._multiplication()); continue; }
153
- if (this._match('MINUS')) { left = this._binop('-', left, this._multiplication()); continue; }
154
- break;
155
- }
156
- return left;
157
- }
158
-
159
- private _multiplication(): Expr {
160
- let left = this._unary();
161
- while (true) {
162
- if (this._match('STAR')) { left = this._binop('*', left, this._unary()); continue; }
163
- if (this._match('SLASH')) { left = this._binop('/', left, this._unary()); continue; }
164
- if (this._match('PERCENT')) { left = this._binop('%', left, this._unary()); continue; }
165
- break;
166
- }
167
- return left;
168
- }
169
-
170
- private _unary(): Expr {
171
- if (this._match('MINUS')) {
172
- const operand = this._unary();
173
- const node: UnaryExpr = { kind: 'UnaryExpr', op: '-', operand };
174
- return node;
175
- }
176
- return this._primary();
177
- }
178
-
179
- private _primary(): Expr {
180
- const tok = this._current();
181
-
182
- // Number literal
183
- if (tok.kind === 'NUMBER') {
184
- this._advance();
185
- const node: NumberLit = { kind: 'NumberLit', value: parseFloat(tok.value) };
186
- return node;
187
- }
188
-
189
- // String literal
190
- if (tok.kind === 'STRING') {
191
- this._advance();
192
- const node: StringLit = { kind: 'StringLit', value: tok.value };
193
- return node;
194
- }
195
-
196
- // Bool literal
197
- if (tok.kind === 'BOOL') {
198
- this._advance();
199
- const node: BoolLit = { kind: 'BoolLit', value: tok.value === 'true' };
200
- return node;
201
- }
202
-
203
- // na (special NaN constant)
204
- if (tok.kind === 'IDENT' && tok.value === 'na') {
205
- this._advance();
206
- const node: NumberLit = { kind: 'NumberLit', value: NaN };
207
- return node;
208
- }
209
-
210
- // Function call: IDENT '(' args ')'
211
- if (tok.kind === 'IDENT' && this._peekKind(1) === 'LPAREN') {
212
- return this._callExpr();
213
- }
214
-
215
- // Identifier (and optional series index)
216
- if (tok.kind === 'IDENT') {
217
- this._advance();
218
- let node: Expr = { kind: 'Identifier', name: tok.value } satisfies Identifier;
219
- // Series index: ident[expr]
220
- while (this._check('LBRACKET')) {
221
- this._advance();
222
- const index = this._expr();
223
- this._consume('RBRACKET', "Expected ']'");
224
- const indexNode: IndexExpr = { kind: 'IndexExpr', series: node, index };
225
- node = indexNode;
226
- }
227
- return node;
228
- }
229
-
230
- // Grouped: '(' expr ')'
231
- if (tok.kind === 'LPAREN') {
232
- this._advance();
233
- const inner = this._expr();
234
- this._consume('RPAREN', "Expected ')'");
235
- return inner;
236
- }
237
-
238
- throw new SyntaxError(
239
- `[TScript] Unexpected token '${tok.value}' (${tok.kind}) at ${tok.line}:${tok.col}`,
240
- );
241
- }
242
-
243
- private _callExpr(): CallExpr {
244
- const callee = this._consume('IDENT', 'Expected function name').value;
245
- this._consume('LPAREN', "Expected '('");
246
- const args: Expr[] = [];
247
- if (!this._check('RPAREN')) {
248
- args.push(this._expr());
249
- while (this._match('COMMA')) {
250
- args.push(this._expr());
251
- }
252
- }
253
- this._consume('RPAREN', "Expected ')'");
254
- return { kind: 'CallExpr', callee, args };
255
- }
256
-
257
- // ─── Utility helpers ────────────────────────────────────────────────────────
258
-
259
- private _binop(
260
- op: BinaryExpr['op'],
261
- left: Expr,
262
- right: Expr,
263
- ): BinaryExpr {
264
- return { kind: 'BinaryExpr', op, left, right };
265
- }
266
-
267
- private _current(): Token {
268
- return this._tokens[this._pos]!;
269
- }
270
-
271
- private _advance(): Token {
272
- return this._tokens[this._pos++]!;
273
- }
274
-
275
- private _check(kind: TokenKind): boolean {
276
- return this._current().kind === kind;
277
- }
278
-
279
- private _checkIdent(name: string): boolean {
280
- const t = this._current();
281
- return t.kind === 'IDENT' && t.value === name;
282
- }
283
-
284
- private _peekKind(offset: number): TokenKind {
285
- return this._tokens[this._pos + offset]?.kind ?? 'EOF';
286
- }
287
-
288
- private _match(kind: TokenKind): boolean {
289
- if (this._check(kind)) { this._advance(); return true; }
290
- return false;
291
- }
292
-
293
- private _consume(kind: TokenKind, msg: string): Token {
294
- if (this._check(kind)) return this._advance();
295
- const t = this._current();
296
- throw new SyntaxError(`[TScript] ${msg} — got '${t.value}' at ${t.line}:${t.col}`);
297
- }
298
-
299
- private _consumeIdent(name: string): Token {
300
- if (this._checkIdent(name)) return this._advance();
301
- const t = this._current();
302
- throw new SyntaxError(`[TScript] Expected '${name}' — got '${t.value}' at ${t.line}:${t.col}`);
303
- }
304
-
305
- private _consumeNewlineOrEOF(): void {
306
- // Silently accept NEWLINE or EOF; required at end of every statement.
307
- if (this._check('NEWLINE') || this._check('EOF')) {
308
- if (this._check('NEWLINE')) this._advance();
309
- }
310
- // If neither, we just continue (expression statements don't need semicolons)
311
- }
312
-
313
- private _skipNewlines(): void {
314
- while (this._check('NEWLINE')) this._advance();
315
- }
316
-
317
- private _collapseNewlines(tokens: Token[]): Token[] {
318
- const out: Token[] = [];
319
- let lastWasNL = false;
320
- for (const t of tokens) {
321
- if (t.kind === 'NEWLINE') {
322
- if (!lastWasNL) out.push(t);
323
- lastWasNL = true;
324
- } else {
325
- lastWasNL = false;
326
- out.push(t);
327
- }
328
- }
329
- return out;
330
- }
331
-
332
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
333
- private _isStatementBoundary(_t: Token): boolean { return true; }
334
- }