circuitscript 0.0.35 → 0.0.37

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.
@@ -9,6 +9,7 @@ import { NumericValue, PercentageValue } from "./objects/ParamDefinition";
9
9
  import { PinTypes } from "./objects/PinTypes";
10
10
  import { Direction, UndeclaredReference } from "./objects/types";
11
11
  import { GlobalDocumentName, ReferenceTypes } from './globals';
12
+ import { linkBuiltInMethods } from './builtinMethods';
12
13
  export class BaseVisitor extends CircuitScriptVisitor {
13
14
  indentLevel = 0;
14
15
  startingContext;
@@ -52,69 +53,8 @@ export class BaseVisitor extends CircuitScriptVisitor {
52
53
  getExecutor() {
53
54
  return this.executionStack[this.executionStack.length - 1];
54
55
  }
55
- toString(obj) {
56
- if (typeof obj === 'string') {
57
- return `"${obj}"`;
58
- }
59
- else if (typeof obj === 'number') {
60
- return obj.toString();
61
- }
62
- else if (Array.isArray(obj)) {
63
- const inner = obj.map(item => this.toString(item)).join(", ");
64
- return "[" + inner + "]";
65
- }
66
- else {
67
- if (obj.toString) {
68
- return obj.toString();
69
- }
70
- else {
71
- throw "Could not create string from object: " + obj;
72
- }
73
- }
74
- }
75
56
  setupPrintFunction(context) {
76
- context.createFunction('print', (params) => {
77
- const items = params.map(([, , value]) => {
78
- return this.toString(value);
79
- });
80
- if (this.printToConsole) {
81
- console.log('::', ...items);
82
- }
83
- this.printStream.push(...items);
84
- return [this, null];
85
- });
86
- context.createFunction('range', (params) => {
87
- const items = params.map(([, , value]) => {
88
- if (isNaN(value)) {
89
- throw 'Invalid value: ' + value;
90
- }
91
- return value;
92
- });
93
- let startValue = 0;
94
- let endValue = 0;
95
- if (items.length === 1) {
96
- endValue = items[0];
97
- }
98
- else if (items.length === 2) {
99
- startValue = items[0];
100
- endValue = items[1];
101
- }
102
- const returnArray = [];
103
- for (let i = startValue; i < endValue; i++) {
104
- returnArray.push(i);
105
- }
106
- return [this, returnArray];
107
- });
108
- context.createFunction('enumerate', (params) => {
109
- const [, , array] = params[0];
110
- if (!Array.isArray(array)) {
111
- throw "Invalid parameter for enumerate function!";
112
- }
113
- const output = array.map((item, index) => {
114
- return [index, item];
115
- });
116
- return [this, output];
117
- });
57
+ linkBuiltInMethods(context, this);
118
58
  }
119
59
  createNetResolver(executionStack) {
120
60
  const resolveNet = (netName, netNamespace) => {
@@ -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 = 662;
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 = 663;
3615
+ this.state = 670;
3599
3616
  this.data_expr(0);
3600
- this.state = 664;
3617
+ this.state = 671;
3601
3618
  this.match(CircuitScriptParser.T__0);
3602
- this.state = 665;
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, 668, 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,
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, 1, 63, 1, 63, 1, 63, 1, 63, 0, 1, 62, 64, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
3698
- 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62,
3699
- 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104,
3700
- 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 0, 14, 2, 0, 9, 9, 19, 21, 1,
3701
- 0, 56, 57, 2, 0, 57, 57, 60, 60, 2, 0, 54, 54, 57, 57, 1, 0, 47, 51, 1, 0, 44, 46, 1, 0,
3702
- 42, 43, 1, 0, 40, 41, 1, 0, 34, 39, 2, 0, 31, 31, 43, 43, 2, 0, 55, 55, 57, 61, 2, 0, 15,
3703
- 15, 56, 56, 2, 0, 56, 57, 60, 60, 1, 0, 32, 33, 703, 0, 130, 1, 0, 0, 0, 2, 158, 1, 0, 0,
3704
- 0, 4, 160, 1, 0, 0, 0, 6, 171, 1, 0, 0, 0, 8, 175, 1, 0, 0, 0, 10, 179, 1, 0, 0, 0, 12, 191,
3705
- 1, 0, 0, 0, 14, 195, 1, 0, 0, 0, 16, 198, 1, 0, 0, 0, 18, 206, 1, 0, 0, 0, 20, 217, 1, 0,
3706
- 0, 0, 22, 222, 1, 0, 0, 0, 24, 224, 1, 0, 0, 0, 26, 226, 1, 0, 0, 0, 28, 231, 1, 0, 0, 0,
3707
- 30, 243, 1, 0, 0, 0, 32, 265, 1, 0, 0, 0, 34, 275, 1, 0, 0, 0, 36, 277, 1, 0, 0, 0, 38, 291,
3708
- 1, 0, 0, 0, 40, 293, 1, 0, 0, 0, 42, 301, 1, 0, 0, 0, 44, 303, 1, 0, 0, 0, 46, 305, 1, 0,
3709
- 0, 0, 48, 307, 1, 0, 0, 0, 50, 309, 1, 0, 0, 0, 52, 313, 1, 0, 0, 0, 54, 317, 1, 0, 0, 0,
3710
- 56, 344, 1, 0, 0, 0, 58, 346, 1, 0, 0, 0, 60, 350, 1, 0, 0, 0, 62, 372, 1, 0, 0, 0, 64, 392,
3711
- 1, 0, 0, 0, 66, 394, 1, 0, 0, 0, 68, 397, 1, 0, 0, 0, 70, 401, 1, 0, 0, 0, 72, 421, 1, 0,
3712
- 0, 0, 74, 452, 1, 0, 0, 0, 76, 454, 1, 0, 0, 0, 78, 469, 1, 0, 0, 0, 80, 472, 1, 0, 0, 0,
3713
- 82, 481, 1, 0, 0, 0, 84, 487, 1, 0, 0, 0, 86, 490, 1, 0, 0, 0, 88, 494, 1, 0, 0, 0, 90, 507,
3714
- 1, 0, 0, 0, 92, 517, 1, 0, 0, 0, 94, 522, 1, 0, 0, 0, 96, 536, 1, 0, 0, 0, 98, 572, 1, 0,
3715
- 0, 0, 100, 574, 1, 0, 0, 0, 102, 578, 1, 0, 0, 0, 104, 589, 1, 0, 0, 0, 106, 597, 1, 0,
3716
- 0, 0, 108, 599, 1, 0, 0, 0, 110, 606, 1, 0, 0, 0, 112, 622, 1, 0, 0, 0, 114, 625, 1, 0,
3717
- 0, 0, 116, 628, 1, 0, 0, 0, 118, 632, 1, 0, 0, 0, 120, 645, 1, 0, 0, 0, 122, 651, 1, 0,
3718
- 0, 0, 124, 655, 1, 0, 0, 0, 126, 660, 1, 0, 0, 0, 128, 131, 3, 2, 1, 0, 129, 131, 5, 64,
3719
- 0, 0, 130, 128, 1, 0, 0, 0, 130, 129, 1, 0, 0, 0, 131, 132, 1, 0, 0, 0, 132, 130, 1, 0,
3720
- 0, 0, 132, 133, 1, 0, 0, 0, 133, 134, 1, 0, 0, 0, 134, 135, 5, 0, 0, 1, 135, 1, 1, 0, 0,
3721
- 0, 136, 159, 3, 20, 10, 0, 137, 159, 3, 28, 14, 0, 138, 159, 3, 26, 13, 0, 139, 159,
3722
- 3, 50, 25, 0, 140, 159, 3, 52, 26, 0, 141, 159, 3, 58, 29, 0, 142, 159, 3, 10, 5, 0, 143,
3723
- 159, 3, 60, 30, 0, 144, 159, 3, 46, 23, 0, 145, 159, 3, 48, 24, 0, 146, 159, 3, 70, 35,
3724
- 0, 147, 159, 3, 80, 40, 0, 148, 159, 3, 108, 54, 0, 149, 159, 3, 114, 57, 0, 150, 159,
3725
- 3, 116, 58, 0, 151, 159, 3, 76, 38, 0, 152, 159, 3, 36, 18, 0, 153, 159, 3, 6, 3, 0, 154,
3726
- 159, 3, 112, 56, 0, 155, 159, 3, 118, 59, 0, 156, 159, 3, 124, 62, 0, 157, 159, 3, 126,
3727
- 63, 0, 158, 136, 1, 0, 0, 0, 158, 137, 1, 0, 0, 0, 158, 138, 1, 0, 0, 0, 158, 139, 1, 0,
3728
- 0, 0, 158, 140, 1, 0, 0, 0, 158, 141, 1, 0, 0, 0, 158, 142, 1, 0, 0, 0, 158, 143, 1, 0,
3729
- 0, 0, 158, 144, 1, 0, 0, 0, 158, 145, 1, 0, 0, 0, 158, 146, 1, 0, 0, 0, 158, 147, 1, 0,
3730
- 0, 0, 158, 148, 1, 0, 0, 0, 158, 149, 1, 0, 0, 0, 158, 150, 1, 0, 0, 0, 158, 151, 1, 0,
3731
- 0, 0, 158, 152, 1, 0, 0, 0, 158, 153, 1, 0, 0, 0, 158, 154, 1, 0, 0, 0, 158, 155, 1, 0,
3732
- 0, 0, 158, 156, 1, 0, 0, 0, 158, 157, 1, 0, 0, 0, 159, 3, 1, 0, 0, 0, 160, 161, 5, 64, 0,
3733
- 0, 161, 164, 5, 66, 0, 0, 162, 165, 5, 64, 0, 0, 163, 165, 3, 2, 1, 0, 164, 162, 1, 0,
3734
- 0, 0, 164, 163, 1, 0, 0, 0, 165, 166, 1, 0, 0, 0, 166, 164, 1, 0, 0, 0, 166, 167, 1, 0,
3735
- 0, 0, 167, 168, 1, 0, 0, 0, 168, 169, 5, 67, 0, 0, 169, 5, 1, 0, 0, 0, 170, 172, 3, 8, 4,
3736
- 0, 171, 170, 1, 0, 0, 0, 172, 173, 1, 0, 0, 0, 173, 171, 1, 0, 0, 0, 173, 174, 1, 0, 0,
3737
- 0, 174, 7, 1, 0, 0, 0, 175, 176, 7, 0, 0, 0, 176, 177, 5, 1, 0, 0, 177, 178, 3, 4, 2, 0,
3738
- 178, 9, 1, 0, 0, 0, 179, 180, 3, 76, 38, 0, 180, 181, 5, 1, 0, 0, 181, 182, 5, 64, 0, 0,
3739
- 182, 185, 5, 66, 0, 0, 183, 186, 5, 64, 0, 0, 184, 186, 3, 12, 6, 0, 185, 183, 1, 0, 0,
3740
- 0, 185, 184, 1, 0, 0, 0, 186, 187, 1, 0, 0, 0, 187, 185, 1, 0, 0, 0, 187, 188, 1, 0, 0,
3741
- 0, 188, 189, 1, 0, 0, 0, 189, 190, 5, 67, 0, 0, 190, 11, 1, 0, 0, 0, 191, 192, 7, 1, 0,
3742
- 0, 192, 193, 5, 1, 0, 0, 193, 194, 3, 68, 34, 0, 194, 13, 1, 0, 0, 0, 195, 196, 5, 15,
3743
- 0, 0, 196, 197, 7, 2, 0, 0, 197, 15, 1, 0, 0, 0, 198, 199, 5, 56, 0, 0, 199, 202, 5, 1,
3744
- 0, 0, 200, 203, 3, 68, 34, 0, 201, 203, 5, 56, 0, 0, 202, 200, 1, 0, 0, 0, 202, 201, 1,
3745
- 0, 0, 0, 203, 17, 1, 0, 0, 0, 204, 207, 3, 62, 31, 0, 205, 207, 3, 50, 25, 0, 206, 204,
3746
- 1, 0, 0, 0, 206, 205, 1, 0, 0, 0, 207, 211, 1, 0, 0, 0, 208, 210, 3, 16, 8, 0, 209, 208,
3747
- 1, 0, 0, 0, 210, 213, 1, 0, 0, 0, 211, 209, 1, 0, 0, 0, 211, 212, 1, 0, 0, 0, 212, 215,
3748
- 1, 0, 0, 0, 213, 211, 1, 0, 0, 0, 214, 216, 3, 14, 7, 0, 215, 214, 1, 0, 0, 0, 215, 216,
3749
- 1, 0, 0, 0, 216, 19, 1, 0, 0, 0, 217, 218, 5, 16, 0, 0, 218, 219, 3, 18, 9, 0, 219, 21,
3750
- 1, 0, 0, 0, 220, 223, 3, 18, 9, 0, 221, 223, 3, 14, 7, 0, 222, 220, 1, 0, 0, 0, 222, 221,
3751
- 1, 0, 0, 0, 223, 23, 1, 0, 0, 0, 224, 225, 7, 2, 0, 0, 225, 25, 1, 0, 0, 0, 226, 229, 5,
3752
- 17, 0, 0, 227, 230, 3, 22, 11, 0, 228, 230, 5, 19, 0, 0, 229, 227, 1, 0, 0, 0, 229, 228,
3753
- 1, 0, 0, 0, 230, 27, 1, 0, 0, 0, 231, 241, 5, 18, 0, 0, 232, 237, 3, 22, 11, 0, 233, 234,
3754
- 5, 2, 0, 0, 234, 236, 3, 22, 11, 0, 235, 233, 1, 0, 0, 0, 236, 239, 1, 0, 0, 0, 237, 235,
3755
- 1, 0, 0, 0, 237, 238, 1, 0, 0, 0, 238, 242, 1, 0, 0, 0, 239, 237, 1, 0, 0, 0, 240, 242,
3756
- 5, 19, 0, 0, 241, 232, 1, 0, 0, 0, 241, 240, 1, 0, 0, 0, 242, 29, 1, 0, 0, 0, 243, 244,
3757
- 5, 17, 0, 0, 244, 245, 3, 22, 11, 0, 245, 246, 5, 18, 0, 0, 246, 251, 3, 22, 11, 0, 247,
3758
- 248, 5, 2, 0, 0, 248, 250, 3, 22, 11, 0, 249, 247, 1, 0, 0, 0, 250, 253, 1, 0, 0, 0, 251,
3759
- 249, 1, 0, 0, 0, 251, 252, 1, 0, 0, 0, 252, 254, 1, 0, 0, 0, 253, 251, 1, 0, 0, 0, 254,
3760
- 255, 5, 1, 0, 0, 255, 256, 5, 64, 0, 0, 256, 259, 5, 66, 0, 0, 257, 260, 5, 64, 0, 0, 258,
3761
- 260, 3, 32, 16, 0, 259, 257, 1, 0, 0, 0, 259, 258, 1, 0, 0, 0, 260, 261, 1, 0, 0, 0, 261,
3762
- 259, 1, 0, 0, 0, 261, 262, 1, 0, 0, 0, 262, 263, 1, 0, 0, 0, 263, 264, 5, 67, 0, 0, 264,
3763
- 31, 1, 0, 0, 0, 265, 266, 3, 24, 12, 0, 266, 267, 5, 1, 0, 0, 267, 272, 3, 34, 17, 0, 268,
3764
- 269, 5, 2, 0, 0, 269, 271, 3, 34, 17, 0, 270, 268, 1, 0, 0, 0, 271, 274, 1, 0, 0, 0, 272,
3765
- 270, 1, 0, 0, 0, 272, 273, 1, 0, 0, 0, 273, 33, 1, 0, 0, 0, 274, 272, 1, 0, 0, 0, 275, 276,
3766
- 7, 3, 0, 0, 276, 35, 1, 0, 0, 0, 277, 278, 3, 26, 13, 0, 278, 279, 5, 1, 0, 0, 279, 280,
3767
- 5, 64, 0, 0, 280, 283, 5, 66, 0, 0, 281, 284, 5, 64, 0, 0, 282, 284, 3, 38, 19, 0, 283,
3768
- 281, 1, 0, 0, 0, 283, 282, 1, 0, 0, 0, 284, 285, 1, 0, 0, 0, 285, 283, 1, 0, 0, 0, 285,
3769
- 286, 1, 0, 0, 0, 286, 287, 1, 0, 0, 0, 287, 288, 5, 67, 0, 0, 288, 37, 1, 0, 0, 0, 289,
3770
- 292, 3, 2, 1, 0, 290, 292, 3, 40, 20, 0, 291, 289, 1, 0, 0, 0, 291, 290, 1, 0, 0, 0, 292,
3771
- 39, 1, 0, 0, 0, 293, 294, 3, 24, 12, 0, 294, 297, 5, 1, 0, 0, 295, 298, 3, 42, 21, 0, 296,
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, 662, 5, 56, 0, 0, 662, 663, 5, 26, 0, 0, 663,
3879
- 664, 3, 62, 31, 0, 664, 665, 5, 1, 0, 0, 665, 666, 3, 4, 2, 0, 666, 127, 1, 0, 0, 0, 70,
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
- return this.getToken(CircuitScriptParser.ID, 0);
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
+ }
@@ -50,6 +50,7 @@ export function generateKiCADNetList(netlist) {
50
50
  if (instance.typeProp !== ComponentTypes.label &&
51
51
  instance.typeProp !== ComponentTypes.net &&
52
52
  instance.typeProp !== ComponentTypes.point &&
53
+ instance.typeProp !== ComponentTypes.frame &&
53
54
  instance.typeProp !== null) {
54
55
  console.log('Skipping', instance.instanceName);
55
56
  }
@@ -75,6 +75,7 @@ export var ComponentTypes;
75
75
  ComponentTypes["net"] = "net";
76
76
  ComponentTypes["label"] = "label";
77
77
  ComponentTypes["point"] = "point";
78
+ ComponentTypes["frame"] = "frame";
78
79
  })(ComponentTypes || (ComponentTypes = {}));
79
80
  export var ReferenceTypes;
80
81
  (function (ReferenceTypes) {
@@ -150,7 +150,7 @@ export function validateScript(scriptData, options) {
150
150
  return visitorResolver;
151
151
  }
152
152
  export function renderScript(scriptData, outputPath, options) {
153
- const { currentDirectory = null, defaultLibsPath, dumpNets = false, dumpData = false, kicadNetlistPath = null, showStats = false } = options;
153
+ const { currentDirectory = null, defaultLibsPath, dumpNets = false, dumpData = false, showStats = false } = options;
154
154
  const onErrorHandler = (line, column, message, error) => {
155
155
  if (error instanceof VisitorExecutionException) {
156
156
  console.log('Error', line, column, message, error.errorMessage);
@@ -183,14 +183,6 @@ export function renderScript(scriptData, outputPath, options) {
183
183
  catch (err) {
184
184
  console.log('Error during annotation: ', err);
185
185
  }
186
- if (kicadNetlistPath) {
187
- const { tree: kicadNetList, missingFootprints } = generateKiCADNetList(visitor.getNetList());
188
- missingFootprints.forEach(entry => {
189
- console.log(`${entry.refdes} (${entry.instanceName}) does not have footprint`);
190
- });
191
- writeFileSync(kicadNetlistPath, printTree(kicadNetList));
192
- console.log('Generated KiCad netlist file');
193
- }
194
186
  const { sequence, nets } = visitor.getGraph();
195
187
  const tmpSequence = sequence.map(item => {
196
188
  const tmp = [...item];
@@ -219,6 +211,15 @@ export function renderScript(scriptData, outputPath, options) {
219
211
  outputDefaultZoom = 1;
220
212
  }
221
213
  }
214
+ if (fileExtension === 'net') {
215
+ const { tree: kicadNetList, missingFootprints } = generateKiCADNetList(visitor.getNetList());
216
+ missingFootprints.forEach(entry => {
217
+ console.log(`${entry.refdes} (${entry.instanceName}) does not have footprint`);
218
+ });
219
+ writeFileSync(outputPath, printTree(kicadNetList));
220
+ console.log('Generated file', outputPath);
221
+ return null;
222
+ }
222
223
  const layoutEngine = new LayoutEngine();
223
224
  const layoutTimer = new SimpleStopwatch();
224
225
  const sheetFrames = layoutEngine.runLayout(sequence, nets);
@@ -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.SheetFrame)) {
289
- const frameComponent = frame.frame.parameters.get(FrameParamKeys.SheetFrame);
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;
package/dist/esm/main.mjs CHANGED
@@ -16,7 +16,6 @@ export default async function main() {
16
16
  .argument('[output path]', 'Output path')
17
17
  .option('-i, --input text <input text>', 'Input text directly')
18
18
  .option('-c, --current-directory <path>', 'Set current directory')
19
- .option('-k, --kicad-netlist <filename>', 'Create KiCad netlist')
20
19
  .option('-w, --watch', 'Watch for file changes')
21
20
  .option('-n, --dump-nets', 'Dump out net information')
22
21
  .option('-d, --dump-data', 'Dump data during parsing')
@@ -33,7 +32,6 @@ export default async function main() {
33
32
  const watchFileChanges = options.watch;
34
33
  const dumpNets = options.dumpNets;
35
34
  const dumpData = options.dumpData;
36
- const kicadNetlist = options.kicadNetlist;
37
35
  let currentDirectory = options.currentDirectory ?? null;
38
36
  if (watchFileChanges) {
39
37
  console.log('watching for file changes...');
@@ -70,7 +68,6 @@ export default async function main() {
70
68
  defaultLibsPath,
71
69
  dumpNets,
72
70
  dumpData,
73
- kicadNetlistPath: kicadNetlist,
74
71
  showStats: options.stats,
75
72
  };
76
73
  let outputPath = null;
@@ -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["SheetFrame"] = "sheet_frame";
19
+ FrameParamKeys["SheetType"] = "sheet_type";
20
20
  })(FrameParamKeys || (FrameParamKeys = {}));
21
21
  export var FramePlotDirection;
22
22
  (function (FramePlotDirection) {
@@ -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.SheetFrame);
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.SheetFrame)) {
252
- const frameComponent = frameParams.get(FrameParamKeys.SheetFrame);
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();
@@ -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 forVariableName = ctx.ID().getText();
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
- this.getExecutor().scope.variables.set(forVariableName, listItems[counter]);
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.SheetFrame]) {
1127
- frameComponent = document[FrameParamKeys.SheetFrame];
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.SheetFrame, frameComponent);
1136
+ item.parameters.set(FrameParamKeys.SheetType, frameComponent);
1131
1137
  }
1132
1138
  });
1133
1139
  }
@@ -1211,6 +1217,9 @@ class ComponentAnnotater {
1211
1217
  this.counter[type] = 1;
1212
1218
  }
1213
1219
  }
1220
+ if (ComponentRefDesPrefixes[type] === undefined) {
1221
+ return null;
1222
+ }
1214
1223
  let attempts = 100;
1215
1224
  let proposedName;
1216
1225
  while (attempts >= 0) {