openpinescript 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +332 -2
  3. package/dist/cli.mjs +108691 -0
  4. package/dist/index.cjs +108670 -0
  5. package/dist/index.mjs +108624 -0
  6. package/dist/types/index.d.ts +31 -0
  7. package/dist/types/parser/v1/generated/PineV1Lexer.d.ts +66 -0
  8. package/dist/types/parser/v1/generated/PineV1Parser.d.ts +555 -0
  9. package/dist/types/parser/v1/generated/PineV1ParserVisitor.d.ts +318 -0
  10. package/dist/types/parser/v1/index.d.ts +39 -0
  11. package/dist/types/parser/v2/generated/PineV2Lexer.d.ts +67 -0
  12. package/dist/types/parser/v2/generated/PineV2Parser.d.ts +568 -0
  13. package/dist/types/parser/v2/generated/PineV2ParserVisitor.d.ts +325 -0
  14. package/dist/types/parser/v2/index.d.ts +2 -0
  15. package/dist/types/parser/v3/generated/PineV3Lexer.d.ts +67 -0
  16. package/dist/types/parser/v3/generated/PineV3Parser.d.ts +568 -0
  17. package/dist/types/parser/v3/generated/PineV3ParserVisitor.d.ts +325 -0
  18. package/dist/types/parser/v3/index.d.ts +2 -0
  19. package/dist/types/parser/v4/generated/PineV4Lexer.d.ts +86 -0
  20. package/dist/types/parser/v4/generated/PineV4Parser.d.ts +673 -0
  21. package/dist/types/parser/v4/generated/PineV4ParserVisitor.d.ts +367 -0
  22. package/dist/types/parser/v4/index.d.ts +2 -0
  23. package/dist/types/parser/v5/generated/PineV5Lexer.d.ts +95 -0
  24. package/dist/types/parser/v5/generated/PineV5Parser.d.ts +964 -0
  25. package/dist/types/parser/v5/generated/PineV5ParserVisitor.d.ts +521 -0
  26. package/dist/types/parser/v5/index.d.ts +2 -0
  27. package/dist/types/parser/v6/generated/PineV6Lexer.d.ts +98 -0
  28. package/dist/types/parser/v6/generated/PineV6Parser.d.ts +984 -0
  29. package/dist/types/parser/v6/generated/PineV6ParserVisitor.d.ts +528 -0
  30. package/dist/types/parser/v6/index.d.ts +2 -0
  31. package/dist/types/runtime/v1/Series.d.ts +61 -0
  32. package/dist/types/runtime/v1/broker/Broker.d.ts +325 -0
  33. package/dist/types/runtime/v1/broker/index.d.ts +158 -0
  34. package/dist/types/runtime/v1/broker/val.d.ts +28 -0
  35. package/dist/types/runtime/v1/constDefault.d.ts +11 -0
  36. package/dist/types/runtime/v1/context.d.ts +1705 -0
  37. package/dist/types/runtime/v1/footprint.d.ts +32 -0
  38. package/dist/types/runtime/v1/index.d.ts +7 -0
  39. package/dist/types/runtime/v1/language-spec.d.ts +12 -0
  40. package/dist/types/runtime/v1/openTrades.d.ts +12 -0
  41. package/dist/types/runtime/v1/palette.d.ts +18 -0
  42. package/dist/types/runtime/v1/session.d.ts +482 -0
  43. package/dist/types/runtime/v1/sessions.d.ts +31 -0
  44. package/dist/types/runtime/v1/stateClone.d.ts +19 -0
  45. package/dist/types/runtime/v1/stdlib/alerts.d.ts +31 -0
  46. package/dist/types/runtime/v1/stdlib/arrays.d.ts +133 -0
  47. package/dist/types/runtime/v1/stdlib/barmerge.d.ts +27 -0
  48. package/dist/types/runtime/v1/stdlib/barstate.d.ts +79 -0
  49. package/dist/types/runtime/v1/stdlib/cast.d.ts +81 -0
  50. package/dist/types/runtime/v1/stdlib/chart.d.ts +283 -0
  51. package/dist/types/runtime/v1/stdlib/color.d.ts +51 -0
  52. package/dist/types/runtime/v1/stdlib/core.d.ts +162 -0
  53. package/dist/types/runtime/v1/stdlib/dataset.d.ts +36 -0
  54. package/dist/types/runtime/v1/stdlib/display.d.ts +50 -0
  55. package/dist/types/runtime/v1/stdlib/drawings.d.ts +407 -0
  56. package/dist/types/runtime/v1/stdlib/errors.d.ts +21 -0
  57. package/dist/types/runtime/v1/stdlib/font.d.ts +20 -0
  58. package/dist/types/runtime/v1/stdlib/footprint.d.ts +76 -0
  59. package/dist/types/runtime/v1/stdlib/format.d.ts +57 -0
  60. package/dist/types/runtime/v1/stdlib/index.d.ts +71 -0
  61. package/dist/types/runtime/v1/stdlib/input.d.ts +14 -0
  62. package/dist/types/runtime/v1/stdlib/inputs.d.ts +60 -0
  63. package/dist/types/runtime/v1/stdlib/late_members.d.ts +97 -0
  64. package/dist/types/runtime/v1/stdlib/logging.d.ts +31 -0
  65. package/dist/types/runtime/v1/stdlib/maps.d.ts +55 -0
  66. package/dist/types/runtime/v1/stdlib/math.d.ts +71 -0
  67. package/dist/types/runtime/v1/stdlib/matrix.d.ts +201 -0
  68. package/dist/types/runtime/v1/stdlib/metadata.d.ts +14 -0
  69. package/dist/types/runtime/v1/stdlib/mtf.d.ts +15 -0
  70. package/dist/types/runtime/v1/stdlib/renames.d.ts +117 -0
  71. package/dist/types/runtime/v1/stdlib/renames5.d.ts +113 -0
  72. package/dist/types/runtime/v1/stdlib/renames6.d.ts +81 -0
  73. package/dist/types/runtime/v1/stdlib/request.d.ts +207 -0
  74. package/dist/types/runtime/v1/stdlib/scale.d.ts +19 -0
  75. package/dist/types/runtime/v1/stdlib/session.d.ts +113 -0
  76. package/dist/types/runtime/v1/stdlib/sort_field.d.ts +12 -0
  77. package/dist/types/runtime/v1/stdlib/sources.d.ts +24 -0
  78. package/dist/types/runtime/v1/stdlib/str.d.ts +117 -0
  79. package/dist/types/runtime/v1/stdlib/strategy.d.ts +314 -0
  80. package/dist/types/runtime/v1/stdlib/syminfo.d.ts +209 -0
  81. package/dist/types/runtime/v1/stdlib/ta.d.ts +409 -0
  82. package/dist/types/runtime/v1/stdlib/time.d.ts +158 -0
  83. package/dist/types/runtime/v1/stdlib/trades.d.ts +108 -0
  84. package/dist/types/runtime/v1/stdlib/ui.d.ts +196 -0
  85. package/dist/types/runtime/v1/stdlib/v6_members.d.ts +68 -0
  86. package/dist/types/runtime/v1/timeframes.d.ts +139 -0
  87. package/dist/types/runtime/v1/zones.d.ts +30 -0
  88. package/dist/types/transpiler/common/index.d.ts +51 -0
  89. package/dist/types/transpiler/common/libraries.d.ts +29 -0
  90. package/dist/types/transpiler/common/parseErrors.d.ts +38 -0
  91. package/dist/types/transpiler/common/passes/ScopeAnalysis.d.ts +158 -0
  92. package/dist/types/transpiler/common/passes/TypeRules.d.ts +26 -0
  93. package/dist/types/transpiler/common/profiles/index.d.ts +96 -0
  94. package/dist/types/transpiler/common/version.d.ts +40 -0
  95. package/dist/types/transpiler/v1/ToJsVisitor.d.ts +720 -0
  96. package/dist/types/transpiler/v2/ToJsVisitor.d.ts +72 -0
  97. package/dist/types/transpiler/v3/ToJsVisitor.d.ts +87 -0
  98. package/dist/types/transpiler/v4/ToJsVisitor.d.ts +263 -0
  99. package/dist/types/transpiler/v5/ToJsVisitor.d.ts +1101 -0
  100. package/dist/types/transpiler/v6/ToJsVisitor.d.ts +237 -0
  101. package/dist/types/transpiler/v6/rules.d.ts +94 -0
  102. package/dist/types/utils/v2/common.d.ts +4 -0
  103. package/package.json +92 -4
