@guihz/trading-vue-editor-tes 0.0.301 → 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 (167) hide show
  1. package/lib/assets/editor.worker-BxEYBjj-.js +7352 -0
  2. package/lib/assets/parserTccWorker-D5cq4N-Y.js +80540 -0
  3. package/lib/assets/scriptsRunWorker-CaEvEpNA.js +37748 -0
  4. package/lib/components/diffEditor/index.d.ts +1 -0
  5. package/lib/components/editor/config/monarchTokens.d.ts +2 -4
  6. package/lib/components/editor/constants/common.d.ts +38 -0
  7. package/lib/components/editor/constants/locals.d.ts +1 -0
  8. package/lib/components/editor/index.d.ts +1 -0
  9. package/lib/components/editor/tokenizer/utils.d.ts +0 -16
  10. package/lib/components/editor/type/index.d.ts +32 -1
  11. package/lib/components/editor/utils/completions.d.ts +3 -1
  12. package/lib/components/editor/utils/importLibrary.d.ts +2 -160
  13. package/lib/components/editor/utils/initEditor.d.ts +3 -0
  14. package/lib/components/editor/utils/parse.d.ts +2 -0
  15. package/lib/components/editor/utils/parserTccWorker.d.ts +1 -7
  16. package/lib/components/editor/utils/scriptsRunWorker.d.ts +1 -1
  17. package/lib/components/editor/utils/signatureHelp.d.ts +2 -0
  18. package/lib/components/editor/utils/tools.d.ts +6 -0
  19. package/lib/components/editor/v3/config/monarchTokens.d.ts +3 -0
  20. package/lib/components/editor/v3/constants/contents_zh.d.ts +6 -0
  21. package/lib/components/editor/{constants/contents.d.ts → v3/constants/index.d.ts} +1 -5
  22. package/lib/components/editor/v3/parseScript/buildInConstants.d.ts +179 -0
  23. package/lib/components/editor/v3/parseScript/buildInFuncNamespace/index.d.ts +9 -0
  24. package/lib/components/editor/v3/parseScript/buildInFuncNamespace/input.d.ts +43 -0
  25. package/lib/components/editor/v3/parseScript/buildInFuncNamespace/math.d.ts +50 -0
  26. package/lib/components/editor/v3/parseScript/buildInFuncNamespace/strategy.d.ts +243 -0
  27. package/lib/components/editor/v3/parseScript/buildInFuncNamespace/ta.d.ts +102 -0
  28. package/lib/components/editor/{parseScript → v3/parseScript}/buildInFuncNamespace/timeframe.d.ts +1 -1
  29. package/lib/components/editor/v3/parseScript/buildInVarNamespace/barstate.d.ts +19 -0
  30. package/lib/components/editor/v3/parseScript/buildInVarNamespace/index.d.ts +4 -0
  31. package/lib/components/editor/v3/parseScript/buildInVarNamespace/strategy.d.ts +126 -0
  32. package/lib/components/editor/v3/parseScript/buildInVarNamespace/syminfo.d.ts +22 -0
  33. package/lib/components/editor/v3/parseScript/buildInVarNamespace/ta.d.ts +17 -0
  34. package/lib/components/editor/v3/parseScript/buildInVariables.d.ts +96 -0
  35. package/lib/components/editor/v3/parseScript/constants.d.ts +119 -0
  36. package/lib/components/editor/v3/parseScript/enum.d.ts +283 -0
  37. package/lib/components/editor/v3/parseScript/parseToJs.d.ts +65 -0
  38. package/lib/components/editor/v3/parseScript/runType.d.ts +119 -0
  39. package/lib/components/editor/v3/parseScript/strategyNamespace/index.d.ts +2 -0
  40. package/lib/components/editor/{parseScript → v3/parseScript}/type.d.ts +1 -1
  41. package/lib/components/editor/v3/parseScript/utils.d.ts +21 -0
  42. package/lib/components/editor/v3/parseScript/visitorParser.d.ts +321 -0
  43. package/lib/components/editor/v3/parseScript/visitorUtils.d.ts +25 -0
  44. package/lib/components/editor/v3/parserTccWorker.d.ts +32 -0
  45. package/lib/components/editor/v3/scriptsRunWorker.d.ts +11 -0
  46. package/lib/{tccParser → components/editor/v3/tccParser}/LexerBase.d.ts +1 -1
  47. package/lib/components/editor/v3/tccParser/tccScriptParserVisitor.d.ts +359 -0
  48. package/lib/components/editor/v4/config/monarchTokens.d.ts +205 -0
  49. package/lib/components/editor/v4/constants/contents_zh.d.ts +6 -0
  50. package/lib/components/editor/v4/constants/index.d.ts +44 -0
  51. package/lib/components/editor/v4/parseScript/buildInConstants.d.ts +308 -0
  52. package/lib/components/editor/v4/parseScript/buildInFuncNamespace/array.d.ts +84 -0
  53. package/lib/components/editor/v4/parseScript/buildInFuncNamespace/box.d.ts +60 -0
  54. package/lib/components/editor/v4/parseScript/buildInFuncNamespace/errorListener.d.ts +9 -0
  55. package/lib/components/editor/v4/parseScript/buildInFuncNamespace/index.d.ts +17 -0
  56. package/lib/components/editor/v4/parseScript/buildInFuncNamespace/input.d.ts +44 -0
  57. package/lib/components/editor/v4/parseScript/buildInFuncNamespace/label.d.ts +61 -0
  58. package/lib/components/editor/v4/parseScript/buildInFuncNamespace/line.d.ts +62 -0
  59. package/lib/components/editor/v4/parseScript/buildInFuncNamespace/math.d.ts +50 -0
  60. package/lib/components/editor/v4/parseScript/buildInFuncNamespace/strategy.d.ts +244 -0
  61. package/lib/components/editor/v4/parseScript/buildInFuncNamespace/string.d.ts +38 -0
  62. package/lib/components/editor/v4/parseScript/buildInFuncNamespace/ta.d.ts +118 -0
  63. package/lib/components/editor/v4/parseScript/buildInFuncNamespace/table.d.ts +87 -0
  64. package/lib/components/editor/v4/parseScript/buildInFuncNamespace/timeframe.d.ts +22 -0
  65. package/lib/components/editor/{parseScript → v4/parseScript}/buildInVarNamespace/barstate.d.ts +1 -1
  66. package/lib/components/editor/v4/parseScript/buildInVarNamespace/index.d.ts +8 -0
  67. package/lib/components/editor/v4/parseScript/buildInVarNamespace/strategy.d.ts +126 -0
  68. package/lib/components/editor/v4/parseScript/buildInVarNamespace/syminfo.d.ts +18 -0
  69. package/lib/components/editor/v4/parseScript/buildInVarNamespace/ta.d.ts +34 -0
  70. package/lib/components/editor/{parseScript → v4/parseScript}/constants.d.ts +1 -160
  71. package/lib/components/editor/v4/parseScript/constantsRun.d.ts +3 -0
  72. package/lib/components/editor/v4/parseScript/enum.d.ts +282 -0
  73. package/lib/components/editor/v4/parseScript/parseToJs.d.ts +65 -0
  74. package/lib/components/editor/v4/parseScript/strategyNamespace/index.d.ts +2 -0
  75. package/lib/components/editor/v4/parseScript/strategyNamespace/risk.d.ts +22 -0
  76. package/lib/components/editor/v4/parseScript/type.d.ts +39 -0
  77. package/lib/components/editor/v4/parseScript/utils.d.ts +21 -0
  78. package/lib/components/editor/v4/parseScript/visitorParser.d.ts +323 -0
  79. package/lib/components/editor/v4/parseScript/visitorUtils.d.ts +29 -0
  80. package/lib/components/editor/v4/parserTccWorker.d.ts +32 -0
  81. package/lib/components/editor/v4/scriptsRunWorker.d.ts +11 -0
  82. package/lib/components/editor/v4/tccParser/LexerBase.d.ts +19 -0
  83. package/lib/components/editor/v4/tccParser/tccScriptParserVisitor.d.ts +401 -0
  84. package/lib/components/editor/v5/config/monarchTokens.d.ts +205 -0
  85. package/lib/components/editor/v5/constants/contents_en.d.ts +6 -0
  86. package/lib/components/editor/{constants → v5/constants}/contents_zh.d.ts +1 -1
  87. package/lib/components/editor/v5/constants/index.d.ts +41 -0
  88. package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/box.d.ts +1 -1
  89. package/lib/components/editor/v5/parseScript/buildInFuncNamespace/color.d.ts +25 -0
  90. package/lib/components/editor/v5/parseScript/buildInFuncNamespace/errorListener.d.ts +9 -0
  91. package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/label.d.ts +1 -1
  92. package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/line.d.ts +1 -1
  93. package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/linefill.d.ts +1 -1
  94. package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/log.d.ts +1 -1
  95. package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/map.d.ts +1 -1
  96. package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/math.d.ts +1 -1
  97. package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/polyline.d.ts +1 -1
  98. package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/strategy.d.ts +1 -1
  99. package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/ta.d.ts +1 -1
  100. package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/table.d.ts +1 -1
  101. package/lib/components/editor/v5/parseScript/buildInFuncNamespace/timeframe.d.ts +22 -0
  102. package/lib/components/editor/v5/parseScript/buildInVarNamespace/barstate.d.ts +22 -0
  103. package/lib/components/editor/{parseScript → v5/parseScript}/buildInVarNamespace/chart.d.ts +1 -1
  104. package/lib/components/editor/v5/parseScript/buildInVarNamespace/dividends.d.ts +8 -0
  105. package/lib/components/editor/v5/parseScript/buildInVarNamespace/earnings.d.ts +9 -0
  106. package/lib/components/editor/v5/parseScript/buildInVarNamespace/session.d.ts +12 -0
  107. package/lib/components/editor/{parseScript → v5/parseScript}/buildInVarNamespace/strategy.d.ts +1 -1
  108. package/lib/components/editor/{parseScript → v5/parseScript}/buildInVarNamespace/syminfo.d.ts +1 -1
  109. package/lib/components/editor/{parseScript → v5/parseScript}/buildInVarNamespace/ta.d.ts +4 -3
  110. package/lib/components/editor/v5/parseScript/buildInVarNamespace/timeframe.d.ts +16 -0
  111. package/lib/components/editor/v5/parseScript/constants.d.ts +124 -0
  112. package/lib/components/editor/v5/parseScript/constantsRun.d.ts +3 -0
  113. package/lib/components/editor/{parseScript → v5/parseScript}/parseToJs.d.ts +1 -1
  114. package/lib/components/editor/{parseScript → v5/parseScript}/parseToLibJs.d.ts +1 -1
  115. package/lib/components/editor/v5/parseScript/strategyNamespace/risk.d.ts +22 -0
  116. package/lib/components/editor/v5/parseScript/type.d.ts +39 -0
  117. package/lib/components/editor/{parseScript → v5/parseScript}/userTypeClass.d.ts +1 -1
  118. package/lib/components/editor/{parseScript → v5/parseScript}/utils.d.ts +1 -1
  119. package/lib/components/editor/{parseScript → v5/parseScript}/visitorParser.d.ts +1 -1
  120. package/lib/components/editor/{parseScript → v5/parseScript}/visitorUtils.d.ts +2 -2
  121. package/lib/components/editor/v5/parserTccWorker.d.ts +40 -0
  122. package/lib/components/editor/v5/scriptsRunWorker.d.ts +11 -0
  123. package/lib/components/editor/v5/tccParser/LexerBase.d.ts +19 -0
  124. package/lib/{tccParser → components/editor/v5/tccParser}/tccScriptParserVisitor.d.ts +1 -1
  125. package/lib/components/referenceManual/components/ContentItem.d.ts +2 -0
  126. package/lib/components/referenceManual/index.d.ts +2 -0
  127. package/lib/components/referenceManualPage/components/ContentItem.d.ts +1 -0
  128. package/lib/components/referenceManualPage/components/ManualLeft.d.ts +5 -0
  129. package/lib/components/referenceManualPage/index.d.ts +2 -0
  130. package/lib/index-Ce2gRdFk.js +12813 -0
  131. package/lib/index-CjECfhIW.js +28088 -0
  132. package/lib/index-UdtfRBFV.js +59792 -0
  133. package/lib/monarchTokens-Cj3v8l0Q.js +526 -0
  134. package/lib/monarchTokens-CnFYyHnR.js +191 -0
  135. package/lib/monarchTokens-oh3fO2YY.js +563 -0
  136. package/lib/packages/index.d.ts +3 -3
  137. package/lib/trading-vue-editor.es.packages.js +6356 -66629
  138. package/lib/trading-vue-editor.umd.packages.mjs +117 -75
  139. package/lib/utils/tools.d.ts +7 -2
  140. package/package.json +1 -1
  141. package/lib/assets/editor.worker-CT5Cb1wO.js +0 -11
  142. package/lib/assets/parserTccWorker-cjv11J0f.js +0 -279
  143. package/lib/assets/scriptsRunWorker-C5pVAsLn.js +0 -91
  144. /package/lib/components/editor/{parseScript → v3/parseScript}/buildInFuncNamespace/errorListener.d.ts +0 -0
  145. /package/lib/components/editor/{parseScript → v3/parseScript}/constantsRun.d.ts +0 -0
  146. /package/lib/components/editor/{parseScript → v3/parseScript}/strategyNamespace/risk.d.ts +0 -0
  147. /package/lib/components/editor/{parseScript → v4/parseScript}/buildInFuncNamespace/color.d.ts +0 -0
  148. /package/lib/components/editor/{parseScript → v4/parseScript}/buildInVarNamespace/dividends.d.ts +0 -0
  149. /package/lib/components/editor/{parseScript → v4/parseScript}/buildInVarNamespace/earnings.d.ts +0 -0
  150. /package/lib/components/editor/{parseScript → v4/parseScript}/buildInVarNamespace/session.d.ts +0 -0
  151. /package/lib/components/editor/{parseScript → v4/parseScript}/buildInVarNamespace/timeframe.d.ts +0 -0
  152. /package/lib/components/editor/{constants → v5/constants}/newContents_en.d.ts +0 -0
  153. /package/lib/components/editor/{constants → v5/constants}/newContents_zh.d.ts +0 -0
  154. /package/lib/components/editor/{parseScript → v5/parseScript}/buildInConstants.d.ts +0 -0
  155. /package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/array.d.ts +0 -0
  156. /package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/chartPoint.d.ts +0 -0
  157. /package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/index.d.ts +0 -0
  158. /package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/input.d.ts +0 -0
  159. /package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/matrix.d.ts +0 -0
  160. /package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/runtime.d.ts +0 -0
  161. /package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/string.d.ts +0 -0
  162. /package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/syminfo.d.ts +0 -0
  163. /package/lib/components/editor/{parseScript → v5/parseScript}/buildInVarNamespace/index.d.ts +0 -0
  164. /package/lib/components/editor/{parseScript → v5/parseScript}/enum.d.ts +0 -0
  165. /package/lib/components/editor/{parseScript → v5/parseScript}/strategyNamespace/closedtrades.d.ts +0 -0
  166. /package/lib/components/editor/{parseScript → v5/parseScript}/strategyNamespace/index.d.ts +0 -0
  167. /package/lib/components/editor/{parseScript → v5/parseScript}/strategyNamespace/opentrades.d.ts +0 -0
