circuitscript 0.0.35 → 0.0.36
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/dist/cjs/BaseVisitor.js +2 -62
- package/dist/cjs/antlr/CircuitScriptParser.js +110 -85
- package/dist/cjs/builtinMethods.js +96 -0
- package/dist/cjs/layout.js +2 -2
- package/dist/cjs/objects/Frame.js +1 -1
- package/dist/cjs/render.js +3 -3
- package/dist/cjs/visitor.js +11 -5
- package/dist/esm/BaseVisitor.mjs +2 -62
- package/dist/esm/antlr/CircuitScriptParser.mjs +110 -85
- package/dist/esm/builtinMethods.mjs +92 -0
- package/dist/esm/layout.mjs +2 -2
- package/dist/esm/objects/Frame.mjs +1 -1
- package/dist/esm/render.mjs +3 -3
- package/dist/esm/visitor.mjs +11 -5
- package/dist/types/BaseVisitor.d.ts +0 -1
- package/dist/types/antlr/CircuitScriptParser.d.ts +2 -1
- package/dist/types/builtinMethods.d.ts +3 -0
- package/dist/types/objects/Frame.d.ts +1 -1
- package/libs/lib.cst +81 -228
- package/package.json +8 -2
|
@@ -3586,6 +3586,7 @@ export class CircuitScriptParser extends antlr.Parser {
|
|
|
3586
3586
|
for_expr() {
|
|
3587
3587
|
let localContext = new For_exprContext(this.context, this.state);
|
|
3588
3588
|
this.enterRule(localContext, 126, CircuitScriptParser.RULE_for_expr);
|
|
3589
|
+
let _la;
|
|
3589
3590
|
try {
|
|
3590
3591
|
this.enterOuterAlt(localContext, 1);
|
|
3591
3592
|
{
|
|
@@ -3593,13 +3594,29 @@ export class CircuitScriptParser extends antlr.Parser {
|
|
|
3593
3594
|
this.match(CircuitScriptParser.For);
|
|
3594
3595
|
this.state = 661;
|
|
3595
3596
|
this.match(CircuitScriptParser.ID);
|
|
3596
|
-
this.state =
|
|
3597
|
+
this.state = 666;
|
|
3598
|
+
this.errorHandler.sync(this);
|
|
3599
|
+
_la = this.tokenStream.LA(1);
|
|
3600
|
+
while (_la === 2) {
|
|
3601
|
+
{
|
|
3602
|
+
{
|
|
3603
|
+
this.state = 662;
|
|
3604
|
+
this.match(CircuitScriptParser.T__1);
|
|
3605
|
+
this.state = 663;
|
|
3606
|
+
this.match(CircuitScriptParser.ID);
|
|
3607
|
+
}
|
|
3608
|
+
}
|
|
3609
|
+
this.state = 668;
|
|
3610
|
+
this.errorHandler.sync(this);
|
|
3611
|
+
_la = this.tokenStream.LA(1);
|
|
3612
|
+
}
|
|
3613
|
+
this.state = 669;
|
|
3597
3614
|
this.match(CircuitScriptParser.In);
|
|
3598
|
-
this.state =
|
|
3615
|
+
this.state = 670;
|
|
3599
3616
|
this.data_expr(0);
|
|
3600
|
-
this.state =
|
|
3617
|
+
this.state = 671;
|
|
3601
3618
|
this.match(CircuitScriptParser.T__0);
|
|
3602
|
-
this.state =
|
|
3619
|
+
this.state = 672;
|
|
3603
3620
|
this.expressions_block();
|
|
3604
3621
|
}
|
|
3605
3622
|
}
|
|
@@ -3638,7 +3655,7 @@ export class CircuitScriptParser extends antlr.Parser {
|
|
|
3638
3655
|
return true;
|
|
3639
3656
|
}
|
|
3640
3657
|
static _serializedATN = [
|
|
3641
|
-
4, 1, 67,
|
|
3658
|
+
4, 1, 67, 675, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7,
|
|
3642
3659
|
6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13,
|
|
3643
3660
|
2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20,
|
|
3644
3661
|
7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26,
|
|
@@ -3694,81 +3711,82 @@ export class CircuitScriptParser extends antlr.Parser {
|
|
|
3694
3711
|
57, 1, 57, 1, 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 5, 59, 638,
|
|
3695
3712
|
8, 59, 10, 59, 12, 59, 641, 9, 59, 1, 59, 3, 59, 644, 8, 59, 1, 60, 1, 60, 1, 60, 1, 60,
|
|
3696
3713
|
1, 60, 1, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 63, 1, 63,
|
|
3697
|
-
1, 63, 1, 63,
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
1, 0, 0, 0,
|
|
3706
|
-
0,
|
|
3707
|
-
|
|
3708
|
-
1, 0, 0, 0,
|
|
3709
|
-
0, 0,
|
|
3710
|
-
|
|
3711
|
-
1, 0, 0, 0,
|
|
3712
|
-
0, 0,
|
|
3713
|
-
|
|
3714
|
-
1, 0, 0, 0,
|
|
3715
|
-
0, 0,
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
0,
|
|
3722
|
-
3,
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
0, 0, 158,
|
|
3729
|
-
0, 0, 158,
|
|
3730
|
-
0, 0, 158,
|
|
3731
|
-
0, 0, 158,
|
|
3732
|
-
0, 0, 158,
|
|
3733
|
-
0,
|
|
3734
|
-
0, 0,
|
|
3735
|
-
0, 0,
|
|
3736
|
-
0,
|
|
3737
|
-
0,
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
0,
|
|
3742
|
-
0,
|
|
3743
|
-
0,
|
|
3744
|
-
0, 0,
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
1, 0, 0, 0,
|
|
3748
|
-
1, 0, 0, 0,
|
|
3749
|
-
1, 0, 0, 0,
|
|
3750
|
-
1, 0, 0, 0,
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
259, 1, 0, 0, 0,
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3714
|
+
1, 63, 1, 63, 5, 63, 665, 8, 63, 10, 63, 12, 63, 668, 9, 63, 1, 63, 1, 63, 1, 63, 1, 63,
|
|
3715
|
+
1, 63, 1, 63, 0, 1, 62, 64, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32,
|
|
3716
|
+
34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76,
|
|
3717
|
+
78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114,
|
|
3718
|
+
116, 118, 120, 122, 124, 126, 0, 14, 2, 0, 9, 9, 19, 21, 1, 0, 56, 57, 2, 0, 57, 57, 60,
|
|
3719
|
+
60, 2, 0, 54, 54, 57, 57, 1, 0, 47, 51, 1, 0, 44, 46, 1, 0, 42, 43, 1, 0, 40, 41, 1, 0, 34,
|
|
3720
|
+
39, 2, 0, 31, 31, 43, 43, 2, 0, 55, 55, 57, 61, 2, 0, 15, 15, 56, 56, 2, 0, 56, 57, 60,
|
|
3721
|
+
60, 1, 0, 32, 33, 711, 0, 130, 1, 0, 0, 0, 2, 158, 1, 0, 0, 0, 4, 160, 1, 0, 0, 0, 6, 171,
|
|
3722
|
+
1, 0, 0, 0, 8, 175, 1, 0, 0, 0, 10, 179, 1, 0, 0, 0, 12, 191, 1, 0, 0, 0, 14, 195, 1, 0, 0,
|
|
3723
|
+
0, 16, 198, 1, 0, 0, 0, 18, 206, 1, 0, 0, 0, 20, 217, 1, 0, 0, 0, 22, 222, 1, 0, 0, 0, 24,
|
|
3724
|
+
224, 1, 0, 0, 0, 26, 226, 1, 0, 0, 0, 28, 231, 1, 0, 0, 0, 30, 243, 1, 0, 0, 0, 32, 265,
|
|
3725
|
+
1, 0, 0, 0, 34, 275, 1, 0, 0, 0, 36, 277, 1, 0, 0, 0, 38, 291, 1, 0, 0, 0, 40, 293, 1, 0,
|
|
3726
|
+
0, 0, 42, 301, 1, 0, 0, 0, 44, 303, 1, 0, 0, 0, 46, 305, 1, 0, 0, 0, 48, 307, 1, 0, 0, 0,
|
|
3727
|
+
50, 309, 1, 0, 0, 0, 52, 313, 1, 0, 0, 0, 54, 317, 1, 0, 0, 0, 56, 344, 1, 0, 0, 0, 58, 346,
|
|
3728
|
+
1, 0, 0, 0, 60, 350, 1, 0, 0, 0, 62, 372, 1, 0, 0, 0, 64, 392, 1, 0, 0, 0, 66, 394, 1, 0,
|
|
3729
|
+
0, 0, 68, 397, 1, 0, 0, 0, 70, 401, 1, 0, 0, 0, 72, 421, 1, 0, 0, 0, 74, 452, 1, 0, 0, 0,
|
|
3730
|
+
76, 454, 1, 0, 0, 0, 78, 469, 1, 0, 0, 0, 80, 472, 1, 0, 0, 0, 82, 481, 1, 0, 0, 0, 84, 487,
|
|
3731
|
+
1, 0, 0, 0, 86, 490, 1, 0, 0, 0, 88, 494, 1, 0, 0, 0, 90, 507, 1, 0, 0, 0, 92, 517, 1, 0,
|
|
3732
|
+
0, 0, 94, 522, 1, 0, 0, 0, 96, 536, 1, 0, 0, 0, 98, 572, 1, 0, 0, 0, 100, 574, 1, 0, 0, 0,
|
|
3733
|
+
102, 578, 1, 0, 0, 0, 104, 589, 1, 0, 0, 0, 106, 597, 1, 0, 0, 0, 108, 599, 1, 0, 0, 0,
|
|
3734
|
+
110, 606, 1, 0, 0, 0, 112, 622, 1, 0, 0, 0, 114, 625, 1, 0, 0, 0, 116, 628, 1, 0, 0, 0,
|
|
3735
|
+
118, 632, 1, 0, 0, 0, 120, 645, 1, 0, 0, 0, 122, 651, 1, 0, 0, 0, 124, 655, 1, 0, 0, 0,
|
|
3736
|
+
126, 660, 1, 0, 0, 0, 128, 131, 3, 2, 1, 0, 129, 131, 5, 64, 0, 0, 130, 128, 1, 0, 0, 0,
|
|
3737
|
+
130, 129, 1, 0, 0, 0, 131, 132, 1, 0, 0, 0, 132, 130, 1, 0, 0, 0, 132, 133, 1, 0, 0, 0,
|
|
3738
|
+
133, 134, 1, 0, 0, 0, 134, 135, 5, 0, 0, 1, 135, 1, 1, 0, 0, 0, 136, 159, 3, 20, 10, 0,
|
|
3739
|
+
137, 159, 3, 28, 14, 0, 138, 159, 3, 26, 13, 0, 139, 159, 3, 50, 25, 0, 140, 159, 3,
|
|
3740
|
+
52, 26, 0, 141, 159, 3, 58, 29, 0, 142, 159, 3, 10, 5, 0, 143, 159, 3, 60, 30, 0, 144,
|
|
3741
|
+
159, 3, 46, 23, 0, 145, 159, 3, 48, 24, 0, 146, 159, 3, 70, 35, 0, 147, 159, 3, 80, 40,
|
|
3742
|
+
0, 148, 159, 3, 108, 54, 0, 149, 159, 3, 114, 57, 0, 150, 159, 3, 116, 58, 0, 151, 159,
|
|
3743
|
+
3, 76, 38, 0, 152, 159, 3, 36, 18, 0, 153, 159, 3, 6, 3, 0, 154, 159, 3, 112, 56, 0, 155,
|
|
3744
|
+
159, 3, 118, 59, 0, 156, 159, 3, 124, 62, 0, 157, 159, 3, 126, 63, 0, 158, 136, 1, 0,
|
|
3745
|
+
0, 0, 158, 137, 1, 0, 0, 0, 158, 138, 1, 0, 0, 0, 158, 139, 1, 0, 0, 0, 158, 140, 1, 0,
|
|
3746
|
+
0, 0, 158, 141, 1, 0, 0, 0, 158, 142, 1, 0, 0, 0, 158, 143, 1, 0, 0, 0, 158, 144, 1, 0,
|
|
3747
|
+
0, 0, 158, 145, 1, 0, 0, 0, 158, 146, 1, 0, 0, 0, 158, 147, 1, 0, 0, 0, 158, 148, 1, 0,
|
|
3748
|
+
0, 0, 158, 149, 1, 0, 0, 0, 158, 150, 1, 0, 0, 0, 158, 151, 1, 0, 0, 0, 158, 152, 1, 0,
|
|
3749
|
+
0, 0, 158, 153, 1, 0, 0, 0, 158, 154, 1, 0, 0, 0, 158, 155, 1, 0, 0, 0, 158, 156, 1, 0,
|
|
3750
|
+
0, 0, 158, 157, 1, 0, 0, 0, 159, 3, 1, 0, 0, 0, 160, 161, 5, 64, 0, 0, 161, 164, 5, 66,
|
|
3751
|
+
0, 0, 162, 165, 5, 64, 0, 0, 163, 165, 3, 2, 1, 0, 164, 162, 1, 0, 0, 0, 164, 163, 1, 0,
|
|
3752
|
+
0, 0, 165, 166, 1, 0, 0, 0, 166, 164, 1, 0, 0, 0, 166, 167, 1, 0, 0, 0, 167, 168, 1, 0,
|
|
3753
|
+
0, 0, 168, 169, 5, 67, 0, 0, 169, 5, 1, 0, 0, 0, 170, 172, 3, 8, 4, 0, 171, 170, 1, 0, 0,
|
|
3754
|
+
0, 172, 173, 1, 0, 0, 0, 173, 171, 1, 0, 0, 0, 173, 174, 1, 0, 0, 0, 174, 7, 1, 0, 0, 0,
|
|
3755
|
+
175, 176, 7, 0, 0, 0, 176, 177, 5, 1, 0, 0, 177, 178, 3, 4, 2, 0, 178, 9, 1, 0, 0, 0, 179,
|
|
3756
|
+
180, 3, 76, 38, 0, 180, 181, 5, 1, 0, 0, 181, 182, 5, 64, 0, 0, 182, 185, 5, 66, 0, 0,
|
|
3757
|
+
183, 186, 5, 64, 0, 0, 184, 186, 3, 12, 6, 0, 185, 183, 1, 0, 0, 0, 185, 184, 1, 0, 0,
|
|
3758
|
+
0, 186, 187, 1, 0, 0, 0, 187, 185, 1, 0, 0, 0, 187, 188, 1, 0, 0, 0, 188, 189, 1, 0, 0,
|
|
3759
|
+
0, 189, 190, 5, 67, 0, 0, 190, 11, 1, 0, 0, 0, 191, 192, 7, 1, 0, 0, 192, 193, 5, 1, 0,
|
|
3760
|
+
0, 193, 194, 3, 68, 34, 0, 194, 13, 1, 0, 0, 0, 195, 196, 5, 15, 0, 0, 196, 197, 7, 2,
|
|
3761
|
+
0, 0, 197, 15, 1, 0, 0, 0, 198, 199, 5, 56, 0, 0, 199, 202, 5, 1, 0, 0, 200, 203, 3, 68,
|
|
3762
|
+
34, 0, 201, 203, 5, 56, 0, 0, 202, 200, 1, 0, 0, 0, 202, 201, 1, 0, 0, 0, 203, 17, 1, 0,
|
|
3763
|
+
0, 0, 204, 207, 3, 62, 31, 0, 205, 207, 3, 50, 25, 0, 206, 204, 1, 0, 0, 0, 206, 205,
|
|
3764
|
+
1, 0, 0, 0, 207, 211, 1, 0, 0, 0, 208, 210, 3, 16, 8, 0, 209, 208, 1, 0, 0, 0, 210, 213,
|
|
3765
|
+
1, 0, 0, 0, 211, 209, 1, 0, 0, 0, 211, 212, 1, 0, 0, 0, 212, 215, 1, 0, 0, 0, 213, 211,
|
|
3766
|
+
1, 0, 0, 0, 214, 216, 3, 14, 7, 0, 215, 214, 1, 0, 0, 0, 215, 216, 1, 0, 0, 0, 216, 19,
|
|
3767
|
+
1, 0, 0, 0, 217, 218, 5, 16, 0, 0, 218, 219, 3, 18, 9, 0, 219, 21, 1, 0, 0, 0, 220, 223,
|
|
3768
|
+
3, 18, 9, 0, 221, 223, 3, 14, 7, 0, 222, 220, 1, 0, 0, 0, 222, 221, 1, 0, 0, 0, 223, 23,
|
|
3769
|
+
1, 0, 0, 0, 224, 225, 7, 2, 0, 0, 225, 25, 1, 0, 0, 0, 226, 229, 5, 17, 0, 0, 227, 230,
|
|
3770
|
+
3, 22, 11, 0, 228, 230, 5, 19, 0, 0, 229, 227, 1, 0, 0, 0, 229, 228, 1, 0, 0, 0, 230, 27,
|
|
3771
|
+
1, 0, 0, 0, 231, 241, 5, 18, 0, 0, 232, 237, 3, 22, 11, 0, 233, 234, 5, 2, 0, 0, 234, 236,
|
|
3772
|
+
3, 22, 11, 0, 235, 233, 1, 0, 0, 0, 236, 239, 1, 0, 0, 0, 237, 235, 1, 0, 0, 0, 237, 238,
|
|
3773
|
+
1, 0, 0, 0, 238, 242, 1, 0, 0, 0, 239, 237, 1, 0, 0, 0, 240, 242, 5, 19, 0, 0, 241, 232,
|
|
3774
|
+
1, 0, 0, 0, 241, 240, 1, 0, 0, 0, 242, 29, 1, 0, 0, 0, 243, 244, 5, 17, 0, 0, 244, 245,
|
|
3775
|
+
3, 22, 11, 0, 245, 246, 5, 18, 0, 0, 246, 251, 3, 22, 11, 0, 247, 248, 5, 2, 0, 0, 248,
|
|
3776
|
+
250, 3, 22, 11, 0, 249, 247, 1, 0, 0, 0, 250, 253, 1, 0, 0, 0, 251, 249, 1, 0, 0, 0, 251,
|
|
3777
|
+
252, 1, 0, 0, 0, 252, 254, 1, 0, 0, 0, 253, 251, 1, 0, 0, 0, 254, 255, 5, 1, 0, 0, 255,
|
|
3778
|
+
256, 5, 64, 0, 0, 256, 259, 5, 66, 0, 0, 257, 260, 5, 64, 0, 0, 258, 260, 3, 32, 16, 0,
|
|
3779
|
+
259, 257, 1, 0, 0, 0, 259, 258, 1, 0, 0, 0, 260, 261, 1, 0, 0, 0, 261, 259, 1, 0, 0, 0,
|
|
3780
|
+
261, 262, 1, 0, 0, 0, 262, 263, 1, 0, 0, 0, 263, 264, 5, 67, 0, 0, 264, 31, 1, 0, 0, 0,
|
|
3781
|
+
265, 266, 3, 24, 12, 0, 266, 267, 5, 1, 0, 0, 267, 272, 3, 34, 17, 0, 268, 269, 5, 2,
|
|
3782
|
+
0, 0, 269, 271, 3, 34, 17, 0, 270, 268, 1, 0, 0, 0, 271, 274, 1, 0, 0, 0, 272, 270, 1,
|
|
3783
|
+
0, 0, 0, 272, 273, 1, 0, 0, 0, 273, 33, 1, 0, 0, 0, 274, 272, 1, 0, 0, 0, 275, 276, 7, 3,
|
|
3784
|
+
0, 0, 276, 35, 1, 0, 0, 0, 277, 278, 3, 26, 13, 0, 278, 279, 5, 1, 0, 0, 279, 280, 5, 64,
|
|
3785
|
+
0, 0, 280, 283, 5, 66, 0, 0, 281, 284, 5, 64, 0, 0, 282, 284, 3, 38, 19, 0, 283, 281,
|
|
3786
|
+
1, 0, 0, 0, 283, 282, 1, 0, 0, 0, 284, 285, 1, 0, 0, 0, 285, 283, 1, 0, 0, 0, 285, 286,
|
|
3787
|
+
1, 0, 0, 0, 286, 287, 1, 0, 0, 0, 287, 288, 5, 67, 0, 0, 288, 37, 1, 0, 0, 0, 289, 292,
|
|
3788
|
+
3, 2, 1, 0, 290, 292, 3, 40, 20, 0, 291, 289, 1, 0, 0, 0, 291, 290, 1, 0, 0, 0, 292, 39,
|
|
3789
|
+
1, 0, 0, 0, 293, 294, 3, 24, 12, 0, 294, 297, 5, 1, 0, 0, 295, 298, 3, 42, 21, 0, 296,
|
|
3772
3790
|
298, 3, 44, 22, 0, 297, 295, 1, 0, 0, 0, 297, 296, 1, 0, 0, 0, 298, 41, 1, 0, 0, 0, 299,
|
|
3773
3791
|
302, 3, 2, 1, 0, 300, 302, 5, 54, 0, 0, 301, 299, 1, 0, 0, 0, 301, 300, 1, 0, 0, 0, 302,
|
|
3774
3792
|
43, 1, 0, 0, 0, 303, 304, 3, 4, 2, 0, 304, 45, 1, 0, 0, 0, 305, 306, 5, 8, 0, 0, 306, 47,
|
|
@@ -3875,13 +3893,15 @@ export class CircuitScriptParser extends antlr.Parser {
|
|
|
3875
3893
|
648, 3, 62, 31, 0, 648, 649, 5, 1, 0, 0, 649, 650, 3, 4, 2, 0, 650, 121, 1, 0, 0, 0, 651,
|
|
3876
3894
|
652, 5, 30, 0, 0, 652, 653, 5, 1, 0, 0, 653, 654, 3, 4, 2, 0, 654, 123, 1, 0, 0, 0, 655,
|
|
3877
3895
|
656, 5, 27, 0, 0, 656, 657, 3, 62, 31, 0, 657, 658, 5, 1, 0, 0, 658, 659, 3, 4, 2, 0, 659,
|
|
3878
|
-
125, 1, 0, 0, 0, 660, 661, 5, 25, 0, 0, 661,
|
|
3879
|
-
|
|
3896
|
+
125, 1, 0, 0, 0, 660, 661, 5, 25, 0, 0, 661, 666, 5, 56, 0, 0, 662, 663, 5, 2, 0, 0, 663,
|
|
3897
|
+
665, 5, 56, 0, 0, 664, 662, 1, 0, 0, 0, 665, 668, 1, 0, 0, 0, 666, 664, 1, 0, 0, 0, 666,
|
|
3898
|
+
667, 1, 0, 0, 0, 667, 669, 1, 0, 0, 0, 668, 666, 1, 0, 0, 0, 669, 670, 5, 26, 0, 0, 670,
|
|
3899
|
+
671, 3, 62, 31, 0, 671, 672, 5, 1, 0, 0, 672, 673, 3, 4, 2, 0, 673, 127, 1, 0, 0, 0, 71,
|
|
3880
3900
|
130, 132, 158, 164, 166, 173, 185, 187, 202, 206, 211, 215, 222, 229, 237, 241,
|
|
3881
3901
|
251, 259, 261, 272, 283, 285, 291, 297, 301, 326, 333, 341, 344, 362, 372, 387,
|
|
3882
3902
|
389, 397, 405, 413, 415, 421, 428, 437, 449, 452, 459, 464, 469, 472, 478, 481,
|
|
3883
3903
|
485, 501, 503, 511, 513, 530, 532, 540, 542, 548, 556, 564, 572, 586, 589, 594,
|
|
3884
|
-
597, 603, 612, 617, 639, 643
|
|
3904
|
+
597, 603, 612, 617, 639, 643, 666
|
|
3885
3905
|
];
|
|
3886
3906
|
static __ATN;
|
|
3887
3907
|
static get _ATN() {
|
|
@@ -6002,8 +6022,13 @@ export class For_exprContext extends antlr.ParserRuleContext {
|
|
|
6002
6022
|
For() {
|
|
6003
6023
|
return this.getToken(CircuitScriptParser.For, 0);
|
|
6004
6024
|
}
|
|
6005
|
-
ID() {
|
|
6006
|
-
|
|
6025
|
+
ID(i) {
|
|
6026
|
+
if (i === undefined) {
|
|
6027
|
+
return this.getTokens(CircuitScriptParser.ID);
|
|
6028
|
+
}
|
|
6029
|
+
else {
|
|
6030
|
+
return this.getToken(CircuitScriptParser.ID, i);
|
|
6031
|
+
}
|
|
6007
6032
|
}
|
|
6008
6033
|
In() {
|
|
6009
6034
|
return this.getToken(CircuitScriptParser.In, 0);
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export function linkBuiltInMethods(context, visitor) {
|
|
2
|
+
context.createFunction('print', (params) => {
|
|
3
|
+
const args = getPositionParams(params);
|
|
4
|
+
const items = args.map(item => toString(item));
|
|
5
|
+
if (visitor.printToConsole) {
|
|
6
|
+
console.log('::', ...items);
|
|
7
|
+
}
|
|
8
|
+
const printedValue = items.join(" ");
|
|
9
|
+
visitor.printStream.push(printedValue);
|
|
10
|
+
return [visitor, printedValue];
|
|
11
|
+
});
|
|
12
|
+
const builtIns = [
|
|
13
|
+
['enumerate', enumerate],
|
|
14
|
+
['toMils', toMils],
|
|
15
|
+
['range', range],
|
|
16
|
+
['len', objectLength],
|
|
17
|
+
];
|
|
18
|
+
builtIns.forEach(([functionName, functionImpl]) => {
|
|
19
|
+
context.createFunction(functionName, params => {
|
|
20
|
+
const args = getPositionParams(params);
|
|
21
|
+
const functionReturn = functionImpl(...args);
|
|
22
|
+
return [visitor, functionReturn];
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function range(...args) {
|
|
27
|
+
let startValue = 0;
|
|
28
|
+
let endValue = 0;
|
|
29
|
+
if (args.length === 1) {
|
|
30
|
+
endValue = args[0];
|
|
31
|
+
}
|
|
32
|
+
else if (args.length === 2) {
|
|
33
|
+
startValue = args[0];
|
|
34
|
+
endValue = args[1];
|
|
35
|
+
}
|
|
36
|
+
const returnArray = [];
|
|
37
|
+
for (let i = startValue; i < endValue; i++) {
|
|
38
|
+
returnArray.push(i);
|
|
39
|
+
}
|
|
40
|
+
return returnArray;
|
|
41
|
+
}
|
|
42
|
+
function enumerate(array) {
|
|
43
|
+
if (!Array.isArray(array)) {
|
|
44
|
+
throw "Invalid parameter for enumerate function!";
|
|
45
|
+
}
|
|
46
|
+
const output = array.map((item, index) => {
|
|
47
|
+
return [index, item];
|
|
48
|
+
});
|
|
49
|
+
return output;
|
|
50
|
+
}
|
|
51
|
+
function toMils(value) {
|
|
52
|
+
if (isNaN(value)) {
|
|
53
|
+
throw "Invalid input for method toMils";
|
|
54
|
+
}
|
|
55
|
+
return value / 25.4 * 1000;
|
|
56
|
+
}
|
|
57
|
+
function objectLength(obj) {
|
|
58
|
+
if (Array.isArray(obj)) {
|
|
59
|
+
return obj.length;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
if (obj.length) {
|
|
63
|
+
return obj.length;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
throw "Could not get length of object: " + obj;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function getPositionParams(params) {
|
|
71
|
+
return params.map(([, , value]) => value);
|
|
72
|
+
}
|
|
73
|
+
function toString(obj) {
|
|
74
|
+
if (typeof obj === 'string') {
|
|
75
|
+
return `"${obj}"`;
|
|
76
|
+
}
|
|
77
|
+
else if (typeof obj === 'number') {
|
|
78
|
+
return obj.toString();
|
|
79
|
+
}
|
|
80
|
+
else if (Array.isArray(obj)) {
|
|
81
|
+
const inner = obj.map(item => toString(item)).join(", ");
|
|
82
|
+
return "[" + inner + "]";
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
if (obj.toString) {
|
|
86
|
+
return obj.toString();
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
throw "Could not create string from object: " + obj;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
package/dist/esm/layout.mjs
CHANGED
|
@@ -285,8 +285,8 @@ export class LayoutEngine {
|
|
|
285
285
|
boundPoints.push([innerFrame.x, innerFrame.y], [innerFrame.x + frameWidth, innerFrame.y + frameHeight]);
|
|
286
286
|
});
|
|
287
287
|
const contentsBounds = resizeBounds(getBoundsFromPoints(boundPoints), frame.padding);
|
|
288
|
-
if (frame.frame.parameters.has(FrameParamKeys.
|
|
289
|
-
const frameComponent = frame.frame.parameters.get(FrameParamKeys.
|
|
288
|
+
if (frame.frame.parameters.has(FrameParamKeys.SheetType)) {
|
|
289
|
+
const frameComponent = frame.frame.parameters.get(FrameParamKeys.SheetType);
|
|
290
290
|
const rects = ExtractDrawingRects(frameComponent.displayProp);
|
|
291
291
|
let frameWidth = 0;
|
|
292
292
|
let frameHeight = 0;
|
|
@@ -16,7 +16,7 @@ export var FrameParamKeys;
|
|
|
16
16
|
FrameParamKeys["Width"] = "width";
|
|
17
17
|
FrameParamKeys["Height"] = "height";
|
|
18
18
|
FrameParamKeys["PaperSize"] = "paper_size";
|
|
19
|
-
FrameParamKeys["
|
|
19
|
+
FrameParamKeys["SheetType"] = "sheet_type";
|
|
20
20
|
})(FrameParamKeys || (FrameParamKeys = {}));
|
|
21
21
|
export var FramePlotDirection;
|
|
22
22
|
(function (FramePlotDirection) {
|
package/dist/esm/render.mjs
CHANGED
|
@@ -30,7 +30,7 @@ export function renderSheetsToSVG(sheetFrames) {
|
|
|
30
30
|
let sheetYOffset = 0;
|
|
31
31
|
if (sheet.frame.frame) {
|
|
32
32
|
const frameComponent = sheet.frame.frame.parameters
|
|
33
|
-
.get(FrameParamKeys.
|
|
33
|
+
.get(FrameParamKeys.SheetType);
|
|
34
34
|
if (frameComponent) {
|
|
35
35
|
if (frameComponent.displayProp === null) {
|
|
36
36
|
throw 'Invalid graphic object for sheet frame';
|
|
@@ -248,8 +248,8 @@ function drawGrid(group, canvasSize, extendGrid) {
|
|
|
248
248
|
}
|
|
249
249
|
function drawSheetFrameBorder(frameGroup, frame) {
|
|
250
250
|
const frameParams = frame.frame.parameters;
|
|
251
|
-
if (frameParams.has(FrameParamKeys.
|
|
252
|
-
const frameComponent = frameParams.get(FrameParamKeys.
|
|
251
|
+
if (frameParams.has(FrameParamKeys.SheetType)) {
|
|
252
|
+
const frameComponent = frameParams.get(FrameParamKeys.SheetType);
|
|
253
253
|
const { displayProp = null } = frameComponent ?? {};
|
|
254
254
|
if (displayProp) {
|
|
255
255
|
const sheetFrameGroup = frameGroup.group();
|
package/dist/esm/visitor.mjs
CHANGED
|
@@ -886,7 +886,7 @@ export class ParserVisitor extends BaseVisitor {
|
|
|
886
886
|
this.log('exit while loop');
|
|
887
887
|
};
|
|
888
888
|
visitFor_expr = (ctx) => {
|
|
889
|
-
const
|
|
889
|
+
const forVariableNames = ctx.ID().map(item => item.getText());
|
|
890
890
|
const ctxDataExpr = ctx.data_expr();
|
|
891
891
|
this.visit(ctxDataExpr);
|
|
892
892
|
const listItems = this.getResult(ctxDataExpr);
|
|
@@ -895,7 +895,13 @@ export class ParserVisitor extends BaseVisitor {
|
|
|
895
895
|
let counter = 0;
|
|
896
896
|
while (keepLooping) {
|
|
897
897
|
if (counter < listItems.length) {
|
|
898
|
-
|
|
898
|
+
let useValueArray = listItems[counter];
|
|
899
|
+
if (!Array.isArray(useValueArray)) {
|
|
900
|
+
useValueArray = [useValueArray];
|
|
901
|
+
}
|
|
902
|
+
useValueArray.forEach((value, index) => {
|
|
903
|
+
this.getExecutor().scope.variables.set(forVariableNames[index], value);
|
|
904
|
+
});
|
|
899
905
|
this.visit(ctx.expressions_block());
|
|
900
906
|
keepLooping = true;
|
|
901
907
|
const currentResult = this.getResult(ctx) ?? {};
|
|
@@ -1123,11 +1129,11 @@ export class ParserVisitor extends BaseVisitor {
|
|
|
1123
1129
|
const baseScope = this.getExecutor().scope;
|
|
1124
1130
|
const document = baseScope.variables.get(GlobalDocumentName);
|
|
1125
1131
|
let frameComponent = null;
|
|
1126
|
-
if (document && document[FrameParamKeys.
|
|
1127
|
-
frameComponent = document[FrameParamKeys.
|
|
1132
|
+
if (document && document[FrameParamKeys.SheetType]) {
|
|
1133
|
+
frameComponent = document[FrameParamKeys.SheetType];
|
|
1128
1134
|
baseScope.frames.forEach(item => {
|
|
1129
1135
|
if (item.frameType === FrameType.Sheet) {
|
|
1130
|
-
item.parameters.set(FrameParamKeys.
|
|
1136
|
+
item.parameters.set(FrameParamKeys.SheetType, frameComponent);
|
|
1131
1137
|
}
|
|
1132
1138
|
});
|
|
1133
1139
|
}
|
|
@@ -28,7 +28,6 @@ export declare class BaseVisitor extends CircuitScriptVisitor<ComplexType | Refe
|
|
|
28
28
|
};
|
|
29
29
|
constructor(silent: boolean | undefined, onErrorHandler: OnErrorCallback | null | undefined, currentDirectory: string | null, defaultLibsPath: string);
|
|
30
30
|
getExecutor(): ExecutionContext;
|
|
31
|
-
protected toString(obj: any): string;
|
|
32
31
|
protected setupPrintFunction(context: ExecutionContext): void;
|
|
33
32
|
createNetResolver(executionStack: ExecutionContext[]): (netName: string, netNamespace: string) => {
|
|
34
33
|
found: boolean;
|
|
@@ -886,7 +886,8 @@ export declare class While_exprContext extends antlr.ParserRuleContext {
|
|
|
886
886
|
export declare class For_exprContext extends antlr.ParserRuleContext {
|
|
887
887
|
constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
|
|
888
888
|
For(): antlr.TerminalNode;
|
|
889
|
-
ID(): antlr.TerminalNode;
|
|
889
|
+
ID(): antlr.TerminalNode[];
|
|
890
|
+
ID(i: number): antlr.TerminalNode | null;
|
|
890
891
|
In(): antlr.TerminalNode;
|
|
891
892
|
data_expr(): Data_exprContext;
|
|
892
893
|
expressions_block(): Expressions_blockContext;
|