@@ -0,0 +1,528 @@
1
+ import { AbstractParseTreeVisitor } from "antlr4ng";
2
+ import { Once_exprContext } from "./PineV6Parser.js";
3
+ import { Other_literalContext } from "./PineV6Parser.js";
4
+ import { Global_stmt_contentContext } from "./PineV6Parser.js";
5
+ import { Local_stmt_contentContext } from "./PineV6Parser.js";
6
+ import { IdContext } from "./PineV6Parser.js";
7
+ import { Export_stmtContext } from "./PineV6Parser.js";
8
+ import { While_exprContext } from "./PineV6Parser.js";
9
+ import { Switch_exprContext } from "./PineV6Parser.js";
10
+ import { Switch_bodyContext } from "./PineV6Parser.js";
11
+ import { Switch_caseContext } from "./PineV6Parser.js";
12
+ import { Field_typeContext } from "./PineV6Parser.js";
13
+ import { Type_def_stmtContext } from "./PineV6Parser.js";
14
+ import { Type_bodyContext } from "./PineV6Parser.js";
15
+ import { Type_fieldContext } from "./PineV6Parser.js";
16
+ import { Method_def_stmtContext } from "./PineV6Parser.js";
17
+ import { Enum_def_stmtContext } from "./PineV6Parser.js";
18
+ import { Enum_bodyContext } from "./PineV6Parser.js";
19
+ import { Enum_fieldContext } from "./PineV6Parser.js";
20
+ import { Import_stmtContext } from "./PineV6Parser.js";
21
+ import { Import_pathContext } from "./PineV6Parser.js";
22
+ import { Import_userContext } from "./PineV6Parser.js";
23
+ import { User_partContext } from "./PineV6Parser.js";
24
+ import { Fun_paramContext } from "./PineV6Parser.js";
25
+ import { Type_argsContext } from "./PineV6Parser.js";
26
+ import { Type_argContext } from "./PineV6Parser.js";
27
+ import { For_in_exprContext } from "./PineV6Parser.js";
28
+ import { Call_suffixContext } from "./PineV6Parser.js";
29
+ import { Fun_callContext } from "./PineV6Parser.js";
30
+ import { AtomContext } from "./PineV6Parser.js";
31
+ import { StmtContext } from "./PineV6Parser.js";
32
+ import { Fun_headContext } from "./PineV6Parser.js";
33
+ import { Var_defContext } from "./PineV6Parser.js";
34
+ import { Var_defsContext } from "./PineV6Parser.js";
35
+ import { Id_partContext } from "./PineV6Parser.js";
36
+ import { Arith_exprContext } from "./PineV6Parser.js";
37
+ import { Decl_modContext } from "./PineV6Parser.js";
38
+ import { Type_qualContext } from "./PineV6Parser.js";
39
+ import { Type_nameContext } from "./PineV6Parser.js";
40
+ import { Compound_assign_opContext } from "./PineV6Parser.js";
41
+ import { Var_assignContext } from "./PineV6Parser.js";
42
+ import { If_exprContext } from "./PineV6Parser.js";
43
+ import { Pos_argContext } from "./PineV6Parser.js";
44
+ import { Pos_argsContext } from "./PineV6Parser.js";
45
+ import { Pine_scriptContext } from "./PineV6Parser.js";
46
+ import { Global_stmtContext } from "./PineV6Parser.js";
47
+ import { Fun_def_stmtContext } from "./PineV6Parser.js";
48
+ import { Fun_def_singlelineContext } from "./PineV6Parser.js";
49
+ import { Fun_def_multilineContext } from "./PineV6Parser.js";
50
+ import { Fun_body_singlelineContext } from "./PineV6Parser.js";
51
+ import { Local_stmt_singlelineContext } from "./PineV6Parser.js";
52
+ import { Loop_breakContext } from "./PineV6Parser.js";
53
+ import { Loop_continueContext } from "./PineV6Parser.js";
54
+ import { Fun_body_multilineContext } from "./PineV6Parser.js";
55
+ import { Local_stmts_multilineContext } from "./PineV6Parser.js";
56
+ import { Local_stmts_listContext } from "./PineV6Parser.js";
57
+ import { Local_stmt_multilineContext } from "./PineV6Parser.js";
58
+ import { Ids_arrayContext } from "./PineV6Parser.js";
59
+ import { Arith_exprsContext } from "./PineV6Parser.js";
60
+ import { For_exprContext } from "./PineV6Parser.js";
61
+ import { Stmts_blockContext } from "./PineV6Parser.js";
62
+ import { Ternary_exprContext } from "./PineV6Parser.js";
63
+ import { Or_exprContext } from "./PineV6Parser.js";
64
+ import { And_exprContext } from "./PineV6Parser.js";
65
+ import { Eq_exprContext } from "./PineV6Parser.js";
66
+ import { Cmp_exprContext } from "./PineV6Parser.js";
67
+ import { Add_exprContext } from "./PineV6Parser.js";
68
+ import { Mult_exprContext } from "./PineV6Parser.js";
69
+ import { Unary_exprContext } from "./PineV6Parser.js";
70
+ import { Sqbr_exprContext } from "./PineV6Parser.js";
71
+ import { Fun_actual_argsContext } from "./PineV6Parser.js";
72
+ import { Kw_argsContext } from "./PineV6Parser.js";
73
+ import { Kw_argContext } from "./PineV6Parser.js";
74
+ import { LiteralContext } from "./PineV6Parser.js";
75
+ import { Num_literalContext } from "./PineV6Parser.js";
76
+ /**
77
+ * This interface defines a complete generic visitor for a parse tree produced
78
+ * by `PineV6Parser`.
79
+ *
80
+ * @param <Result> The return type of the visit operation. Use `void` for
81
+ * operations with no return type.
82
+ */
83
+ export declare class PineV6ParserVisitor<Result> extends AbstractParseTreeVisitor<Result> {
84
+ /**
85
+ * Visit a parse tree produced by `PineV6Parser.once_expr`.
86
+ * @param ctx the parse tree
87
+ * @return the visitor result
88
+ */
89
+ visitOnce_expr?: (ctx: Once_exprContext) => Result;
90
+ /**
91
+ * Visit a parse tree produced by `PineV6Parser.other_literal`.
92
+ * @param ctx the parse tree
93
+ * @return the visitor result
94
+ */
95
+ visitOther_literal?: (ctx: Other_literalContext) => Result;
96
+ /**
97
+ * Visit a parse tree produced by `PineV6Parser.global_stmt_content`.
98
+ * @param ctx the parse tree
99
+ * @return the visitor result
100
+ */
101
+ visitGlobal_stmt_content?: (ctx: Global_stmt_contentContext) => Result;
102
+ /**
103
+ * Visit a parse tree produced by `PineV6Parser.local_stmt_content`.
104
+ * @param ctx the parse tree
105
+ * @return the visitor result
106
+ */
107
+ visitLocal_stmt_content?: (ctx: Local_stmt_contentContext) => Result;
108
+ /**
109
+ * Visit a parse tree produced by `PineV6Parser.id`.
110
+ * @param ctx the parse tree
111
+ * @return the visitor result
112
+ */
113
+ visitId?: (ctx: IdContext) => Result;
114
+ /**
115
+ * Visit a parse tree produced by `PineV6Parser.export_stmt`.
116
+ * @param ctx the parse tree
117
+ * @return the visitor result
118
+ */
119
+ visitExport_stmt?: (ctx: Export_stmtContext) => Result;
120
+ /**
121
+ * Visit a parse tree produced by `PineV6Parser.while_expr`.
122
+ * @param ctx the parse tree
123
+ * @return the visitor result
124
+ */
125
+ visitWhile_expr?: (ctx: While_exprContext) => Result;
126
+ /**
127
+ * Visit a parse tree produced by `PineV6Parser.switch_expr`.
128
+ * @param ctx the parse tree
129
+ * @return the visitor result
130
+ */
131
+ visitSwitch_expr?: (ctx: Switch_exprContext) => Result;
132
+ /**
133
+ * Visit a parse tree produced by `PineV6Parser.switch_body`.
134
+ * @param ctx the parse tree
135
+ * @return the visitor result
136
+ */
137
+ visitSwitch_body?: (ctx: Switch_bodyContext) => Result;
138
+ /**
139
+ * Visit a parse tree produced by `PineV6Parser.switch_case`.
140
+ * @param ctx the parse tree
141
+ * @return the visitor result
142
+ */
143
+ visitSwitch_case?: (ctx: Switch_caseContext) => Result;
144
+ /**
145
+ * Visit a parse tree produced by `PineV6Parser.field_type`.
146
+ * @param ctx the parse tree
147
+ * @return the visitor result
148
+ */
149
+ visitField_type?: (ctx: Field_typeContext) => Result;
150
+ /**
151
+ * Visit a parse tree produced by `PineV6Parser.type_def_stmt`.
152
+ * @param ctx the parse tree
153
+ * @return the visitor result
154
+ */
155
+ visitType_def_stmt?: (ctx: Type_def_stmtContext) => Result;
156
+ /**
157
+ * Visit a parse tree produced by `PineV6Parser.type_body`.
158
+ * @param ctx the parse tree
159
+ * @return the visitor result
160
+ */
161
+ visitType_body?: (ctx: Type_bodyContext) => Result;
162
+ /**
163
+ * Visit a parse tree produced by `PineV6Parser.type_field`.
164
+ * @param ctx the parse tree
165
+ * @return the visitor result
166
+ */
167
+ visitType_field?: (ctx: Type_fieldContext) => Result;
168
+ /**
169
+ * Visit a parse tree produced by `PineV6Parser.method_def_stmt`.
170
+ * @param ctx the parse tree
171
+ * @return the visitor result
172
+ */
173
+ visitMethod_def_stmt?: (ctx: Method_def_stmtContext) => Result;
174
+ /**
175
+ * Visit a parse tree produced by `PineV6Parser.enum_def_stmt`.
176
+ * @param ctx the parse tree
177
+ * @return the visitor result
178
+ */
179
+ visitEnum_def_stmt?: (ctx: Enum_def_stmtContext) => Result;
180
+ /**
181
+ * Visit a parse tree produced by `PineV6Parser.enum_body`.
182
+ * @param ctx the parse tree
183
+ * @return the visitor result
184
+ */
185
+ visitEnum_body?: (ctx: Enum_bodyContext) => Result;
186
+ /**
187
+ * Visit a parse tree produced by `PineV6Parser.enum_field`.
188
+ * @param ctx the parse tree
189
+ * @return the visitor result
190
+ */
191
+ visitEnum_field?: (ctx: Enum_fieldContext) => Result;
192
+ /**
193
+ * Visit a parse tree produced by `PineV6Parser.import_stmt`.
194
+ * @param ctx the parse tree
195
+ * @return the visitor result
196
+ */
197
+ visitImport_stmt?: (ctx: Import_stmtContext) => Result;
198
+ /**
199
+ * Visit a parse tree produced by `PineV6Parser.import_path`.
200
+ * @param ctx the parse tree
201
+ * @return the visitor result
202
+ */
203
+ visitImport_path?: (ctx: Import_pathContext) => Result;
204
+ /**
205
+ * Visit a parse tree produced by `PineV6Parser.import_user`.
206
+ * @param ctx the parse tree
207
+ * @return the visitor result
208
+ */
209
+ visitImport_user?: (ctx: Import_userContext) => Result;
210
+ /**
211
+ * Visit a parse tree produced by `PineV6Parser.user_part`.
212
+ * @param ctx the parse tree
213
+ * @return the visitor result
214
+ */
215
+ visitUser_part?: (ctx: User_partContext) => Result;
216
+ /**
217
+ * Visit a parse tree produced by `PineV6Parser.fun_param`.
218
+ * @param ctx the parse tree
219
+ * @return the visitor result
220
+ */
221
+ visitFun_param?: (ctx: Fun_paramContext) => Result;
222
+ /**
223
+ * Visit a parse tree produced by `PineV6Parser.type_args`.
224
+ * @param ctx the parse tree
225
+ * @return the visitor result
226
+ */
227
+ visitType_args?: (ctx: Type_argsContext) => Result;
228
+ /**
229
+ * Visit a parse tree produced by `PineV6Parser.type_arg`.
230
+ * @param ctx the parse tree
231
+ * @return the visitor result
232
+ */
233
+ visitType_arg?: (ctx: Type_argContext) => Result;
234
+ /**
235
+ * Visit a parse tree produced by `PineV6Parser.for_in_expr`.
236
+ * @param ctx the parse tree
237
+ * @return the visitor result
238
+ */
239
+ visitFor_in_expr?: (ctx: For_in_exprContext) => Result;
240
+ /**
241
+ * Visit a parse tree produced by `PineV6Parser.call_suffix`.
242
+ * @param ctx the parse tree
243
+ * @return the visitor result
244
+ */
245
+ visitCall_suffix?: (ctx: Call_suffixContext) => Result;
246
+ /**
247
+ * Visit a parse tree produced by `PineV6Parser.fun_call`.
248
+ * @param ctx the parse tree
249
+ * @return the visitor result
250
+ */
251
+ visitFun_call?: (ctx: Fun_callContext) => Result;
252
+ /**
253
+ * Visit a parse tree produced by `PineV6Parser.atom`.
254
+ * @param ctx the parse tree
255
+ * @return the visitor result
256
+ */
257
+ visitAtom?: (ctx: AtomContext) => Result;
258
+ /**
259
+ * Visit a parse tree produced by `PineV6Parser.stmt`.
260
+ * @param ctx the parse tree
261
+ * @return the visitor result
262
+ */
263
+ visitStmt?: (ctx: StmtContext) => Result;
264
+ /**
265
+ * Visit a parse tree produced by `PineV6Parser.fun_head`.
266
+ * @param ctx the parse tree
267
+ * @return the visitor result
268
+ */
269
+ visitFun_head?: (ctx: Fun_headContext) => Result;
270
+ /**
271
+ * Visit a parse tree produced by `PineV6Parser.var_def`.
272
+ * @param ctx the parse tree
273
+ * @return the visitor result
274
+ */
275
+ visitVar_def?: (ctx: Var_defContext) => Result;
276
+ /**
277
+ * Visit a parse tree produced by `PineV6Parser.var_defs`.
278
+ * @param ctx the parse tree
279
+ * @return the visitor result
280
+ */
281
+ visitVar_defs?: (ctx: Var_defsContext) => Result;
282
+ /**
283
+ * Visit a parse tree produced by `PineV6Parser.id_part`.
284
+ * @param ctx the parse tree
285
+ * @return the visitor result
286
+ */
287
+ visitId_part?: (ctx: Id_partContext) => Result;
288
+ /**
289
+ * Visit a parse tree produced by `PineV6Parser.arith_expr`.
290
+ * @param ctx the parse tree
291
+ * @return the visitor result
292
+ */
293
+ visitArith_expr?: (ctx: Arith_exprContext) => Result;
294
+ /**
295
+ * Visit a parse tree produced by `PineV6Parser.decl_mod`.
296
+ * @param ctx the parse tree
297
+ * @return the visitor result
298
+ */
299
+ visitDecl_mod?: (ctx: Decl_modContext) => Result;
300
+ /**
301
+ * Visit a parse tree produced by `PineV6Parser.type_qual`.
302
+ * @param ctx the parse tree
303
+ * @return the visitor result
304
+ */
305
+ visitType_qual?: (ctx: Type_qualContext) => Result;
306
+ /**
307
+ * Visit a parse tree produced by `PineV6Parser.type_name`.
308
+ * @param ctx the parse tree
309
+ * @return the visitor result
310
+ */
311
+ visitType_name?: (ctx: Type_nameContext) => Result;
312
+ /**
313
+ * Visit a parse tree produced by `PineV6Parser.compound_assign_op`.
314
+ * @param ctx the parse tree
315
+ * @return the visitor result
316
+ */
317
+ visitCompound_assign_op?: (ctx: Compound_assign_opContext) => Result;
318
+ /**
319
+ * Visit a parse tree produced by `PineV6Parser.var_assign`.
320
+ * @param ctx the parse tree
321
+ * @return the visitor result
322
+ */
323
+ visitVar_assign?: (ctx: Var_assignContext) => Result;
324
+ /**
325
+ * Visit a parse tree produced by `PineV6Parser.if_expr`.
326
+ * @param ctx the parse tree
327
+ * @return the visitor result
328
+ */
329
+ visitIf_expr?: (ctx: If_exprContext) => Result;
330
+ /**
331
+ * Visit a parse tree produced by `PineV6Parser.pos_arg`.
332
+ * @param ctx the parse tree
333
+ * @return the visitor result
334
+ */
335
+ visitPos_arg?: (ctx: Pos_argContext) => Result;
336
+ /**
337
+ * Visit a parse tree produced by `PineV6Parser.pos_args`.
338
+ * @param ctx the parse tree
339
+ * @return the visitor result
340
+ */
341
+ visitPos_args?: (ctx: Pos_argsContext) => Result;
342
+ /**
343
+ * Visit a parse tree produced by `PineV6Parser.pine_script`.
344
+ * @param ctx the parse tree
345
+ * @return the visitor result
346
+ */
347
+ visitPine_script?: (ctx: Pine_scriptContext) => Result;
348
+ /**
349
+ * Visit a parse tree produced by `PineV6Parser.global_stmt`.
350
+ * @param ctx the parse tree
351
+ * @return the visitor result
352
+ */
353
+ visitGlobal_stmt?: (ctx: Global_stmtContext) => Result;
354
+ /**
355
+ * Visit a parse tree produced by `PineV6Parser.fun_def_stmt`.
356
+ * @param ctx the parse tree
357
+ * @return the visitor result
358
+ */
359
+ visitFun_def_stmt?: (ctx: Fun_def_stmtContext) => Result;
360
+ /**
361
+ * Visit a parse tree produced by `PineV6Parser.fun_def_singleline`.
362
+ * @param ctx the parse tree
363
+ * @return the visitor result
364
+ */
365
+ visitFun_def_singleline?: (ctx: Fun_def_singlelineContext) => Result;
366
+ /**
367
+ * Visit a parse tree produced by `PineV6Parser.fun_def_multiline`.
368
+ * @param ctx the parse tree
369
+ * @return the visitor result
370
+ */
371
+ visitFun_def_multiline?: (ctx: Fun_def_multilineContext) => Result;
372
+ /**
373
+ * Visit a parse tree produced by `PineV6Parser.fun_body_singleline`.
374
+ * @param ctx the parse tree
375
+ * @return the visitor result
376
+ */
377
+ visitFun_body_singleline?: (ctx: Fun_body_singlelineContext) => Result;
378
+ /**
379
+ * Visit a parse tree produced by `PineV6Parser.local_stmt_singleline`.
380
+ * @param ctx the parse tree
381
+ * @return the visitor result
382
+ */
383
+ visitLocal_stmt_singleline?: (ctx: Local_stmt_singlelineContext) => Result;
384
+ /**
385
+ * Visit a parse tree produced by `PineV6Parser.loop_break`.
386
+ * @param ctx the parse tree
387
+ * @return the visitor result
388
+ */
389
+ visitLoop_break?: (ctx: Loop_breakContext) => Result;
390
+ /**
391
+ * Visit a parse tree produced by `PineV6Parser.loop_continue`.
392
+ * @param ctx the parse tree
393
+ * @return the visitor result
394
+ */
395
+ visitLoop_continue?: (ctx: Loop_continueContext) => Result;
396
+ /**
397
+ * Visit a parse tree produced by `PineV6Parser.fun_body_multiline`.
398
+ * @param ctx the parse tree
399
+ * @return the visitor result
400
+ */
401
+ visitFun_body_multiline?: (ctx: Fun_body_multilineContext) => Result;
402
+ /**
403
+ * Visit a parse tree produced by `PineV6Parser.local_stmts_multiline`.
404
+ * @param ctx the parse tree
405
+ * @return the visitor result
406
+ */
407
+ visitLocal_stmts_multiline?: (ctx: Local_stmts_multilineContext) => Result;
408
+ /**
409
+ * Visit a parse tree produced by `PineV6Parser.local_stmts_list`.
410
+ * @param ctx the parse tree
411
+ * @return the visitor result
412
+ */
413
+ visitLocal_stmts_list?: (ctx: Local_stmts_listContext) => Result;
414
+ /**
415
+ * Visit a parse tree produced by `PineV6Parser.local_stmt_multiline`.
416
+ * @param ctx the parse tree
417
+ * @return the visitor result
418
+ */
419
+ visitLocal_stmt_multiline?: (ctx: Local_stmt_multilineContext) => Result;
420
+ /**
421
+ * Visit a parse tree produced by `PineV6Parser.ids_array`.
422
+ * @param ctx the parse tree
423
+ * @return the visitor result
424
+ */
425
+ visitIds_array?: (ctx: Ids_arrayContext) => Result;
426
+ /**
427
+ * Visit a parse tree produced by `PineV6Parser.arith_exprs`.
428
+ * @param ctx the parse tree
429
+ * @return the visitor result
430
+ */
431
+ visitArith_exprs?: (ctx: Arith_exprsContext) => Result;
432
+ /**
433
+ * Visit a parse tree produced by `PineV6Parser.for_expr`.
434
+ * @param ctx the parse tree
435
+ * @return the visitor result
436
+ */
437
+ visitFor_expr?: (ctx: For_exprContext) => Result;
438
+ /**
439
+ * Visit a parse tree produced by `PineV6Parser.stmts_block`.
440
+ * @param ctx the parse tree
441
+ * @return the visitor result
442
+ */
443
+ visitStmts_block?: (ctx: Stmts_blockContext) => Result;
444
+ /**
445
+ * Visit a parse tree produced by `PineV6Parser.ternary_expr`.
446
+ * @param ctx the parse tree
447
+ * @return the visitor result
448
+ */
449
+ visitTernary_expr?: (ctx: Ternary_exprContext) => Result;
450
+ /**
451
+ * Visit a parse tree produced by `PineV6Parser.or_expr`.
452
+ * @param ctx the parse tree
453
+ * @return the visitor result
454
+ */
455
+ visitOr_expr?: (ctx: Or_exprContext) => Result;
456
+ /**
457
+ * Visit a parse tree produced by `PineV6Parser.and_expr`.
458
+ * @param ctx the parse tree
459
+ * @return the visitor result
460
+ */
461
+ visitAnd_expr?: (ctx: And_exprContext) => Result;
462
+ /**
463
+ * Visit a parse tree produced by `PineV6Parser.eq_expr`.
464
+ * @param ctx the parse tree
465
+ * @return the visitor result
466
+ */
467
+ visitEq_expr?: (ctx: Eq_exprContext) => Result;
468
+ /**
469
+ * Visit a parse tree produced by `PineV6Parser.cmp_expr`.
470
+ * @param ctx the parse tree
471
+ * @return the visitor result
472
+ */
473
+ visitCmp_expr?: (ctx: Cmp_exprContext) => Result;
474
+ /**
475
+ * Visit a parse tree produced by `PineV6Parser.add_expr`.
476
+ * @param ctx the parse tree
477
+ * @return the visitor result
478
+ */
479
+ visitAdd_expr?: (ctx: Add_exprContext) => Result;
480
+ /**
481
+ * Visit a parse tree produced by `PineV6Parser.mult_expr`.
482
+ * @param ctx the parse tree
483
+ * @return the visitor result
484
+ */
485
+ visitMult_expr?: (ctx: Mult_exprContext) => Result;
486
+ /**
487
+ * Visit a parse tree produced by `PineV6Parser.unary_expr`.
488
+ * @param ctx the parse tree
489
+ * @return the visitor result
490
+ */
491
+ visitUnary_expr?: (ctx: Unary_exprContext) => Result;
492
+ /**
493
+ * Visit a parse tree produced by `PineV6Parser.sqbr_expr`.
494
+ * @param ctx the parse tree
495
+ * @return the visitor result
496
+ */
497
+ visitSqbr_expr?: (ctx: Sqbr_exprContext) => Result;
498
+ /**
499
+ * Visit a parse tree produced by `PineV6Parser.fun_actual_args`.
500
+ * @param ctx the parse tree
501
+ * @return the visitor result
502
+ */
503
+ visitFun_actual_args?: (ctx: Fun_actual_argsContext) => Result;
504
+ /**
505
+ * Visit a parse tree produced by `PineV6Parser.kw_args`.
506
+ * @param ctx the parse tree
507
+ * @return the visitor result
508
+ */
509
+ visitKw_args?: (ctx: Kw_argsContext) => Result;
510
+ /**
511
+ * Visit a parse tree produced by `PineV6Parser.kw_arg`.
512
+ * @param ctx the parse tree
513
+ * @return the visitor result
514
+ */
515
+ visitKw_arg?: (ctx: Kw_argContext) => Result;
516
+ /**
517
+ * Visit a parse tree produced by `PineV6Parser.literal`.
518
+ * @param ctx the parse tree
519
+ * @return the visitor result
520
+ */
521
+ visitLiteral?: (ctx: LiteralContext) => Result;
522
+ /**
523
+ * Visit a parse tree produced by `PineV6Parser.num_literal`.
524
+ * @param ctx the parse tree
525
+ * @return the visitor result
526
+ */
527
+ visitNum_literal?: (ctx: Num_literalContext) => Result;
528
+ }
@@ -0,0 +1,2 @@
1
+ export type { ParserError, ParseResult } from "../v1/index.js";
2
+ export declare const parse: (source: string) => import("./index.js").ParseResult<import("./generated/PineV6Parser.js").Pine_scriptContext>;
@@ -0,0 +1,61 @@
1
+ import { Context } from "./context.js";
2
+ /** Captured head state of a Series for live-tick rollback (P3). */
3
+ export interface SeriesSnapshot<T = any> {
4
+ len: number;
5
+ val: T | null;
6
+ start: number;
7
+ fallback: any;
8
+ locked: boolean;
9
+ }
10
+ /**
11
+ * Series<T> - Sparse Time-Series Storage
12
+ * * STRATEGY: SPRASE ARRAY (Memory Optimization)
13
+ * Unlike standard arrays that push value-by-value, this class creates "holes"
14
+ * for missing bars. We do NOT loop to fill gaps with NaNs.
15
+ * * - If update() is skipped for 1000 bars (e.g. inside a conditional),
16
+ * we simply write to index+1000.
17
+ * - The JavaScript engine optimizes these holes (V8 uses a dictionary
18
+ * backing store for very sparse arrays).
19
+ * - get() checks for 'undefined' (a hole) and returns the fallback (NaN/null).
20
+ */
21
+ export declare class Series<T = any> {
22
+ private ctx;
23
+ id: string;
24
+ private buffer;
25
+ private startBarIndex;
26
+ private _val;
27
+ private _fallback;
28
+ private _typeLocked;
29
+ constructor(ctx: Context, id: string);
30
+ update(val: T | null): Series<T>;
31
+ /**
32
+ * update() for the series behind a history reference on an expression
33
+ * (`(close + 0)[3]`), which TradingView indexes by BAR: on a bar where the
34
+ * expression is not evaluated -- inside an `if` or `for` body -- it keeps
35
+ * its last value, and `[n]` reads n bars back in that carried series.
36
+ *
37
+ * The bars skipped since the last write are filled with that last value
38
+ * here, so `get` stays a plain lookup and no other series changes meaning.
39
+ * Before the first evaluation they stay holes, which read as na.
40
+ */
41
+ updateCarry(val: T | null): Series<T>;
42
+ get(offset: number): T | null;
43
+ /**
44
+ * Captures the mutable head state for live-tick rollback (P3).
45
+ * The buffer is referenced by length only — re-running the forming bar
46
+ * overwrites its single head index, so truncation restores prior content.
47
+ */
48
+ snapshotMeta(): SeriesSnapshot<T>;
49
+ /** Restores head state captured by snapshotMeta() (live-tick rollback). */
50
+ restoreTo(m: SeriesSnapshot<T>): void;
51
+ /**
52
+ * Primitive conversion.
53
+ * Allows "series + 1" to work if T is number.
54
+ */
55
+ valueOf(): T | null;
56
+ /**
57
+ * String representation.
58
+ * Allows template literals `${series}` to work.
59
+ */
60
+ toString(): string;
61
+ }