@@ -0,0 +1,21 @@
1
+ import { IKeyValue } from "../../type";
2
+ import { TccErrorListener } from "./buildInFuncNamespace";
3
+ import moment from 'moment-timezone';
4
+ export declare function replaceTemplate(template: string, replacements: IKeyValue): string;
5
+ export declare function parsePerid(period: string): (string | number)[];
6
+ export declare function periodTransform(period: string): string;
7
+ export declare function generateRandomId(length?: number): string;
8
+ export declare function parseTimezoneOffset(timezone: string): number;
9
+ export declare function parserTimezone(time?: any, timezone?: string): moment.Moment;
10
+ export declare function parserTimeStamp(time?: any, timezone?: string): number;
11
+ export declare function periodConvert(period: string, time: number): number;
12
+ export declare function isNotNum(num?: number): boolean;
13
+ export declare function argColorsHandle(args: any, colors: string[]): void;
14
+ export declare function encode(str: string): string;
15
+ export declare function decode(base64: string): string;
16
+ export declare function decimalTrunc(num: number, len: number): number;
17
+ export declare function decimalCeil(num?: number, precision?: number): number | undefined;
18
+ export declare function decimalFloor(num?: number, precision?: number): number | undefined;
19
+ export declare function parsePeriodHandle(period?: string): string;
20
+ export declare function transformPeriod(period: string): string;
21
+ export declare function addRequestUseFuncError(errorListener: TccErrorListener, funcName: string, reqName: string, posStr: string): void;
@@ -0,0 +1,321 @@
1
+ import { IKeyObjectValue, IDocValue, IKeyValue } from '../../type';
2
+ import { VRuleType } from './enum';
3
+ import { ParserUtils } from './visitorUtils';
4
+ import { IError, IPosition } from "./type";
5
+ export default class ParserVisitor extends ParserUtils {
6
+ private _loopCount;
7
+ private _errors;
8
+ private _variables;
9
+ private _functions;
10
+ private _methods;
11
+ private _types;
12
+ private _enums;
13
+ private _currentBlockVars;
14
+ private _currentFuncParams;
15
+ private _isNeedCalc;
16
+ private _blockCount;
17
+ private _isInFunc;
18
+ private _onlyStatementsCount;
19
+ private _blockRanges;
20
+ private _overloadsFuncs;
21
+ private _hasMemberIndex;
22
+ private _comments;
23
+ private _isInLocalScop;
24
+ private _hasDrawFunc;
25
+ private _hasCreateOrderFunc;
26
+ private _scriptType?;
27
+ private _description;
28
+ private _endExport;
29
+ private _isEndExpr?;
30
+ private _inputVarName?;
31
+ private _hasRequest?;
32
+ private _strategyFuncName?;
33
+ private _strategyVarName?;
34
+ private _isSeriesCondition?;
35
+ private _importLibs;
36
+ private _isMember?;
37
+ private _memberErrors;
38
+ constructor(props: IKeyObjectValue, comments: IKeyObjectValue[]);
39
+ get overloadsFuncs(): IKeyValue[];
40
+ get errors(): IError[];
41
+ get userEnums(): Map<string, IDocValue[]>;
42
+ get userTypes(): Map<string, IDocValue[]>;
43
+ get userFunctions(): Map<string, IDocValue[]>;
44
+ get userVariables(): Map<string, IDocValue[]>;
45
+ get userMethods(): Map<string, IDocValue[]>;
46
+ get hasUseDrawFunc(): boolean;
47
+ get hasUseCreateOrderFunc(): boolean;
48
+ get scriptType(): string | undefined;
49
+ get description(): string;
50
+ get exportPositions(): any;
51
+ get endExport(): IKeyObjectValue;
52
+ get imports(): Map<string, IKeyObjectValue>;
53
+ visitProgram: (ctx: IKeyObjectValue) => Promise<any[]>;
54
+ visitGlobalStmt: (ctx: IKeyObjectValue) => Promise<any>;
55
+ visitBlockStmt: (ctx: IKeyObjectValue) => IKeyObjectValue[];
56
+ visitStmt: (ctx: IKeyObjectValue) => any;
57
+ visitSimpleStmt: (ctx: IKeyObjectValue) => any;
58
+ visitFlowStmt: (ctx: IKeyObjectValue) => {
59
+ ruleType: VRuleType;
60
+ value: any;
61
+ };
62
+ visitBlock: (ctx: IKeyObjectValue) => any;
63
+ visitBlockLine: (ctx: IKeyObjectValue) => any[] | null;
64
+ private _memberErrorsHandle;
65
+ visitVariableDeclarationStmt: (ctx: IKeyObjectValue) => IKeyObjectValue[];
66
+ visitDeclareAssign: (ctx: IKeyObjectValue) => IKeyObjectValue;
67
+ visitAgainAssign: (ctx: IKeyObjectValue) => {
68
+ ruleType: VRuleType;
69
+ name: IKeyObjectValue;
70
+ operator: string;
71
+ type: string;
72
+ value: IKeyObjectValue;
73
+ } | null;
74
+ private _verifyGloablVar;
75
+ visitBlockSequence: (ctx: IKeyObjectValue) => IKeyObjectValue[];
76
+ visitExpressionSequence: (ctx: IKeyObjectValue) => IKeyObjectValue[];
77
+ visitExpressionBlockSequence: (ctx: IKeyObjectValue) => IKeyObjectValue[];
78
+ visitVarBlockStmt: (ctx: IKeyObjectValue) => IKeyObjectValue | {
79
+ ruleType: VRuleType;
80
+ name: IKeyObjectValue;
81
+ operator: string;
82
+ type: string;
83
+ value: IKeyObjectValue;
84
+ };
85
+ /**
86
+ * 解析注释
87
+ *
88
+ * 该方法用于解析给定行号和类型条件下的注释文本,生成一个对象,对象的键是注释的类型,值是与该类型注释相关的描述文本。
89
+ * 支持解析多行注释,并可以区分不同级别的注释键和子项。
90
+ *
91
+ * @param line 当前行号,用于筛选注释行
92
+ * @param types 需要解析的注释类型数组
93
+ * @param supportMulLines 同一类型是否支持多行注释的解析,默认为false
94
+ * @returns 返回一个对象,包含解析后的注释信息
95
+ */
96
+ private _commentsParser;
97
+ visitVarSingle: (ctx: IKeyObjectValue) => IKeyObjectValue;
98
+ visitVarMultiple: (ctx: IKeyObjectValue) => {
99
+ ruleType: VRuleType;
100
+ names: string[];
101
+ posList: IPosition[];
102
+ };
103
+ visitBlockExpression: (ctx: IKeyObjectValue) => any;
104
+ visitParenthesizedExpression: (ctx: IKeyObjectValue) => {
105
+ ruleType: VRuleType;
106
+ type: any;
107
+ ctx: IKeyObjectValue;
108
+ exprs: any;
109
+ };
110
+ visitAdditiveExpression: (ctx: IKeyObjectValue) => IKeyObjectValue;
111
+ visitRelationalExpression: (ctx: IKeyObjectValue) => {
112
+ ruleType: VRuleType;
113
+ operator: string;
114
+ ctx: IKeyObjectValue;
115
+ type: string;
116
+ exprs: IKeyObjectValue[];
117
+ };
118
+ visitEqualityExpression: (ctx: IKeyObjectValue) => {
119
+ ruleType: VRuleType;
120
+ operator: string;
121
+ ctx: IKeyObjectValue;
122
+ type: string;
123
+ exprs: IKeyObjectValue[];
124
+ };
125
+ visitTernaryExpression: (ctx: IKeyObjectValue) => {
126
+ ruleType: VRuleType;
127
+ type: string;
128
+ ctx: IKeyObjectValue;
129
+ exprs: IKeyObjectValue[];
130
+ };
131
+ visitNameExpression: (ctx: IKeyObjectValue) => any;
132
+ visitLiteralExpression: (ctx: IKeyObjectValue) => any;
133
+ visitUnaryExpression: (ctx: IKeyObjectValue) => {
134
+ ruleType: VRuleType;
135
+ operator: any;
136
+ type: any;
137
+ ctx: IKeyObjectValue;
138
+ exprs: IKeyObjectValue[];
139
+ };
140
+ visitNotExpression: (ctx: IKeyObjectValue) => {
141
+ ruleType: VRuleType;
142
+ ctx: IKeyObjectValue;
143
+ type: string;
144
+ exprs: IKeyObjectValue[];
145
+ };
146
+ visitMemberIndexExpression: (ctx: IKeyObjectValue) => {
147
+ ruleType: VRuleType;
148
+ type: any;
149
+ ctx: IKeyObjectValue;
150
+ isInFunc: boolean;
151
+ exprs: IKeyObjectValue[];
152
+ };
153
+ visitMethodStmt: (ctx: IKeyObjectValue) => {
154
+ ruleType: VRuleType;
155
+ types: any;
156
+ ctx: IKeyObjectValue;
157
+ type: any;
158
+ exprs: any[];
159
+ };
160
+ private _inputFuncTitleVerify;
161
+ visitMethodExpression: (ctx: IKeyObjectValue) => any;
162
+ visitLogicalAndExpression: (ctx: IKeyObjectValue) => {
163
+ ruleType: VRuleType;
164
+ type: string;
165
+ operator: string;
166
+ ctx: IKeyObjectValue;
167
+ exprs: IKeyObjectValue[];
168
+ };
169
+ visitLogicalOrExpression: (ctx: IKeyObjectValue) => {
170
+ ruleType: VRuleType;
171
+ operator: string;
172
+ ctx: IKeyObjectValue;
173
+ type: string;
174
+ exprs: IKeyObjectValue[];
175
+ };
176
+ visitMultiplicativeExpression: (ctx: IKeyObjectValue) => {
177
+ ruleType: VRuleType;
178
+ operator: string;
179
+ ctx: IKeyObjectValue;
180
+ type: string;
181
+ exprs: IKeyObjectValue[];
182
+ };
183
+ visitBrackethesized: (ctx: IKeyObjectValue) => {
184
+ ruleType: VRuleType;
185
+ ctx: IKeyObjectValue;
186
+ exprs: any;
187
+ };
188
+ visitArguments: (ctx: IKeyObjectValue) => IKeyObjectValue;
189
+ visitArgument: (ctx: IKeyObjectValue) => any;
190
+ visitIfStatement: (ctx: IKeyObjectValue) => IKeyObjectValue;
191
+ private _verifyIf;
192
+ visitForToStatement: (ctx: IKeyObjectValue) => IKeyObjectValue;
193
+ private _forToNameHandle;
194
+ private _verifyForTo;
195
+ visitLiteral: (ctx: IKeyObjectValue) => {
196
+ ruleType: VRuleType;
197
+ ctx: IKeyObjectValue;
198
+ type: string;
199
+ value: any;
200
+ };
201
+ visitMethodElement: (ctx: IKeyObjectValue) => {
202
+ name: any;
203
+ type: any;
204
+ args: any;
205
+ expr: any;
206
+ };
207
+ visitMethodName: (ctx: IKeyObjectValue) => (string | IKeyObjectValue[])[];
208
+ visitArrowFunction: (ctx: IKeyObjectValue) => IKeyObjectValue;
209
+ visitArrowFunctionParameters: (ctx: IKeyObjectValue) => IKeyObjectValue[];
210
+ visitFormalParameterList: (ctx: IKeyObjectValue) => IKeyObjectValue[];
211
+ private _exportArgsTypeVerify;
212
+ visitAssignmentOperator: (ctx: IKeyObjectValue) => any;
213
+ visitIdentifier: (ctx: IKeyObjectValue) => any;
214
+ visitName: (ctx: IKeyObjectValue) => IKeyObjectValue;
215
+ private _nameHandle;
216
+ private _memberIndexVerify;
217
+ private _setFuncParams;
218
+ private _pushBlockRanges;
219
+ private _againAssignHandle;
220
+ private _getBuildVar;
221
+ private _verifyName;
222
+ private _nameCheck;
223
+ private _inBlock;
224
+ private _errorHandle;
225
+ private _boolTypeJudge;
226
+ private _calcTypeJudge;
227
+ private _typeJudge;
228
+ /**
229
+ * 判断数组中的对象类型是否一致,支持根据操作符和指定的类型集合对类型进行动态判断和调整。
230
+ * @param arr - 用于判断类型的对象数组
231
+ * @param children - 与 arr 对应的子对象数组,用于在类型不匹配时进行错误处理
232
+ * @param operator - 当前操作符,影响类型判断的逻辑
233
+ * @param supportTypes - 支持的类型数组,会根据操作符动态调整
234
+ * @returns 返回一个数组,包含每个对象根据判断逻辑确定的类型
235
+ */
236
+ private _sameTypeJudge;
237
+ private _getUserVar;
238
+ private _repeatVarJudge;
239
+ private _judgeVarBuildIn;
240
+ private _updateUserVar;
241
+ private _variablesHandle;
242
+ private _checkVarMultiple;
243
+ private _addVarToMap;
244
+ private _setVariablesMap;
245
+ private _varTypeJudge;
246
+ private _getAllowTypes;
247
+ private _setFunc;
248
+ private _verifyFuncRepeat;
249
+ private _getMethodTypes;
250
+ private _globalFuncVerify;
251
+ private _hasMemberIndexVerify;
252
+ /**
253
+ * 根据函数参数和上下文获取内置返回类型。
254
+ * @param res 函数匹配结果数组,包含返回类型、语法和参数信息。
255
+ * @param args 函数调用时的实际参数对象。
256
+ * @param name 函数名,用于错误处理时的提示。
257
+ * @param ctx 函数调用的上下文对象。
258
+ * @param fArg 函数的首个特定参数,可选,用于某些特殊场景下的类型检查。
259
+ * @param type 预期的返回类型数组,可选,用于进一步筛选返回类型。
260
+ * @returns 返回可能的返回类型数组。可能是一个确定的类型数组,或者在类型不匹配时返回[VType.UNDETERMINED]。
261
+ */
262
+ private _getBuildInReturnTypes;
263
+ /**
264
+ * 根据提供的函数列表和当前参数,获取匹配的函数返回类型。
265
+ * @param funcs 函数列表,每个函数包含参数信息、返回类型、函数名和this类型。
266
+ * @param currentArgs 当前调用的参数对象。
267
+ * @param ctx 当前上下文对象,包含代码位置等信息。
268
+ * @param fArg 可选,指定的首个参数,用于重载判断。
269
+ * @returns 匹配的函数返回类型,如果没有匹配则返回'UNDETERMINED'。
270
+ */
271
+ private _overloadsFuncGetTypes;
272
+ private _funcArgsAddOriginName;
273
+ /**
274
+ * 检查函数参数数量和类型是否符合预期
275
+ * @param args 提供的参数对象,包含实际参数和参数对象
276
+ * @param originArgs 预期的参数列表
277
+ * @param name 函数名称
278
+ * @param ctx 上下文信息,用于错误定位
279
+ * @param firstArg 第一个参数的对象,用于某些特定的参数检查
280
+ * @returns 返回一个对象,包含错误信息和警告信息
281
+ */
282
+ private _overloadsCheckArgs;
283
+ /**
284
+ * 检查传入参数的数量和类型是否符合预期
285
+ * @param args 包含所有参数的对象
286
+ * @param originArgs 原始参数列表
287
+ * @param name 函数或方法的名称
288
+ * @param ctx 上下文信息,用于错误处理
289
+ * @param returnType 函数预期的返回类型
290
+ * @param firstArg 第一个参数的详细信息,可选
291
+ * @returns 返回一个对象,包含是否有错误和可能的类型信息
292
+ */
293
+ private _checkArgs;
294
+ /**
295
+ * 校验参数是否符合给定的规则。
296
+ * @param arg 需要校验的参数对象,包含参数的规则类型、表达式和名称等信息。
297
+ * @param originArg 原始参数对象,包含参数的允许类型ID、显示类型和名称等信息。
298
+ * @param name 参数的当前名称。
299
+ * @param firstArg 如果是重载函数,第一个参数的对象。
300
+ * @param ctx 参数的上下文信息,可选。
301
+ * @param isOverloads 是否为重载函数的标志,可选。
302
+ * @returns 如果参数校验通过,返回true;否则返回false。
303
+ */
304
+ private _checkArg;
305
+ /**
306
+ * 将键值对对象转换为检查对象,用于验证参数类型是否匹配
307
+ * @param arg 要检查的键值对对象,包含规则类型和表达式数组
308
+ * @param originArg 原始参数对象,包含参数名和允许的类型ID
309
+ * @param needType 需要检查的类型数组
310
+ * @param name 操作符名称
311
+ * @param type 当前参数的类型
312
+ * @returns 如果类型不匹配,返回错误提示字符串;否则,返回undefined
313
+ */
314
+ private _tupleToCheck;
315
+ /**
316
+ * 获取块的返回类型
317
+ * @param block 可以是单个对象或者对象数组,代表一个代码块
318
+ * @returns 返回一个类型数组,表示该代码块可能的返回类型
319
+ */
320
+ private _getBlockReturnTypes;
321
+ }
@@ -0,0 +1,25 @@
1
+ import { IDocValue, IKeyObjectValue } from "../../type";
2
+ import TccScriptParserVisitor from '../tccParser/tccScriptParserVisitor';
3
+ export declare class ParserUtils extends TccScriptParserVisitor<any> {
4
+ protected _buildinVariables: Map<string, IDocValue[]>;
5
+ protected _buildinTypes: Map<string, IDocValue[]>;
6
+ protected _buildinConstants: Map<string, IDocValue[]>;
7
+ protected _buildinMethods: Map<string, IDocValue[]>;
8
+ protected _buildinFunctions: Map<string, IDocValue[]>;
9
+ constructor(buildinObj: IKeyObjectValue);
10
+ private _buildinHandle;
11
+ protected _typeHandle(types?: string[], rType?: string): string;
12
+ protected _returnTypesOtherHandle(firstArg: IKeyObjectValue, returnTypes: string[]): string[];
13
+ protected _checkMethodThisType(thisType: string[], type: string): boolean;
14
+ protected _priorityComparison(currentType: string, targetType: string): boolean;
15
+ protected _compareType(currentType: string, targetType: string, isCondition?: boolean): boolean;
16
+ protected _compareVarType(currentType: string, targetType: string): boolean;
17
+ protected _typeAddSeries(type: string): string;
18
+ protected _typeAddConst(type: string): string;
19
+ protected _getOriginMethodName(type: string, lastName: string): string;
20
+ protected _returnedTypesParse(returnedTypes?: string[]): string[];
21
+ protected _removePrefix(type?: string): string;
22
+ protected _getPrefix(type: string): string | undefined;
23
+ protected _getMethodTypeName(type: string): string;
24
+ protected _typeReplace(returnType: string, type: string): string;
25
+ }
@@ -0,0 +1,32 @@
1
+ /// <reference path="../../../../src/vite-env.d.ts" />
2
+ import { ErrorListener } from "antlr4";
3
+ import { IKeyObjectValue } from "../type";
4
+ export declare function parseTcc(program: string, hasTranscoding: boolean, keyObjs: IKeyObjectValue): Promise<{
5
+ errors: any[];
6
+ functions: {
7
+ [k: string]: import("../type").IDocValue[];
8
+ };
9
+ variables: {
10
+ [k: string]: import("../type").IDocValue[];
11
+ };
12
+ types: {
13
+ [k: string]: import("../type").IDocValue[];
14
+ };
15
+ methods: {
16
+ [k: string]: import("../type").IDocValue[];
17
+ };
18
+ overloadsFuncs: import("../type").IKeyValue[];
19
+ imports: {
20
+ [k: string]: IKeyObjectValue;
21
+ };
22
+ enums: {
23
+ [k: string]: import("../type").IDocValue[];
24
+ };
25
+ codeStr: string;
26
+ preParserCode: string | undefined;
27
+ config: IKeyObjectValue;
28
+ }>;
29
+ export declare class ExprErrorListener extends ErrorListener {
30
+ errors: any[];
31
+ syntaxError(_: any, __: any, line: number, column: number, msg: string): void;
32
+ }
@@ -0,0 +1,11 @@
1
+ import { IKeyObjectValue } from '../type';
2
+ interface IRunResult {
3
+ status: number;
4
+ errors: any[];
5
+ requestList?: any[];
6
+ cacheData?: any;
7
+ options?: any;
8
+ }
9
+ export declare function runScript(strJs: string, options: IKeyObjectValue, isNew: boolean): Promise<IRunResult>;
10
+ export declare function removeScript(id: string): void;
11
+ export {};
@@ -1,4 +1,4 @@
1
- /// <reference path="../../src/vite-env.d.ts" />
1
+ /// <reference path="../../../../../src/vite-env.d.ts" />
2
2
  import { Lexer } from "antlr4";
3
3
  export default abstract class LexerBase extends Lexer {
4
4
  tokens: any[];