circuitscript 0.0.20 → 0.0.22
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.
- package/__tests__/testParse.ts +15 -0
- package/build/src/antlr/CircuitScriptLexer.d.ts +71 -0
- package/build/src/antlr/CircuitScriptParser.d.ts +674 -0
- package/build/src/antlr/CircuitScriptParser.js +142 -112
- package/build/src/antlr/CircuitScriptVisitor.d.ts +115 -0
- package/build/src/antlr/CircuitScriptVisitor.js +2 -0
- package/build/src/draw_symbols.d.ts +162 -0
- package/build/src/execute.d.ts +85 -0
- package/build/src/export.d.ts +2 -0
- package/build/src/fonts.d.ts +1 -0
- package/build/src/geometry.d.ts +84 -0
- package/build/src/globals.d.ts +50 -0
- package/build/src/helpers.d.ts +1 -0
- package/build/src/layout.d.ts +147 -0
- package/build/src/lexer.d.ts +19 -0
- package/build/src/logger.d.ts +6 -0
- package/build/src/main.d.ts +2 -0
- package/build/src/objects/ClassComponent.d.ts +40 -0
- package/build/src/objects/ExecutionScope.d.ts +64 -0
- package/build/src/objects/Frame.d.ts +15 -0
- package/build/src/objects/Net.d.ts +10 -0
- package/build/src/objects/ParamDefinition.d.ts +20 -0
- package/build/src/objects/PinDefinition.d.ts +24 -0
- package/build/src/objects/PinTypes.d.ts +7 -0
- package/build/src/objects/Wire.d.ts +11 -0
- package/build/src/objects/types.d.ts +49 -0
- package/build/src/regenerate-tests.d.ts +1 -0
- package/build/src/render.d.ts +10 -0
- package/build/src/server.d.ts +1 -0
- package/build/src/sizing.d.ts +13 -0
- package/build/src/utils.d.ts +19 -0
- package/build/src/visitor.d.ts +133 -0
- package/build/src/visitor.js +13 -4
- package/package.json +1 -1
- package/src/antlr/CircuitScript.g4 +3 -2
- package/src/antlr/CircuitScriptParser.ts +117 -87
- package/src/antlr/CircuitScriptVisitor.ts +16 -0
- package/src/visitor.ts +27 -11
- package/tsconfig.json +1 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { ParseTreeVisitor, ParserRuleContext } from 'antlr4';
|
|
2
|
+
import { Add_component_exprContext, AdditionExprContext, Assignment_exprContext, At_blockContext, At_block_pin_exprContext, At_block_pin_expression_complexContext, At_block_pin_expression_simpleContext, At_component_exprContext, Atom_exprContext, BinaryOperatorExprContext, Blank_exprContext, Path_blocksContext, Component_select_exprContext, Create_component_exprContext, Create_graphic_exprContext, DataExprContext, Data_expr_with_assignmentContext, Double_dot_property_set_exprContext, Frame_exprContext, Function_args_exprContext, Function_def_exprContext, Function_return_exprContext, Import_exprContext, Keyword_assignment_exprContext, MultiplyExprContext, Nested_propertiesContext, Net_namespace_exprContext, ParametersContext, Pin_select_expr2Context, Pin_select_exprContext, Point_exprContext, Property_exprContext, Property_key_exprContext, Property_set_exprContext, RoundedBracketsExprContext, ScriptContext, Single_line_propertyContext, Sub_exprContext, To_component_exprContext, Value_exprContext, Wire_exprContext, ValueAtomExprContext, UnaryOperatorExprContext } from './antlr/CircuitScriptParser.js';
|
|
3
|
+
import { ExecutionContext } from './execute.js';
|
|
4
|
+
import { ClassComponent } from './objects/ClassComponent.js';
|
|
5
|
+
import { PinBlankValue } from './objects/ParamDefinition.js';
|
|
6
|
+
import { PinTypes } from './objects/PinTypes.js';
|
|
7
|
+
import { CallableParameter, ComplexType, ComponentPin, ComponentPinNet, FunctionDefinedParameter, ReferenceType, ValueType } from './objects/types.js';
|
|
8
|
+
import { Logger } from './logger.js';
|
|
9
|
+
import { Net } from './objects/Net.js';
|
|
10
|
+
import { SymbolDrawingCommands } from './draw_symbols.js';
|
|
11
|
+
export declare class MainVisitor extends ParseTreeVisitor<any> {
|
|
12
|
+
indentLevel: number;
|
|
13
|
+
startingContext: ExecutionContext;
|
|
14
|
+
executionStack: ExecutionContext[];
|
|
15
|
+
silent: boolean;
|
|
16
|
+
logger: Logger;
|
|
17
|
+
printStream: string[];
|
|
18
|
+
printToConsole: boolean;
|
|
19
|
+
acceptedDirections: string[];
|
|
20
|
+
pinTypesList: string[];
|
|
21
|
+
onImportFile: (visitor: MainVisitor, filePath: string) => {
|
|
22
|
+
hasError: boolean;
|
|
23
|
+
hasParseError: boolean;
|
|
24
|
+
};
|
|
25
|
+
constructor(silent?: boolean);
|
|
26
|
+
getExecutor(): ExecutionContext;
|
|
27
|
+
visit(ctx: ParserRuleContext): any;
|
|
28
|
+
handleError(ctx: ParserRuleContext, err: string | VisitorExecutionException): void;
|
|
29
|
+
visitScript(ctx: ScriptContext): any;
|
|
30
|
+
visitParameters(ctx: ParametersContext): CallableParameter[];
|
|
31
|
+
visitKeyword_assignment_expr(ctx: Keyword_assignment_exprContext): [
|
|
32
|
+
key: string,
|
|
33
|
+
value: any
|
|
34
|
+
];
|
|
35
|
+
visitAssignment_expr(ctx: Assignment_exprContext): ComplexType;
|
|
36
|
+
setInstanceParam(object: ClassComponent, trailers: string[], value: any): void;
|
|
37
|
+
visitValue_expr(ctx: Value_exprContext): ValueType;
|
|
38
|
+
visitBlank_expr(ctx: Blank_exprContext): PinBlankValue;
|
|
39
|
+
visitPin_select_expr(ctx: Pin_select_exprContext): string | number | null;
|
|
40
|
+
visitAdd_component_expr(ctx: Add_component_exprContext): ComponentPin;
|
|
41
|
+
visitAt_component_expr(ctx: At_component_exprContext): ComponentPin;
|
|
42
|
+
visitTo_component_expr(ctx: To_component_exprContext): ComponentPin;
|
|
43
|
+
visitComponent_select_expr(ctx: Component_select_exprContext): ComponentPin;
|
|
44
|
+
visitPath_blocks(ctx: Path_blocksContext): ComponentPin;
|
|
45
|
+
visitBreak_keyword(): number;
|
|
46
|
+
visitCreate_component_expr(ctx: Create_component_exprContext): ClassComponent;
|
|
47
|
+
visitCreate_graphic_expr(ctx: Create_graphic_exprContext): SymbolDrawingCommands;
|
|
48
|
+
visitSub_expr(ctx: Sub_exprContext): [
|
|
49
|
+
id: string,
|
|
50
|
+
parameters: CallableParameter[]
|
|
51
|
+
];
|
|
52
|
+
visitProperty_expr(ctx: Property_exprContext): Map<string, any>;
|
|
53
|
+
visitSingle_line_property(ctx: Single_line_propertyContext): any | any[];
|
|
54
|
+
visitNested_properties(ctx: Nested_propertiesContext): Map<string, any>;
|
|
55
|
+
visitProperty_key_expr(ctx: Property_key_exprContext): string | number;
|
|
56
|
+
visitData_expr_with_assignment(ctx: Data_expr_with_assignmentContext): [
|
|
57
|
+
component: ComplexType,
|
|
58
|
+
pin: string | number | null
|
|
59
|
+
];
|
|
60
|
+
visitValueAtomExpr(ctx: ValueAtomExprContext): ComplexType;
|
|
61
|
+
visitUnaryOperatorExpr(ctx: UnaryOperatorExprContext): ComplexType;
|
|
62
|
+
visitDataExpr(ctx: DataExprContext): ComplexType;
|
|
63
|
+
visitBinaryOperatorExpr(ctx: BinaryOperatorExprContext): boolean | number;
|
|
64
|
+
visitMultiplyExpr(ctx: MultiplyExprContext): number;
|
|
65
|
+
visitAdditionExpr(ctx: AdditionExprContext): number;
|
|
66
|
+
visitFunction_args_expr(ctx: Function_args_exprContext): FunctionDefinedParameter[];
|
|
67
|
+
createNetResolver(executionStack: ExecutionContext[]): (netName: string, netNamespace: string) => {
|
|
68
|
+
found: boolean;
|
|
69
|
+
net?: Net;
|
|
70
|
+
};
|
|
71
|
+
visitFunction_def_expr(ctx: Function_def_exprContext): void;
|
|
72
|
+
private setupDefinedParameters;
|
|
73
|
+
visitFunction_return_expr(ctx: Function_return_exprContext): ComplexType;
|
|
74
|
+
visitAtom_expr(ctx: Atom_exprContext): ReferenceType;
|
|
75
|
+
visitPin_select_expr2(ctx: Pin_select_expr2Context): string | number;
|
|
76
|
+
visitAt_block_pin_expr(ctx: At_block_pin_exprContext): ComponentPin;
|
|
77
|
+
visitAt_block(ctx: At_blockContext): ComponentPin;
|
|
78
|
+
visitAt_block_pin_expression_simple(ctx: At_block_pin_expression_simpleContext): void;
|
|
79
|
+
visitAt_block_pin_expression_complex(ctx: At_block_pin_expression_complexContext): ComponentPin;
|
|
80
|
+
visitWire_expr(ctx: Wire_exprContext): void;
|
|
81
|
+
visitPoint_expr(ctx: Point_exprContext): ComponentPin;
|
|
82
|
+
visitImport_expr(ctx: Import_exprContext): void;
|
|
83
|
+
visitProperty_set_expr(ctx: Property_set_exprContext): void;
|
|
84
|
+
visitDouble_dot_property_set_expr(ctx: Double_dot_property_set_exprContext): void;
|
|
85
|
+
visitRoundedBracketsExpr(ctx: RoundedBracketsExprContext): any;
|
|
86
|
+
visitFrame_expr(ctx: Frame_exprContext): void;
|
|
87
|
+
visitNet_namespace_expr(ctx: Net_namespace_exprContext): string;
|
|
88
|
+
pinTypes: PinTypes[];
|
|
89
|
+
createImportFileHandler(directory: string, defaultLibsPath: string): ((visitor: MainVisitor, importPath: string) => {
|
|
90
|
+
hasError: boolean;
|
|
91
|
+
hasParseError: boolean;
|
|
92
|
+
pathExists: boolean;
|
|
93
|
+
});
|
|
94
|
+
private importLib;
|
|
95
|
+
private parseCreateComponentPins;
|
|
96
|
+
private parseCreateComponentParams;
|
|
97
|
+
private prepareStringValue;
|
|
98
|
+
print(...params: any[]): void;
|
|
99
|
+
printNets(): void;
|
|
100
|
+
dumpNets(): ComponentPinNet[];
|
|
101
|
+
dumpUniqueNets(): Net[];
|
|
102
|
+
dumpVariables(): Map<string, any>;
|
|
103
|
+
dumpInstances(): Map<string, ClassComponent>;
|
|
104
|
+
dump2(): any[];
|
|
105
|
+
getNetList(): NetListItem[];
|
|
106
|
+
getGraph(): {
|
|
107
|
+
sequence: any[];
|
|
108
|
+
nets: import("./objects/types.js").ComponentPinNetPair[];
|
|
109
|
+
components: ClassComponent[];
|
|
110
|
+
};
|
|
111
|
+
annotateComponents(): void;
|
|
112
|
+
private resolveNets;
|
|
113
|
+
private setComponentOrientation;
|
|
114
|
+
private getPropertyExprList;
|
|
115
|
+
private runExpressions;
|
|
116
|
+
private checkNetNamespaceIncludes;
|
|
117
|
+
private getNamespaceParts;
|
|
118
|
+
private setupPrintFunction;
|
|
119
|
+
private getNetNamespace;
|
|
120
|
+
}
|
|
121
|
+
export type NetListItem = {
|
|
122
|
+
instanceName: string;
|
|
123
|
+
instance: ClassComponent;
|
|
124
|
+
pins: {
|
|
125
|
+
[key: string | number]: string;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
export declare class VisitorExecutionException {
|
|
129
|
+
errorMessage: string;
|
|
130
|
+
context: ParserRuleContext;
|
|
131
|
+
constructor(context: ParserRuleContext, errorMessage: string);
|
|
132
|
+
print(scriptData: string): void;
|
|
133
|
+
}
|
package/build/src/visitor.js
CHANGED
|
@@ -393,7 +393,7 @@ export class MainVisitor extends ParseTreeVisitor {
|
|
|
393
393
|
}
|
|
394
394
|
return [component, pinValue];
|
|
395
395
|
}
|
|
396
|
-
|
|
396
|
+
visitValueAtomExpr(ctx) {
|
|
397
397
|
let value;
|
|
398
398
|
if (ctx.value_expr()) {
|
|
399
399
|
value = this.visit(ctx.value_expr());
|
|
@@ -407,8 +407,13 @@ export class MainVisitor extends ParseTreeVisitor {
|
|
|
407
407
|
value = reference.value;
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
|
-
|
|
411
|
-
|
|
410
|
+
return value;
|
|
411
|
+
}
|
|
412
|
+
visitUnaryOperatorExpr(ctx) {
|
|
413
|
+
const value = this.visit(ctx.data_expr());
|
|
414
|
+
const unaryOp = ctx.unary_operator();
|
|
415
|
+
if (unaryOp) {
|
|
416
|
+
if (unaryOp.Not()) {
|
|
412
417
|
if (typeof value === "boolean") {
|
|
413
418
|
value = !value;
|
|
414
419
|
}
|
|
@@ -416,7 +421,7 @@ export class MainVisitor extends ParseTreeVisitor {
|
|
|
416
421
|
throw "Failed to do Not operator";
|
|
417
422
|
}
|
|
418
423
|
}
|
|
419
|
-
else if (
|
|
424
|
+
else if (unaryOp.Minus()) {
|
|
420
425
|
if (typeof value === 'number') {
|
|
421
426
|
return -value;
|
|
422
427
|
}
|
|
@@ -425,6 +430,10 @@ export class MainVisitor extends ParseTreeVisitor {
|
|
|
425
430
|
}
|
|
426
431
|
}
|
|
427
432
|
}
|
|
433
|
+
return value;
|
|
434
|
+
}
|
|
435
|
+
visitDataExpr(ctx) {
|
|
436
|
+
let value;
|
|
428
437
|
if (ctx.create_component_expr()) {
|
|
429
438
|
value = this.visit(ctx.create_component_expr());
|
|
430
439
|
}
|
package/package.json
CHANGED
|
@@ -106,8 +106,9 @@ property_set_expr: atom_expr '=' data_expr;
|
|
|
106
106
|
double_dot_property_set_expr: '..' ID '=' data_expr;
|
|
107
107
|
|
|
108
108
|
data_expr:
|
|
109
|
-
(
|
|
110
|
-
|
|
|
109
|
+
'(' data_expr ')' #RoundedBracketsExpr
|
|
110
|
+
| (value_expr | atom_expr) #ValueAtomExpr
|
|
111
|
+
| unary_operator data_expr #UnaryOperatorExpr
|
|
111
112
|
| data_expr (Multiply | Divide) data_expr #MultiplyExpr
|
|
112
113
|
| data_expr (Addition | Minus) data_expr #AdditionExpr
|
|
113
114
|
| data_expr binary_operator data_expr #BinaryOperatorExpr
|
|
@@ -1744,25 +1744,27 @@ export default class CircuitScriptParser extends Parser {
|
|
|
1744
1744
|
{
|
|
1745
1745
|
this.state = 329;
|
|
1746
1746
|
this._errHandler.sync(this);
|
|
1747
|
-
switch ( this._interp.adaptivePredict(this._input,
|
|
1747
|
+
switch ( this._interp.adaptivePredict(this._input, 33, this._ctx) ) {
|
|
1748
1748
|
case 1:
|
|
1749
1749
|
{
|
|
1750
|
-
localctx = new
|
|
1750
|
+
localctx = new RoundedBracketsExprContext(this, localctx);
|
|
1751
1751
|
this._ctx = localctx;
|
|
1752
1752
|
_prevctx = localctx;
|
|
1753
1753
|
|
|
1754
|
-
|
|
1754
|
+
this.state = 316;
|
|
1755
|
+
this.match(CircuitScriptParser.OPEN_PAREN);
|
|
1755
1756
|
this.state = 317;
|
|
1756
|
-
this.
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
{
|
|
1760
|
-
this.state = 316;
|
|
1761
|
-
this.unary_operator();
|
|
1762
|
-
}
|
|
1763
|
-
break;
|
|
1757
|
+
this.data_expr(0);
|
|
1758
|
+
this.state = 318;
|
|
1759
|
+
this.match(CircuitScriptParser.CLOSE_PAREN);
|
|
1764
1760
|
}
|
|
1765
|
-
|
|
1761
|
+
break;
|
|
1762
|
+
case 2:
|
|
1763
|
+
{
|
|
1764
|
+
localctx = new ValueAtomExprContext(this, localctx);
|
|
1765
|
+
this._ctx = localctx;
|
|
1766
|
+
_prevctx = localctx;
|
|
1767
|
+
this.state = 322;
|
|
1766
1768
|
this._errHandler.sync(this);
|
|
1767
1769
|
switch (this._input.LA(1)) {
|
|
1768
1770
|
case 6:
|
|
@@ -1774,7 +1776,7 @@ export default class CircuitScriptParser extends Parser {
|
|
|
1774
1776
|
case 41:
|
|
1775
1777
|
case 42:
|
|
1776
1778
|
{
|
|
1777
|
-
this.state =
|
|
1779
|
+
this.state = 320;
|
|
1778
1780
|
this.value_expr();
|
|
1779
1781
|
}
|
|
1780
1782
|
break;
|
|
@@ -1782,7 +1784,7 @@ export default class CircuitScriptParser extends Parser {
|
|
|
1782
1784
|
case 31:
|
|
1783
1785
|
case 37:
|
|
1784
1786
|
{
|
|
1785
|
-
this.state =
|
|
1787
|
+
this.state = 321;
|
|
1786
1788
|
this.atom_expr();
|
|
1787
1789
|
}
|
|
1788
1790
|
break;
|
|
@@ -1790,22 +1792,19 @@ export default class CircuitScriptParser extends Parser {
|
|
|
1790
1792
|
throw new NoViableAltException(this);
|
|
1791
1793
|
}
|
|
1792
1794
|
}
|
|
1793
|
-
}
|
|
1794
1795
|
break;
|
|
1795
|
-
case
|
|
1796
|
+
case 3:
|
|
1796
1797
|
{
|
|
1797
|
-
localctx = new
|
|
1798
|
+
localctx = new UnaryOperatorExprContext(this, localctx);
|
|
1798
1799
|
this._ctx = localctx;
|
|
1799
1800
|
_prevctx = localctx;
|
|
1800
|
-
this.state = 323;
|
|
1801
|
-
this.match(CircuitScriptParser.OPEN_PAREN);
|
|
1802
1801
|
this.state = 324;
|
|
1803
|
-
this.
|
|
1802
|
+
this.unary_operator();
|
|
1804
1803
|
this.state = 325;
|
|
1805
|
-
this.
|
|
1804
|
+
this.data_expr(6);
|
|
1806
1805
|
}
|
|
1807
1806
|
break;
|
|
1808
|
-
case
|
|
1807
|
+
case 4:
|
|
1809
1808
|
{
|
|
1810
1809
|
localctx = new DataExprContext(this, localctx);
|
|
1811
1810
|
this._ctx = localctx;
|
|
@@ -1814,7 +1813,7 @@ export default class CircuitScriptParser extends Parser {
|
|
|
1814
1813
|
this.create_component_expr();
|
|
1815
1814
|
}
|
|
1816
1815
|
break;
|
|
1817
|
-
case
|
|
1816
|
+
case 5:
|
|
1818
1817
|
{
|
|
1819
1818
|
localctx = new DataExprContext(this, localctx);
|
|
1820
1819
|
this._ctx = localctx;
|
|
@@ -1827,7 +1826,7 @@ export default class CircuitScriptParser extends Parser {
|
|
|
1827
1826
|
this._ctx.stop = this._input.LT(-1);
|
|
1828
1827
|
this.state = 343;
|
|
1829
1828
|
this._errHandler.sync(this);
|
|
1830
|
-
_alt = this._interp.adaptivePredict(this._input,
|
|
1829
|
+
_alt = this._interp.adaptivePredict(this._input, 35, this._ctx);
|
|
1831
1830
|
while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) {
|
|
1832
1831
|
if (_alt === 1) {
|
|
1833
1832
|
if (this._parseListeners != null) {
|
|
@@ -1837,7 +1836,7 @@ export default class CircuitScriptParser extends Parser {
|
|
|
1837
1836
|
{
|
|
1838
1837
|
this.state = 341;
|
|
1839
1838
|
this._errHandler.sync(this);
|
|
1840
|
-
switch ( this._interp.adaptivePredict(this._input,
|
|
1839
|
+
switch ( this._interp.adaptivePredict(this._input, 34, this._ctx) ) {
|
|
1841
1840
|
case 1:
|
|
1842
1841
|
{
|
|
1843
1842
|
localctx = new MultiplyExprContext(this, new Data_exprContext(this, _parentctx, _parentState));
|
|
@@ -1899,7 +1898,7 @@ export default class CircuitScriptParser extends Parser {
|
|
|
1899
1898
|
}
|
|
1900
1899
|
this.state = 345;
|
|
1901
1900
|
this._errHandler.sync(this);
|
|
1902
|
-
_alt = this._interp.adaptivePredict(this._input,
|
|
1901
|
+
_alt = this._interp.adaptivePredict(this._input, 35, this._ctx);
|
|
1903
1902
|
}
|
|
1904
1903
|
}
|
|
1905
1904
|
}
|
|
@@ -2207,7 +2206,7 @@ export default class CircuitScriptParser extends Parser {
|
|
|
2207
2206
|
let _alt: number;
|
|
2208
2207
|
this.state = 408;
|
|
2209
2208
|
this._errHandler.sync(this);
|
|
2210
|
-
switch ( this._interp.adaptivePredict(this._input,
|
|
2209
|
+
switch ( this._interp.adaptivePredict(this._input, 45, this._ctx) ) {
|
|
2211
2210
|
case 1:
|
|
2212
2211
|
this.enterOuterAlt(localctx, 1);
|
|
2213
2212
|
{
|
|
@@ -2215,7 +2214,7 @@ export default class CircuitScriptParser extends Parser {
|
|
|
2215
2214
|
this.match(CircuitScriptParser.ID);
|
|
2216
2215
|
this.state = 384;
|
|
2217
2216
|
this._errHandler.sync(this);
|
|
2218
|
-
_alt = this._interp.adaptivePredict(this._input,
|
|
2217
|
+
_alt = this._interp.adaptivePredict(this._input, 42, this._ctx);
|
|
2219
2218
|
while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) {
|
|
2220
2219
|
if (_alt === 1) {
|
|
2221
2220
|
{
|
|
@@ -2229,7 +2228,7 @@ export default class CircuitScriptParser extends Parser {
|
|
|
2229
2228
|
}
|
|
2230
2229
|
this.state = 386;
|
|
2231
2230
|
this._errHandler.sync(this);
|
|
2232
|
-
_alt = this._interp.adaptivePredict(this._input,
|
|
2231
|
+
_alt = this._interp.adaptivePredict(this._input, 42, this._ctx);
|
|
2233
2232
|
}
|
|
2234
2233
|
this.state = 393;
|
|
2235
2234
|
this._errHandler.sync(this);
|
|
@@ -2323,7 +2322,7 @@ export default class CircuitScriptParser extends Parser {
|
|
|
2323
2322
|
this.match(CircuitScriptParser.ID);
|
|
2324
2323
|
this.state = 417;
|
|
2325
2324
|
this._errHandler.sync(this);
|
|
2326
|
-
_alt = this._interp.adaptivePredict(this._input,
|
|
2325
|
+
_alt = this._interp.adaptivePredict(this._input, 47, this._ctx);
|
|
2327
2326
|
while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) {
|
|
2328
2327
|
if (_alt === 1) {
|
|
2329
2328
|
{
|
|
@@ -2335,7 +2334,7 @@ export default class CircuitScriptParser extends Parser {
|
|
|
2335
2334
|
}
|
|
2336
2335
|
this.state = 419;
|
|
2337
2336
|
this._errHandler.sync(this);
|
|
2338
|
-
_alt = this._interp.adaptivePredict(this._input,
|
|
2337
|
+
_alt = this._interp.adaptivePredict(this._input, 47, this._ctx);
|
|
2339
2338
|
}
|
|
2340
2339
|
}
|
|
2341
2340
|
}
|
|
@@ -2430,7 +2429,7 @@ export default class CircuitScriptParser extends Parser {
|
|
|
2430
2429
|
this.match(CircuitScriptParser.Divide);
|
|
2431
2430
|
this.state = 434;
|
|
2432
2431
|
this._errHandler.sync(this);
|
|
2433
|
-
switch ( this._interp.adaptivePredict(this._input,
|
|
2432
|
+
switch ( this._interp.adaptivePredict(this._input, 51, this._ctx) ) {
|
|
2434
2433
|
case 1:
|
|
2435
2434
|
{
|
|
2436
2435
|
this.state = 433;
|
|
@@ -2633,7 +2632,7 @@ export default class CircuitScriptParser extends Parser {
|
|
|
2633
2632
|
this.match(CircuitScriptParser.T__0);
|
|
2634
2633
|
this.state = 472;
|
|
2635
2634
|
this._errHandler.sync(this);
|
|
2636
|
-
switch ( this._interp.adaptivePredict(this._input,
|
|
2635
|
+
switch ( this._interp.adaptivePredict(this._input, 56, this._ctx) ) {
|
|
2637
2636
|
case 1:
|
|
2638
2637
|
{
|
|
2639
2638
|
this.state = 467;
|
|
@@ -2879,7 +2878,7 @@ export default class CircuitScriptParser extends Parser {
|
|
|
2879
2878
|
this.match(CircuitScriptParser.ID);
|
|
2880
2879
|
this.state = 508;
|
|
2881
2880
|
this._errHandler.sync(this);
|
|
2882
|
-
_alt = this._interp.adaptivePredict(this._input,
|
|
2881
|
+
_alt = this._interp.adaptivePredict(this._input, 61, this._ctx);
|
|
2883
2882
|
while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) {
|
|
2884
2883
|
if (_alt === 1) {
|
|
2885
2884
|
{
|
|
@@ -2898,7 +2897,7 @@ export default class CircuitScriptParser extends Parser {
|
|
|
2898
2897
|
}
|
|
2899
2898
|
this.state = 510;
|
|
2900
2899
|
this._errHandler.sync(this);
|
|
2901
|
-
_alt = this._interp.adaptivePredict(this._input,
|
|
2900
|
+
_alt = this._interp.adaptivePredict(this._input, 61, this._ctx);
|
|
2902
2901
|
}
|
|
2903
2902
|
}
|
|
2904
2903
|
}
|
|
@@ -3091,40 +3090,40 @@ export default class CircuitScriptParser extends Parser {
|
|
|
3091
3090
|
1,24,1,24,1,24,5,24,285,8,24,10,24,12,24,288,9,24,1,24,1,24,5,24,292,8,
|
|
3092
3091
|
24,10,24,12,24,295,9,24,1,24,1,24,1,24,5,24,300,8,24,10,24,12,24,303,9,
|
|
3093
3092
|
24,3,24,305,8,24,1,25,1,25,1,25,1,25,1,26,1,26,1,26,1,26,1,26,1,27,1,27,
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
33,1,33,
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3093
|
+
1,27,1,27,1,27,1,27,1,27,3,27,323,8,27,1,27,1,27,1,27,1,27,1,27,3,27,330,
|
|
3094
|
+
8,27,1,27,1,27,1,27,1,27,1,27,1,27,1,27,1,27,1,27,1,27,5,27,342,8,27,10,
|
|
3095
|
+
27,12,27,345,9,27,1,28,1,28,1,29,1,29,1,30,3,30,352,8,30,1,30,1,30,3,30,
|
|
3096
|
+
356,8,30,1,31,1,31,1,31,1,31,3,31,362,8,31,1,31,1,31,1,31,1,31,1,31,1,31,
|
|
3097
|
+
4,31,370,8,31,11,31,12,31,371,1,31,1,31,1,32,1,32,3,32,378,8,32,1,33,1,
|
|
3098
|
+
33,1,33,5,33,383,8,33,10,33,12,33,386,9,33,1,33,1,33,1,33,1,33,5,33,392,
|
|
3099
|
+
8,33,10,33,12,33,395,9,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,5,33,404,8,
|
|
3100
|
+
33,10,33,12,33,407,9,33,3,33,409,8,33,1,34,3,34,412,8,34,1,34,1,34,5,34,
|
|
3101
|
+
416,8,34,10,34,12,34,419,9,34,1,35,1,35,3,35,423,8,35,1,35,1,35,1,35,3,
|
|
3102
|
+
35,428,8,35,1,36,3,36,431,8,36,1,36,1,36,3,36,435,8,36,1,37,1,37,1,37,1,
|
|
3103
|
+
38,1,38,1,38,1,38,1,38,1,38,1,38,4,38,447,8,38,11,38,12,38,448,1,38,1,38,
|
|
3104
|
+
1,39,1,39,1,39,1,39,1,39,1,39,1,39,4,39,460,8,39,11,39,12,39,461,1,39,1,
|
|
3105
|
+
39,1,40,1,40,1,40,1,40,1,40,1,40,1,40,3,40,473,8,40,1,41,1,41,1,41,1,41,
|
|
3106
|
+
1,42,1,42,1,43,1,43,1,43,1,43,4,43,485,8,43,11,43,12,43,486,1,43,1,43,1,
|
|
3107
|
+
43,1,43,5,43,493,8,43,10,43,12,43,496,9,43,3,43,498,8,43,1,44,1,44,1,44,
|
|
3108
|
+
1,44,1,45,1,45,1,45,5,45,507,8,45,10,45,12,45,510,9,45,1,46,1,46,1,46,1,
|
|
3109
|
+
47,1,47,1,47,1,48,1,48,1,48,1,48,1,48,1,48,4,48,524,8,48,11,48,12,48,525,
|
|
3110
|
+
1,48,1,48,1,48,0,1,54,49,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,
|
|
3111
|
+
34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,
|
|
3112
|
+
82,84,86,88,90,92,94,96,0,11,2,0,10,10,19,21,1,0,37,38,2,0,38,38,41,41,
|
|
3113
|
+
2,0,35,35,38,38,1,0,31,32,1,0,29,30,1,0,27,28,2,0,26,26,30,30,2,0,36,36,
|
|
3114
|
+
38,42,2,0,15,15,37,37,2,0,37,38,41,41,562,0,100,1,0,0,0,2,122,1,0,0,0,4,
|
|
3115
|
+
125,1,0,0,0,6,129,1,0,0,0,8,141,1,0,0,0,10,153,1,0,0,0,12,159,1,0,0,0,14,
|
|
3116
|
+
164,1,0,0,0,16,171,1,0,0,0,18,173,1,0,0,0,20,176,1,0,0,0,22,178,1,0,0,0,
|
|
3117
|
+
24,186,1,0,0,0,26,201,1,0,0,0,28,223,1,0,0,0,30,233,1,0,0,0,32,235,1,0,
|
|
3118
|
+
0,0,34,249,1,0,0,0,36,251,1,0,0,0,38,259,1,0,0,0,40,261,1,0,0,0,42,271,
|
|
3119
|
+
1,0,0,0,44,273,1,0,0,0,46,277,1,0,0,0,48,304,1,0,0,0,50,306,1,0,0,0,52,
|
|
3120
|
+
310,1,0,0,0,54,329,1,0,0,0,56,346,1,0,0,0,58,348,1,0,0,0,60,355,1,0,0,0,
|
|
3121
|
+
62,357,1,0,0,0,64,377,1,0,0,0,66,408,1,0,0,0,68,411,1,0,0,0,70,427,1,0,
|
|
3122
|
+
0,0,72,430,1,0,0,0,74,436,1,0,0,0,76,439,1,0,0,0,78,452,1,0,0,0,80,465,
|
|
3123
|
+
1,0,0,0,82,474,1,0,0,0,84,478,1,0,0,0,86,497,1,0,0,0,88,499,1,0,0,0,90,
|
|
3124
|
+
503,1,0,0,0,92,511,1,0,0,0,94,514,1,0,0,0,96,517,1,0,0,0,98,101,3,2,1,0,
|
|
3125
|
+
99,101,5,45,0,0,100,98,1,0,0,0,100,99,1,0,0,0,101,102,1,0,0,0,102,100,1,
|
|
3126
|
+
0,0,0,102,103,1,0,0,0,103,104,1,0,0,0,104,105,5,0,0,1,105,1,1,0,0,0,106,
|
|
3128
3127
|
123,3,14,7,0,107,123,3,24,12,0,108,123,3,22,11,0,109,123,3,44,22,0,110,
|
|
3129
3128
|
123,3,50,25,0,111,123,3,8,4,0,112,123,3,52,26,0,113,123,3,42,21,0,114,123,
|
|
3130
3129
|
3,62,31,0,115,123,3,90,45,0,116,123,3,94,47,0,117,123,3,96,48,0,118,123,
|
|
@@ -3182,11 +3181,11 @@ export default class CircuitScriptParser extends Parser {
|
|
|
3182
3181
|
0,0,0,302,305,1,0,0,0,303,301,1,0,0,0,304,281,1,0,0,0,304,296,1,0,0,0,305,
|
|
3183
3182
|
49,1,0,0,0,306,307,3,68,34,0,307,308,5,3,0,0,308,309,3,54,27,0,309,51,1,
|
|
3184
3183
|
0,0,0,310,311,5,4,0,0,311,312,5,37,0,0,312,313,5,3,0,0,313,314,3,54,27,
|
|
3185
|
-
0,314,53,1,0,0,0,315,
|
|
3186
|
-
|
|
3187
|
-
1,0,0,0,321,
|
|
3188
|
-
|
|
3189
|
-
329,
|
|
3184
|
+
0,314,53,1,0,0,0,315,316,6,27,-1,0,316,317,5,33,0,0,317,318,3,54,27,0,318,
|
|
3185
|
+
319,5,34,0,0,319,330,1,0,0,0,320,323,3,60,30,0,321,323,3,68,34,0,322,320,
|
|
3186
|
+
1,0,0,0,322,321,1,0,0,0,323,330,1,0,0,0,324,325,3,58,29,0,325,326,3,54,
|
|
3187
|
+
27,6,326,330,1,0,0,0,327,330,3,76,38,0,328,330,3,78,39,0,329,315,1,0,0,
|
|
3188
|
+
0,329,322,1,0,0,0,329,324,1,0,0,0,329,327,1,0,0,0,329,328,1,0,0,0,330,343,
|
|
3190
3189
|
1,0,0,0,331,332,10,5,0,0,332,333,7,4,0,0,333,342,3,54,27,6,334,335,10,4,
|
|
3191
3190
|
0,0,335,336,7,5,0,0,336,342,3,54,27,5,337,338,10,3,0,0,338,339,3,56,28,
|
|
3192
3191
|
0,339,340,3,54,27,4,340,342,1,0,0,0,341,331,1,0,0,0,341,334,1,0,0,0,341,
|
|
@@ -3239,10 +3238,10 @@ export default class CircuitScriptParser extends Parser {
|
|
|
3239
3238
|
5,8,0,0,518,519,5,1,0,0,519,520,5,45,0,0,520,523,5,47,0,0,521,524,5,45,
|
|
3240
3239
|
0,0,522,524,3,2,1,0,523,521,1,0,0,0,523,522,1,0,0,0,524,525,1,0,0,0,525,
|
|
3241
3240
|
523,1,0,0,0,525,526,1,0,0,0,526,527,1,0,0,0,527,528,5,48,0,0,528,97,1,0,
|
|
3242
|
-
0,0,
|
|
3243
|
-
199,209,217,219,230,241,243,249,255,259,265,267,286,293,301,304,
|
|
3244
|
-
|
|
3245
|
-
|
|
3241
|
+
0,0,64,100,102,122,127,135,137,147,149,159,162,167,171,181,184,192,196,
|
|
3242
|
+
199,209,217,219,230,241,243,249,255,259,265,267,286,293,301,304,322,329,
|
|
3243
|
+
341,343,351,355,361,369,371,377,384,393,405,408,411,417,422,427,430,434,
|
|
3244
|
+
446,448,459,461,472,484,486,494,497,508,523,525];
|
|
3246
3245
|
|
|
3247
3246
|
private static __ATN: ATN;
|
|
3248
3247
|
public static get _ATN(): ATN {
|
|
@@ -4179,15 +4178,6 @@ export class DataExprContext extends Data_exprContext {
|
|
|
4179
4178
|
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
4180
4179
|
super.copyFrom(ctx);
|
|
4181
4180
|
}
|
|
4182
|
-
public value_expr(): Value_exprContext {
|
|
4183
|
-
return this.getTypedRuleContext(Value_exprContext, 0) as Value_exprContext;
|
|
4184
|
-
}
|
|
4185
|
-
public atom_expr(): Atom_exprContext {
|
|
4186
|
-
return this.getTypedRuleContext(Atom_exprContext, 0) as Atom_exprContext;
|
|
4187
|
-
}
|
|
4188
|
-
public unary_operator(): Unary_operatorContext {
|
|
4189
|
-
return this.getTypedRuleContext(Unary_operatorContext, 0) as Unary_operatorContext;
|
|
4190
|
-
}
|
|
4191
4181
|
public create_component_expr(): Create_component_exprContext {
|
|
4192
4182
|
return this.getTypedRuleContext(Create_component_exprContext, 0) as Create_component_exprContext;
|
|
4193
4183
|
}
|
|
@@ -4203,6 +4193,46 @@ export class DataExprContext extends Data_exprContext {
|
|
|
4203
4193
|
}
|
|
4204
4194
|
}
|
|
4205
4195
|
}
|
|
4196
|
+
export class UnaryOperatorExprContext extends Data_exprContext {
|
|
4197
|
+
constructor(parser: CircuitScriptParser, ctx: Data_exprContext) {
|
|
4198
|
+
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
4199
|
+
super.copyFrom(ctx);
|
|
4200
|
+
}
|
|
4201
|
+
public unary_operator(): Unary_operatorContext {
|
|
4202
|
+
return this.getTypedRuleContext(Unary_operatorContext, 0) as Unary_operatorContext;
|
|
4203
|
+
}
|
|
4204
|
+
public data_expr(): Data_exprContext {
|
|
4205
|
+
return this.getTypedRuleContext(Data_exprContext, 0) as Data_exprContext;
|
|
4206
|
+
}
|
|
4207
|
+
// @Override
|
|
4208
|
+
public accept<Result>(visitor: CircuitScriptVisitor<Result>): Result {
|
|
4209
|
+
if (visitor.visitUnaryOperatorExpr) {
|
|
4210
|
+
return visitor.visitUnaryOperatorExpr(this);
|
|
4211
|
+
} else {
|
|
4212
|
+
return visitor.visitChildren(this);
|
|
4213
|
+
}
|
|
4214
|
+
}
|
|
4215
|
+
}
|
|
4216
|
+
export class ValueAtomExprContext extends Data_exprContext {
|
|
4217
|
+
constructor(parser: CircuitScriptParser, ctx: Data_exprContext) {
|
|
4218
|
+
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
4219
|
+
super.copyFrom(ctx);
|
|
4220
|
+
}
|
|
4221
|
+
public value_expr(): Value_exprContext {
|
|
4222
|
+
return this.getTypedRuleContext(Value_exprContext, 0) as Value_exprContext;
|
|
4223
|
+
}
|
|
4224
|
+
public atom_expr(): Atom_exprContext {
|
|
4225
|
+
return this.getTypedRuleContext(Atom_exprContext, 0) as Atom_exprContext;
|
|
4226
|
+
}
|
|
4227
|
+
// @Override
|
|
4228
|
+
public accept<Result>(visitor: CircuitScriptVisitor<Result>): Result {
|
|
4229
|
+
if (visitor.visitValueAtomExpr) {
|
|
4230
|
+
return visitor.visitValueAtomExpr(this);
|
|
4231
|
+
} else {
|
|
4232
|
+
return visitor.visitChildren(this);
|
|
4233
|
+
}
|
|
4234
|
+
}
|
|
4235
|
+
}
|
|
4206
4236
|
export class BinaryOperatorExprContext extends Data_exprContext {
|
|
4207
4237
|
constructor(parser: CircuitScriptParser, ctx: Data_exprContext) {
|
|
4208
4238
|
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
@@ -35,6 +35,8 @@ import { Double_dot_property_set_exprContext } from "./CircuitScriptParser";
|
|
|
35
35
|
import { AdditionExprContext } from "./CircuitScriptParser";
|
|
36
36
|
import { MultiplyExprContext } from "./CircuitScriptParser";
|
|
37
37
|
import { DataExprContext } from "./CircuitScriptParser";
|
|
38
|
+
import { UnaryOperatorExprContext } from "./CircuitScriptParser";
|
|
39
|
+
import { ValueAtomExprContext } from "./CircuitScriptParser";
|
|
38
40
|
import { BinaryOperatorExprContext } from "./CircuitScriptParser";
|
|
39
41
|
import { RoundedBracketsExprContext } from "./CircuitScriptParser";
|
|
40
42
|
import { Binary_operatorContext } from "./CircuitScriptParser";
|
|
@@ -252,6 +254,20 @@ export default class CircuitScriptVisitor<Result> extends ParseTreeVisitor<Resul
|
|
|
252
254
|
* @return the visitor result
|
|
253
255
|
*/
|
|
254
256
|
visitDataExpr?: (ctx: DataExprContext) => Result;
|
|
257
|
+
/**
|
|
258
|
+
* Visit a parse tree produced by the `UnaryOperatorExpr`
|
|
259
|
+
* labeled alternative in `CircuitScriptParser.data_expr`.
|
|
260
|
+
* @param ctx the parse tree
|
|
261
|
+
* @return the visitor result
|
|
262
|
+
*/
|
|
263
|
+
visitUnaryOperatorExpr?: (ctx: UnaryOperatorExprContext) => Result;
|
|
264
|
+
/**
|
|
265
|
+
* Visit a parse tree produced by the `ValueAtomExpr`
|
|
266
|
+
* labeled alternative in `CircuitScriptParser.data_expr`.
|
|
267
|
+
* @param ctx the parse tree
|
|
268
|
+
* @return the visitor result
|
|
269
|
+
*/
|
|
270
|
+
visitValueAtomExpr?: (ctx: ValueAtomExprContext) => Result;
|
|
255
271
|
/**
|
|
256
272
|
* Visit a parse tree produced by the `BinaryOperatorExpr`
|
|
257
273
|
* labeled alternative in `CircuitScriptParser.data_expr`.
|