openpinescript 0.0.0-stage → 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 (103) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +346 -2
  3. package/dist/cli.mjs +108686 -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,318 @@
1
+ import { ParseTreeVisitor } from "antlr4ng";
2
+ import { Pine_scriptContext } from "./PineV1Parser.js";
3
+ import { StmtContext } from "./PineV1Parser.js";
4
+ import { Global_stmtContext } from "./PineV1Parser.js";
5
+ import { Global_stmt_contentContext } from "./PineV1Parser.js";
6
+ import { Fun_def_stmtContext } from "./PineV1Parser.js";
7
+ import { Fun_def_singlelineContext } from "./PineV1Parser.js";
8
+ import { Fun_def_multilineContext } from "./PineV1Parser.js";
9
+ import { Fun_headContext } from "./PineV1Parser.js";
10
+ import { Fun_body_singlelineContext } from "./PineV1Parser.js";
11
+ import { Local_stmt_singlelineContext } from "./PineV1Parser.js";
12
+ import { Local_stmt_contentContext } from "./PineV1Parser.js";
13
+ import { Loop_breakContext } from "./PineV1Parser.js";
14
+ import { Loop_continueContext } from "./PineV1Parser.js";
15
+ import { Fun_body_multilineContext } from "./PineV1Parser.js";
16
+ import { Local_stmts_multilineContext } from "./PineV1Parser.js";
17
+ import { Local_stmts_listContext } from "./PineV1Parser.js";
18
+ import { Local_stmt_multilineContext } from "./PineV1Parser.js";
19
+ import { Var_defContext } from "./PineV1Parser.js";
20
+ import { Var_defsContext } from "./PineV1Parser.js";
21
+ import { Ids_arrayContext } from "./PineV1Parser.js";
22
+ import { Arith_exprsContext } from "./PineV1Parser.js";
23
+ import { Arith_exprContext } from "./PineV1Parser.js";
24
+ import { If_exprContext } from "./PineV1Parser.js";
25
+ import { For_exprContext } from "./PineV1Parser.js";
26
+ import { Stmts_blockContext } from "./PineV1Parser.js";
27
+ import { Ternary_exprContext } from "./PineV1Parser.js";
28
+ import { Or_exprContext } from "./PineV1Parser.js";
29
+ import { And_exprContext } from "./PineV1Parser.js";
30
+ import { Eq_exprContext } from "./PineV1Parser.js";
31
+ import { Cmp_exprContext } from "./PineV1Parser.js";
32
+ import { Add_exprContext } from "./PineV1Parser.js";
33
+ import { Mult_exprContext } from "./PineV1Parser.js";
34
+ import { Unary_exprContext } from "./PineV1Parser.js";
35
+ import { Sqbr_exprContext } from "./PineV1Parser.js";
36
+ import { AtomContext } from "./PineV1Parser.js";
37
+ import { Fun_callContext } from "./PineV1Parser.js";
38
+ import { Fun_actual_argsContext } from "./PineV1Parser.js";
39
+ import { Pos_argsContext } from "./PineV1Parser.js";
40
+ import { Kw_argsContext } from "./PineV1Parser.js";
41
+ import { Kw_argContext } from "./PineV1Parser.js";
42
+ import { LiteralContext } from "./PineV1Parser.js";
43
+ import { Num_literalContext } from "./PineV1Parser.js";
44
+ import { Other_literalContext } from "./PineV1Parser.js";
45
+ import { IdContext } from "./PineV1Parser.js";
46
+ /**
47
+ * This interface defines a complete generic visitor for a parse tree produced
48
+ * by `PineV1Parser`.
49
+ *
50
+ * @param <Result> The return type of the visit operation. Use `void` for
51
+ * operations with no return type.
52
+ */
53
+ export declare class PineV1ParserVisitor<Result> extends ParseTreeVisitor<Result> {
54
+ /**
55
+ * Visit a parse tree produced by `PineV1Parser.pine_script`.
56
+ * @param ctx the parse tree
57
+ * @return the visitor result
58
+ */
59
+ visitPine_script?: (ctx: Pine_scriptContext) => Result;
60
+ /**
61
+ * Visit a parse tree produced by `PineV1Parser.stmt`.
62
+ * @param ctx the parse tree
63
+ * @return the visitor result
64
+ */
65
+ visitStmt?: (ctx: StmtContext) => Result;
66
+ /**
67
+ * Visit a parse tree produced by `PineV1Parser.global_stmt`.
68
+ * @param ctx the parse tree
69
+ * @return the visitor result
70
+ */
71
+ visitGlobal_stmt?: (ctx: Global_stmtContext) => Result;
72
+ /**
73
+ * Visit a parse tree produced by `PineV1Parser.global_stmt_content`.
74
+ * @param ctx the parse tree
75
+ * @return the visitor result
76
+ */
77
+ visitGlobal_stmt_content?: (ctx: Global_stmt_contentContext) => Result;
78
+ /**
79
+ * Visit a parse tree produced by `PineV1Parser.fun_def_stmt`.
80
+ * @param ctx the parse tree
81
+ * @return the visitor result
82
+ */
83
+ visitFun_def_stmt?: (ctx: Fun_def_stmtContext) => Result;
84
+ /**
85
+ * Visit a parse tree produced by `PineV1Parser.fun_def_singleline`.
86
+ * @param ctx the parse tree
87
+ * @return the visitor result
88
+ */
89
+ visitFun_def_singleline?: (ctx: Fun_def_singlelineContext) => Result;
90
+ /**
91
+ * Visit a parse tree produced by `PineV1Parser.fun_def_multiline`.
92
+ * @param ctx the parse tree
93
+ * @return the visitor result
94
+ */
95
+ visitFun_def_multiline?: (ctx: Fun_def_multilineContext) => Result;
96
+ /**
97
+ * Visit a parse tree produced by `PineV1Parser.fun_head`.
98
+ * @param ctx the parse tree
99
+ * @return the visitor result
100
+ */
101
+ visitFun_head?: (ctx: Fun_headContext) => Result;
102
+ /**
103
+ * Visit a parse tree produced by `PineV1Parser.fun_body_singleline`.
104
+ * @param ctx the parse tree
105
+ * @return the visitor result
106
+ */
107
+ visitFun_body_singleline?: (ctx: Fun_body_singlelineContext) => Result;
108
+ /**
109
+ * Visit a parse tree produced by `PineV1Parser.local_stmt_singleline`.
110
+ * @param ctx the parse tree
111
+ * @return the visitor result
112
+ */
113
+ visitLocal_stmt_singleline?: (ctx: Local_stmt_singlelineContext) => Result;
114
+ /**
115
+ * Visit a parse tree produced by `PineV1Parser.local_stmt_content`.
116
+ * @param ctx the parse tree
117
+ * @return the visitor result
118
+ */
119
+ visitLocal_stmt_content?: (ctx: Local_stmt_contentContext) => Result;
120
+ /**
121
+ * Visit a parse tree produced by `PineV1Parser.loop_break`.
122
+ * @param ctx the parse tree
123
+ * @return the visitor result
124
+ */
125
+ visitLoop_break?: (ctx: Loop_breakContext) => Result;
126
+ /**
127
+ * Visit a parse tree produced by `PineV1Parser.loop_continue`.
128
+ * @param ctx the parse tree
129
+ * @return the visitor result
130
+ */
131
+ visitLoop_continue?: (ctx: Loop_continueContext) => Result;
132
+ /**
133
+ * Visit a parse tree produced by `PineV1Parser.fun_body_multiline`.
134
+ * @param ctx the parse tree
135
+ * @return the visitor result
136
+ */
137
+ visitFun_body_multiline?: (ctx: Fun_body_multilineContext) => Result;
138
+ /**
139
+ * Visit a parse tree produced by `PineV1Parser.local_stmts_multiline`.
140
+ * @param ctx the parse tree
141
+ * @return the visitor result
142
+ */
143
+ visitLocal_stmts_multiline?: (ctx: Local_stmts_multilineContext) => Result;
144
+ /**
145
+ * Visit a parse tree produced by `PineV1Parser.local_stmts_list`.
146
+ * @param ctx the parse tree
147
+ * @return the visitor result
148
+ */
149
+ visitLocal_stmts_list?: (ctx: Local_stmts_listContext) => Result;
150
+ /**
151
+ * Visit a parse tree produced by `PineV1Parser.local_stmt_multiline`.
152
+ * @param ctx the parse tree
153
+ * @return the visitor result
154
+ */
155
+ visitLocal_stmt_multiline?: (ctx: Local_stmt_multilineContext) => Result;
156
+ /**
157
+ * Visit a parse tree produced by `PineV1Parser.var_def`.
158
+ * @param ctx the parse tree
159
+ * @return the visitor result
160
+ */
161
+ visitVar_def?: (ctx: Var_defContext) => Result;
162
+ /**
163
+ * Visit a parse tree produced by `PineV1Parser.var_defs`.
164
+ * @param ctx the parse tree
165
+ * @return the visitor result
166
+ */
167
+ visitVar_defs?: (ctx: Var_defsContext) => Result;
168
+ /**
169
+ * Visit a parse tree produced by `PineV1Parser.ids_array`.
170
+ * @param ctx the parse tree
171
+ * @return the visitor result
172
+ */
173
+ visitIds_array?: (ctx: Ids_arrayContext) => Result;
174
+ /**
175
+ * Visit a parse tree produced by `PineV1Parser.arith_exprs`.
176
+ * @param ctx the parse tree
177
+ * @return the visitor result
178
+ */
179
+ visitArith_exprs?: (ctx: Arith_exprsContext) => Result;
180
+ /**
181
+ * Visit a parse tree produced by `PineV1Parser.arith_expr`.
182
+ * @param ctx the parse tree
183
+ * @return the visitor result
184
+ */
185
+ visitArith_expr?: (ctx: Arith_exprContext) => Result;
186
+ /**
187
+ * Visit a parse tree produced by `PineV1Parser.if_expr`.
188
+ * @param ctx the parse tree
189
+ * @return the visitor result
190
+ */
191
+ visitIf_expr?: (ctx: If_exprContext) => Result;
192
+ /**
193
+ * Visit a parse tree produced by `PineV1Parser.for_expr`.
194
+ * @param ctx the parse tree
195
+ * @return the visitor result
196
+ */
197
+ visitFor_expr?: (ctx: For_exprContext) => Result;
198
+ /**
199
+ * Visit a parse tree produced by `PineV1Parser.stmts_block`.
200
+ * @param ctx the parse tree
201
+ * @return the visitor result
202
+ */
203
+ visitStmts_block?: (ctx: Stmts_blockContext) => Result;
204
+ /**
205
+ * Visit a parse tree produced by `PineV1Parser.ternary_expr`.
206
+ * @param ctx the parse tree
207
+ * @return the visitor result
208
+ */
209
+ visitTernary_expr?: (ctx: Ternary_exprContext) => Result;
210
+ /**
211
+ * Visit a parse tree produced by `PineV1Parser.or_expr`.
212
+ * @param ctx the parse tree
213
+ * @return the visitor result
214
+ */
215
+ visitOr_expr?: (ctx: Or_exprContext) => Result;
216
+ /**
217
+ * Visit a parse tree produced by `PineV1Parser.and_expr`.
218
+ * @param ctx the parse tree
219
+ * @return the visitor result
220
+ */
221
+ visitAnd_expr?: (ctx: And_exprContext) => Result;
222
+ /**
223
+ * Visit a parse tree produced by `PineV1Parser.eq_expr`.
224
+ * @param ctx the parse tree
225
+ * @return the visitor result
226
+ */
227
+ visitEq_expr?: (ctx: Eq_exprContext) => Result;
228
+ /**
229
+ * Visit a parse tree produced by `PineV1Parser.cmp_expr`.
230
+ * @param ctx the parse tree
231
+ * @return the visitor result
232
+ */
233
+ visitCmp_expr?: (ctx: Cmp_exprContext) => Result;
234
+ /**
235
+ * Visit a parse tree produced by `PineV1Parser.add_expr`.
236
+ * @param ctx the parse tree
237
+ * @return the visitor result
238
+ */
239
+ visitAdd_expr?: (ctx: Add_exprContext) => Result;
240
+ /**
241
+ * Visit a parse tree produced by `PineV1Parser.mult_expr`.
242
+ * @param ctx the parse tree
243
+ * @return the visitor result
244
+ */
245
+ visitMult_expr?: (ctx: Mult_exprContext) => Result;
246
+ /**
247
+ * Visit a parse tree produced by `PineV1Parser.unary_expr`.
248
+ * @param ctx the parse tree
249
+ * @return the visitor result
250
+ */
251
+ visitUnary_expr?: (ctx: Unary_exprContext) => Result;
252
+ /**
253
+ * Visit a parse tree produced by `PineV1Parser.sqbr_expr`.
254
+ * @param ctx the parse tree
255
+ * @return the visitor result
256
+ */
257
+ visitSqbr_expr?: (ctx: Sqbr_exprContext) => Result;
258
+ /**
259
+ * Visit a parse tree produced by `PineV1Parser.atom`.
260
+ * @param ctx the parse tree
261
+ * @return the visitor result
262
+ */
263
+ visitAtom?: (ctx: AtomContext) => Result;
264
+ /**
265
+ * Visit a parse tree produced by `PineV1Parser.fun_call`.
266
+ * @param ctx the parse tree
267
+ * @return the visitor result
268
+ */
269
+ visitFun_call?: (ctx: Fun_callContext) => Result;
270
+ /**
271
+ * Visit a parse tree produced by `PineV1Parser.fun_actual_args`.
272
+ * @param ctx the parse tree
273
+ * @return the visitor result
274
+ */
275
+ visitFun_actual_args?: (ctx: Fun_actual_argsContext) => Result;
276
+ /**
277
+ * Visit a parse tree produced by `PineV1Parser.pos_args`.
278
+ * @param ctx the parse tree
279
+ * @return the visitor result
280
+ */
281
+ visitPos_args?: (ctx: Pos_argsContext) => Result;
282
+ /**
283
+ * Visit a parse tree produced by `PineV1Parser.kw_args`.
284
+ * @param ctx the parse tree
285
+ * @return the visitor result
286
+ */
287
+ visitKw_args?: (ctx: Kw_argsContext) => Result;
288
+ /**
289
+ * Visit a parse tree produced by `PineV1Parser.kw_arg`.
290
+ * @param ctx the parse tree
291
+ * @return the visitor result
292
+ */
293
+ visitKw_arg?: (ctx: Kw_argContext) => Result;
294
+ /**
295
+ * Visit a parse tree produced by `PineV1Parser.literal`.
296
+ * @param ctx the parse tree
297
+ * @return the visitor result
298
+ */
299
+ visitLiteral?: (ctx: LiteralContext) => Result;
300
+ /**
301
+ * Visit a parse tree produced by `PineV1Parser.num_literal`.
302
+ * @param ctx the parse tree
303
+ * @return the visitor result
304
+ */
305
+ visitNum_literal?: (ctx: Num_literalContext) => Result;
306
+ /**
307
+ * Visit a parse tree produced by `PineV1Parser.other_literal`.
308
+ * @param ctx the parse tree
309
+ * @return the visitor result
310
+ */
311
+ visitOther_literal?: (ctx: Other_literalContext) => Result;
312
+ /**
313
+ * Visit a parse tree produced by `PineV1Parser.id`.
314
+ * @param ctx the parse tree
315
+ * @return the visitor result
316
+ */
317
+ visitId?: (ctx: IdContext) => Result;
318
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Pine Script v1 parser entry point — the base of the parser hierarchy.
3
+ *
4
+ * The parse procedure itself (wire up the token source, collect lexer AND parser
5
+ * diagnostics, run the entry rule) is identical for every version. It lives here
6
+ * as `createParser`, and each later version applies it to its own generated
7
+ * classes. See parser/v2/index.ts and parser/v3/index.ts.
8
+ */
9
+ import { CommonTokenStream, BaseErrorListener, Lexer, Parser } from "antlr4ng";
10
+ export interface ParserError {
11
+ line: number;
12
+ column: number;
13
+ message: string;
14
+ /** The parser's own text, when `message` was rewritten to say what is wrong. */
15
+ original?: string;
16
+ }
17
+ /**
18
+ * Collects diagnostics from either a lexer or a parser.
19
+ *
20
+ * The parameters are `any` because antlr4ng types this callback against the
21
+ * recogniser's ATN simulator, which differs between the two — one listener class
22
+ * cannot satisfy both signatures nominally, and only `line`/`column`/`msg` are
23
+ * read here.
24
+ */
25
+ export declare class ErrorCollector extends BaseErrorListener<any> {
26
+ errors: ParserError[];
27
+ syntaxError(recognizer: any, offendingSymbol: any, line: number, charPositionInLine: number, msg: string, e: any): void;
28
+ }
29
+ export interface ParseResult<TTree> {
30
+ tree: TTree;
31
+ errorCount: number;
32
+ errors: ParserError[];
33
+ }
34
+ /**
35
+ * Builds a `parse(source)` for one version, from that version's token source
36
+ * and parser. `entry` names the grammar's start rule.
37
+ */
38
+ export declare function createParser<TParser extends Parser, TTree>(TokenSourceCtor: new (input: any) => Lexer, ParserCtor: new (input: CommonTokenStream) => TParser, entry: (parser: TParser) => TTree): (source: string) => ParseResult<TTree>;
39
+ export declare const parse: (source: string) => ParseResult<import("./generated/PineV1Parser.js").Pine_scriptContext>;
@@ -0,0 +1,67 @@
1
+ import * as antlr from "antlr4ng";
2
+ export declare class PineV2Lexer extends antlr.Lexer {
3
+ static readonly BEGIN = 1;
4
+ static readonly END = 2;
5
+ static readonly LEND = 3;
6
+ static readonly ASSIGN = 4;
7
+ static readonly LBEG = 5;
8
+ static readonly IF_COND = 6;
9
+ static readonly IF_COND_ELSE = 7;
10
+ static readonly FOR_STMT = 8;
11
+ static readonly FOR_STMT_TO = 9;
12
+ static readonly FOR_STMT_BY = 10;
13
+ static readonly BREAK = 11;
14
+ static readonly CONTINUE = 12;
15
+ static readonly OR = 13;
16
+ static readonly AND = 14;
17
+ static readonly NOT = 15;
18
+ static readonly BOOL_LITERAL = 16;
19
+ static readonly COND = 17;
20
+ static readonly COND_ELSE = 18;
21
+ static readonly EQ = 19;
22
+ static readonly NEQ = 20;
23
+ static readonly GT = 21;
24
+ static readonly GE = 22;
25
+ static readonly LT = 23;
26
+ static readonly LE = 24;
27
+ static readonly PLUS = 25;
28
+ static readonly MINUS = 26;
29
+ static readonly MUL = 27;
30
+ static readonly DIV = 28;
31
+ static readonly MOD = 29;
32
+ static readonly DEFINE = 30;
33
+ static readonly ARROW = 31;
34
+ static readonly COMMA = 32;
35
+ static readonly LPAR = 33;
36
+ static readonly RPAR = 34;
37
+ static readonly LSQBR = 35;
38
+ static readonly RSQBR = 36;
39
+ static readonly INT_LITERAL = 37;
40
+ static readonly FLOAT_LITERAL = 38;
41
+ static readonly STR_LITERAL = 39;
42
+ static readonly COLOR_LITERAL = 40;
43
+ static readonly ID = 41;
44
+ static readonly WS = 42;
45
+ static readonly LINE_COMMENT = 43;
46
+ static readonly BLOCK_COMMENT = 44;
47
+ static readonly DOT = 45;
48
+ static readonly channelNames: string[];
49
+ static readonly literalNames: string[];
50
+ static readonly symbolicNames: string[];
51
+ static readonly modeNames: string[];
52
+ static readonly ruleNames: string[];
53
+ constructor(input: antlr.CharStream);
54
+ get grammarFileName(): string;
55
+ get literalNames(): (string | null)[];
56
+ get symbolicNames(): (string | null)[];
57
+ get ruleNames(): string[];
58
+ get serializedATN(): number[];
59
+ get channelNames(): string[];
60
+ get modeNames(): string[];
61
+ static readonly _serializedATN: number[];
62
+ private static __ATN;
63
+ static get _ATN(): antlr.ATN;
64
+ private static readonly vocabulary;
65
+ get vocabulary(): antlr.Vocabulary;
66
+ private static readonly decisionsToDFA;
67
+ }