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.
@@ -12,6 +12,7 @@ const ParamDefinition_1 = require("./objects/ParamDefinition");
12
12
  const PinTypes_1 = require("./objects/PinTypes");
13
13
  const types_1 = require("./objects/types");
14
14
  const globals_1 = require("./globals");
15
+ const builtinMethods_1 = require("./builtinMethods");
15
16
  class BaseVisitor extends CircuitScriptVisitor_1.CircuitScriptVisitor {
16
17
  constructor(silent = false, onErrorHandler = null, currentDirectory, defaultLibsPath) {
17
18
  super();
@@ -381,69 +382,8 @@ class BaseVisitor extends CircuitScriptVisitor_1.CircuitScriptVisitor {
381
382
  getExecutor() {
382
383
  return this.executionStack[this.executionStack.length - 1];
383
384
  }
384
- toString(obj) {
385
- if (typeof obj === 'string') {
386
- return `"${obj}"`;
387
- }
388
- else if (typeof obj === 'number') {
389
- return obj.toString();
390
- }
391
- else if (Array.isArray(obj)) {
392
- const inner = obj.map(item => this.toString(item)).join(", ");
393
- return "[" + inner + "]";
394
- }
395
- else {
396
- if (obj.toString) {
397
- return obj.toString();
398
- }
399
- else {
400
- throw "Could not create string from object: " + obj;
401
- }
402
- }
403
- }
404
385
  setupPrintFunction(context) {
405
- context.createFunction('print', (params) => {
406
- const items = params.map(([, , value]) => {
407
- return this.toString(value);
408
- });
409
- if (this.printToConsole) {
410
- console.log('::', ...items);
411
- }
412
- this.printStream.push(...items);
413
- return [this, null];
414
- });
415
- context.createFunction('range', (params) => {
416
- const items = params.map(([, , value]) => {
417
- if (isNaN(value)) {
418
- throw 'Invalid value: ' + value;
419
- }
420
- return value;
421
- });
422
- let startValue = 0;
423
- let endValue = 0;
424
- if (items.length === 1) {
425
- endValue = items[0];
426
- }
427
- else if (items.length === 2) {
428
- startValue = items[0];
429
- endValue = items[1];
430
- }
431
- const returnArray = [];
432
- for (let i = startValue; i < endValue; i++) {
433
- returnArray.push(i);
434
- }
435
- return [this, returnArray];
436
- });
437
- context.createFunction('enumerate', (params) => {
438
- const [, , array] = params[0];
439
- if (!Array.isArray(array)) {
440
- throw "Invalid parameter for enumerate function!";
441
- }
442
- const output = array.map((item, index) => {
443
- return [index, item];
444
- });
445
- return [this, output];
446
- });
386
+ (0, builtinMethods_1.linkBuiltInMethods)(context, this);
447
387
  }
448
388
  createNetResolver(executionStack) {
449
389
  const resolveNet = (netName, netNamespace) => {
@@ -3439,6 +3439,7 @@ class CircuitScriptParser extends antlr.Parser {
3439
3439
  for_expr() {
3440
3440
  let localContext = new For_exprContext(this.context, this.state);
3441
3441
  this.enterRule(localContext, 126, CircuitScriptParser.RULE_for_expr);
3442
+ let _la;
3442
3443
  try {
3443
3444
  this.enterOuterAlt(localContext, 1);
3444
3445
  {
@@ -3446,13 +3447,29 @@ class CircuitScriptParser extends antlr.Parser {
3446
3447
  this.match(CircuitScriptParser.For);
3447
3448
  this.state = 661;
3448
3449
  this.match(CircuitScriptParser.ID);
3449
- this.state = 662;
3450
+ this.state = 666;
3451
+ this.errorHandler.sync(this);
3452
+ _la = this.tokenStream.LA(1);
3453
+ while (_la === 2) {
3454
+ {
3455
+ {
3456
+ this.state = 662;
3457
+ this.match(CircuitScriptParser.T__1);
3458
+ this.state = 663;
3459
+ this.match(CircuitScriptParser.ID);
3460
+ }
3461
+ }
3462
+ this.state = 668;
3463
+ this.errorHandler.sync(this);
3464
+ _la = this.tokenStream.LA(1);
3465
+ }
3466
+ this.state = 669;
3450
3467
  this.match(CircuitScriptParser.In);
3451
- this.state = 663;
3468
+ this.state = 670;
3452
3469
  this.data_expr(0);
3453
- this.state = 664;
3470
+ this.state = 671;
3454
3471
  this.match(CircuitScriptParser.T__0);
3455
- this.state = 665;
3472
+ this.state = 672;
3456
3473
  this.expressions_block();
3457
3474
  }
3458
3475
  }
@@ -3676,7 +3693,7 @@ CircuitScriptParser.ruleNames = [
3676
3693
  "for_expr",
3677
3694
  ];
3678
3695
  CircuitScriptParser._serializedATN = [
3679
- 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,
3696
+ 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,
3680
3697
  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,
3681
3698
  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,
3682
3699
  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,
@@ -3732,81 +3749,82 @@ CircuitScriptParser._serializedATN = [
3732
3749
  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,
3733
3750
  8, 59, 10, 59, 12, 59, 641, 9, 59, 1, 59, 3, 59, 644, 8, 59, 1, 60, 1, 60, 1, 60, 1, 60,
3734
3751
  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,
3735
- 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,
3736
- 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62,
3737
- 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104,
3738
- 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 0, 14, 2, 0, 9, 9, 19, 21, 1,
3739
- 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,
3740
- 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,
3741
- 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,
3742
- 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,
3743
- 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,
3744
- 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,
3745
- 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,
3746
- 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,
3747
- 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,
3748
- 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,
3749
- 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,
3750
- 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,
3751
- 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,
3752
- 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,
3753
- 0, 0, 100, 574, 1, 0, 0, 0, 102, 578, 1, 0, 0, 0, 104, 589, 1, 0, 0, 0, 106, 597, 1, 0,
3754
- 0, 0, 108, 599, 1, 0, 0, 0, 110, 606, 1, 0, 0, 0, 112, 622, 1, 0, 0, 0, 114, 625, 1, 0,
3755
- 0, 0, 116, 628, 1, 0, 0, 0, 118, 632, 1, 0, 0, 0, 120, 645, 1, 0, 0, 0, 122, 651, 1, 0,
3756
- 0, 0, 124, 655, 1, 0, 0, 0, 126, 660, 1, 0, 0, 0, 128, 131, 3, 2, 1, 0, 129, 131, 5, 64,
3757
- 0, 0, 130, 128, 1, 0, 0, 0, 130, 129, 1, 0, 0, 0, 131, 132, 1, 0, 0, 0, 132, 130, 1, 0,
3758
- 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,
3759
- 0, 136, 159, 3, 20, 10, 0, 137, 159, 3, 28, 14, 0, 138, 159, 3, 26, 13, 0, 139, 159,
3760
- 3, 50, 25, 0, 140, 159, 3, 52, 26, 0, 141, 159, 3, 58, 29, 0, 142, 159, 3, 10, 5, 0, 143,
3761
- 159, 3, 60, 30, 0, 144, 159, 3, 46, 23, 0, 145, 159, 3, 48, 24, 0, 146, 159, 3, 70, 35,
3762
- 0, 147, 159, 3, 80, 40, 0, 148, 159, 3, 108, 54, 0, 149, 159, 3, 114, 57, 0, 150, 159,
3763
- 3, 116, 58, 0, 151, 159, 3, 76, 38, 0, 152, 159, 3, 36, 18, 0, 153, 159, 3, 6, 3, 0, 154,
3764
- 159, 3, 112, 56, 0, 155, 159, 3, 118, 59, 0, 156, 159, 3, 124, 62, 0, 157, 159, 3, 126,
3765
- 63, 0, 158, 136, 1, 0, 0, 0, 158, 137, 1, 0, 0, 0, 158, 138, 1, 0, 0, 0, 158, 139, 1, 0,
3766
- 0, 0, 158, 140, 1, 0, 0, 0, 158, 141, 1, 0, 0, 0, 158, 142, 1, 0, 0, 0, 158, 143, 1, 0,
3767
- 0, 0, 158, 144, 1, 0, 0, 0, 158, 145, 1, 0, 0, 0, 158, 146, 1, 0, 0, 0, 158, 147, 1, 0,
3768
- 0, 0, 158, 148, 1, 0, 0, 0, 158, 149, 1, 0, 0, 0, 158, 150, 1, 0, 0, 0, 158, 151, 1, 0,
3769
- 0, 0, 158, 152, 1, 0, 0, 0, 158, 153, 1, 0, 0, 0, 158, 154, 1, 0, 0, 0, 158, 155, 1, 0,
3770
- 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,
3771
- 0, 161, 164, 5, 66, 0, 0, 162, 165, 5, 64, 0, 0, 163, 165, 3, 2, 1, 0, 164, 162, 1, 0,
3772
- 0, 0, 164, 163, 1, 0, 0, 0, 165, 166, 1, 0, 0, 0, 166, 164, 1, 0, 0, 0, 166, 167, 1, 0,
3773
- 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,
3774
- 0, 171, 170, 1, 0, 0, 0, 172, 173, 1, 0, 0, 0, 173, 171, 1, 0, 0, 0, 173, 174, 1, 0, 0,
3775
- 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,
3776
- 178, 9, 1, 0, 0, 0, 179, 180, 3, 76, 38, 0, 180, 181, 5, 1, 0, 0, 181, 182, 5, 64, 0, 0,
3777
- 182, 185, 5, 66, 0, 0, 183, 186, 5, 64, 0, 0, 184, 186, 3, 12, 6, 0, 185, 183, 1, 0, 0,
3778
- 0, 185, 184, 1, 0, 0, 0, 186, 187, 1, 0, 0, 0, 187, 185, 1, 0, 0, 0, 187, 188, 1, 0, 0,
3779
- 0, 188, 189, 1, 0, 0, 0, 189, 190, 5, 67, 0, 0, 190, 11, 1, 0, 0, 0, 191, 192, 7, 1, 0,
3780
- 0, 192, 193, 5, 1, 0, 0, 193, 194, 3, 68, 34, 0, 194, 13, 1, 0, 0, 0, 195, 196, 5, 15,
3781
- 0, 0, 196, 197, 7, 2, 0, 0, 197, 15, 1, 0, 0, 0, 198, 199, 5, 56, 0, 0, 199, 202, 5, 1,
3782
- 0, 0, 200, 203, 3, 68, 34, 0, 201, 203, 5, 56, 0, 0, 202, 200, 1, 0, 0, 0, 202, 201, 1,
3783
- 0, 0, 0, 203, 17, 1, 0, 0, 0, 204, 207, 3, 62, 31, 0, 205, 207, 3, 50, 25, 0, 206, 204,
3784
- 1, 0, 0, 0, 206, 205, 1, 0, 0, 0, 207, 211, 1, 0, 0, 0, 208, 210, 3, 16, 8, 0, 209, 208,
3785
- 1, 0, 0, 0, 210, 213, 1, 0, 0, 0, 211, 209, 1, 0, 0, 0, 211, 212, 1, 0, 0, 0, 212, 215,
3786
- 1, 0, 0, 0, 213, 211, 1, 0, 0, 0, 214, 216, 3, 14, 7, 0, 215, 214, 1, 0, 0, 0, 215, 216,
3787
- 1, 0, 0, 0, 216, 19, 1, 0, 0, 0, 217, 218, 5, 16, 0, 0, 218, 219, 3, 18, 9, 0, 219, 21,
3788
- 1, 0, 0, 0, 220, 223, 3, 18, 9, 0, 221, 223, 3, 14, 7, 0, 222, 220, 1, 0, 0, 0, 222, 221,
3789
- 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,
3790
- 17, 0, 0, 227, 230, 3, 22, 11, 0, 228, 230, 5, 19, 0, 0, 229, 227, 1, 0, 0, 0, 229, 228,
3791
- 1, 0, 0, 0, 230, 27, 1, 0, 0, 0, 231, 241, 5, 18, 0, 0, 232, 237, 3, 22, 11, 0, 233, 234,
3792
- 5, 2, 0, 0, 234, 236, 3, 22, 11, 0, 235, 233, 1, 0, 0, 0, 236, 239, 1, 0, 0, 0, 237, 235,
3793
- 1, 0, 0, 0, 237, 238, 1, 0, 0, 0, 238, 242, 1, 0, 0, 0, 239, 237, 1, 0, 0, 0, 240, 242,
3794
- 5, 19, 0, 0, 241, 232, 1, 0, 0, 0, 241, 240, 1, 0, 0, 0, 242, 29, 1, 0, 0, 0, 243, 244,
3795
- 5, 17, 0, 0, 244, 245, 3, 22, 11, 0, 245, 246, 5, 18, 0, 0, 246, 251, 3, 22, 11, 0, 247,
3796
- 248, 5, 2, 0, 0, 248, 250, 3, 22, 11, 0, 249, 247, 1, 0, 0, 0, 250, 253, 1, 0, 0, 0, 251,
3797
- 249, 1, 0, 0, 0, 251, 252, 1, 0, 0, 0, 252, 254, 1, 0, 0, 0, 253, 251, 1, 0, 0, 0, 254,
3798
- 255, 5, 1, 0, 0, 255, 256, 5, 64, 0, 0, 256, 259, 5, 66, 0, 0, 257, 260, 5, 64, 0, 0, 258,
3799
- 260, 3, 32, 16, 0, 259, 257, 1, 0, 0, 0, 259, 258, 1, 0, 0, 0, 260, 261, 1, 0, 0, 0, 261,
3800
- 259, 1, 0, 0, 0, 261, 262, 1, 0, 0, 0, 262, 263, 1, 0, 0, 0, 263, 264, 5, 67, 0, 0, 264,
3801
- 31, 1, 0, 0, 0, 265, 266, 3, 24, 12, 0, 266, 267, 5, 1, 0, 0, 267, 272, 3, 34, 17, 0, 268,
3802
- 269, 5, 2, 0, 0, 269, 271, 3, 34, 17, 0, 270, 268, 1, 0, 0, 0, 271, 274, 1, 0, 0, 0, 272,
3803
- 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,
3804
- 7, 3, 0, 0, 276, 35, 1, 0, 0, 0, 277, 278, 3, 26, 13, 0, 278, 279, 5, 1, 0, 0, 279, 280,
3805
- 5, 64, 0, 0, 280, 283, 5, 66, 0, 0, 281, 284, 5, 64, 0, 0, 282, 284, 3, 38, 19, 0, 283,
3806
- 281, 1, 0, 0, 0, 283, 282, 1, 0, 0, 0, 284, 285, 1, 0, 0, 0, 285, 283, 1, 0, 0, 0, 285,
3807
- 286, 1, 0, 0, 0, 286, 287, 1, 0, 0, 0, 287, 288, 5, 67, 0, 0, 288, 37, 1, 0, 0, 0, 289,
3808
- 292, 3, 2, 1, 0, 290, 292, 3, 40, 20, 0, 291, 289, 1, 0, 0, 0, 291, 290, 1, 0, 0, 0, 292,
3809
- 39, 1, 0, 0, 0, 293, 294, 3, 24, 12, 0, 294, 297, 5, 1, 0, 0, 295, 298, 3, 42, 21, 0, 296,
3752
+ 1, 63, 1, 63, 5, 63, 665, 8, 63, 10, 63, 12, 63, 668, 9, 63, 1, 63, 1, 63, 1, 63, 1, 63,
3753
+ 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,
3754
+ 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76,
3755
+ 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114,
3756
+ 116, 118, 120, 122, 124, 126, 0, 14, 2, 0, 9, 9, 19, 21, 1, 0, 56, 57, 2, 0, 57, 57, 60,
3757
+ 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,
3758
+ 39, 2, 0, 31, 31, 43, 43, 2, 0, 55, 55, 57, 61, 2, 0, 15, 15, 56, 56, 2, 0, 56, 57, 60,
3759
+ 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,
3760
+ 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,
3761
+ 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,
3762
+ 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,
3763
+ 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,
3764
+ 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,
3765
+ 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,
3766
+ 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,
3767
+ 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,
3768
+ 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,
3769
+ 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,
3770
+ 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,
3771
+ 102, 578, 1, 0, 0, 0, 104, 589, 1, 0, 0, 0, 106, 597, 1, 0, 0, 0, 108, 599, 1, 0, 0, 0,
3772
+ 110, 606, 1, 0, 0, 0, 112, 622, 1, 0, 0, 0, 114, 625, 1, 0, 0, 0, 116, 628, 1, 0, 0, 0,
3773
+ 118, 632, 1, 0, 0, 0, 120, 645, 1, 0, 0, 0, 122, 651, 1, 0, 0, 0, 124, 655, 1, 0, 0, 0,
3774
+ 126, 660, 1, 0, 0, 0, 128, 131, 3, 2, 1, 0, 129, 131, 5, 64, 0, 0, 130, 128, 1, 0, 0, 0,
3775
+ 130, 129, 1, 0, 0, 0, 131, 132, 1, 0, 0, 0, 132, 130, 1, 0, 0, 0, 132, 133, 1, 0, 0, 0,
3776
+ 133, 134, 1, 0, 0, 0, 134, 135, 5, 0, 0, 1, 135, 1, 1, 0, 0, 0, 136, 159, 3, 20, 10, 0,
3777
+ 137, 159, 3, 28, 14, 0, 138, 159, 3, 26, 13, 0, 139, 159, 3, 50, 25, 0, 140, 159, 3,
3778
+ 52, 26, 0, 141, 159, 3, 58, 29, 0, 142, 159, 3, 10, 5, 0, 143, 159, 3, 60, 30, 0, 144,
3779
+ 159, 3, 46, 23, 0, 145, 159, 3, 48, 24, 0, 146, 159, 3, 70, 35, 0, 147, 159, 3, 80, 40,
3780
+ 0, 148, 159, 3, 108, 54, 0, 149, 159, 3, 114, 57, 0, 150, 159, 3, 116, 58, 0, 151, 159,
3781
+ 3, 76, 38, 0, 152, 159, 3, 36, 18, 0, 153, 159, 3, 6, 3, 0, 154, 159, 3, 112, 56, 0, 155,
3782
+ 159, 3, 118, 59, 0, 156, 159, 3, 124, 62, 0, 157, 159, 3, 126, 63, 0, 158, 136, 1, 0,
3783
+ 0, 0, 158, 137, 1, 0, 0, 0, 158, 138, 1, 0, 0, 0, 158, 139, 1, 0, 0, 0, 158, 140, 1, 0,
3784
+ 0, 0, 158, 141, 1, 0, 0, 0, 158, 142, 1, 0, 0, 0, 158, 143, 1, 0, 0, 0, 158, 144, 1, 0,
3785
+ 0, 0, 158, 145, 1, 0, 0, 0, 158, 146, 1, 0, 0, 0, 158, 147, 1, 0, 0, 0, 158, 148, 1, 0,
3786
+ 0, 0, 158, 149, 1, 0, 0, 0, 158, 150, 1, 0, 0, 0, 158, 151, 1, 0, 0, 0, 158, 152, 1, 0,
3787
+ 0, 0, 158, 153, 1, 0, 0, 0, 158, 154, 1, 0, 0, 0, 158, 155, 1, 0, 0, 0, 158, 156, 1, 0,
3788
+ 0, 0, 158, 157, 1, 0, 0, 0, 159, 3, 1, 0, 0, 0, 160, 161, 5, 64, 0, 0, 161, 164, 5, 66,
3789
+ 0, 0, 162, 165, 5, 64, 0, 0, 163, 165, 3, 2, 1, 0, 164, 162, 1, 0, 0, 0, 164, 163, 1, 0,
3790
+ 0, 0, 165, 166, 1, 0, 0, 0, 166, 164, 1, 0, 0, 0, 166, 167, 1, 0, 0, 0, 167, 168, 1, 0,
3791
+ 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,
3792
+ 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,
3793
+ 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,
3794
+ 180, 3, 76, 38, 0, 180, 181, 5, 1, 0, 0, 181, 182, 5, 64, 0, 0, 182, 185, 5, 66, 0, 0,
3795
+ 183, 186, 5, 64, 0, 0, 184, 186, 3, 12, 6, 0, 185, 183, 1, 0, 0, 0, 185, 184, 1, 0, 0,
3796
+ 0, 186, 187, 1, 0, 0, 0, 187, 185, 1, 0, 0, 0, 187, 188, 1, 0, 0, 0, 188, 189, 1, 0, 0,
3797
+ 0, 189, 190, 5, 67, 0, 0, 190, 11, 1, 0, 0, 0, 191, 192, 7, 1, 0, 0, 192, 193, 5, 1, 0,
3798
+ 0, 193, 194, 3, 68, 34, 0, 194, 13, 1, 0, 0, 0, 195, 196, 5, 15, 0, 0, 196, 197, 7, 2,
3799
+ 0, 0, 197, 15, 1, 0, 0, 0, 198, 199, 5, 56, 0, 0, 199, 202, 5, 1, 0, 0, 200, 203, 3, 68,
3800
+ 34, 0, 201, 203, 5, 56, 0, 0, 202, 200, 1, 0, 0, 0, 202, 201, 1, 0, 0, 0, 203, 17, 1, 0,
3801
+ 0, 0, 204, 207, 3, 62, 31, 0, 205, 207, 3, 50, 25, 0, 206, 204, 1, 0, 0, 0, 206, 205,
3802
+ 1, 0, 0, 0, 207, 211, 1, 0, 0, 0, 208, 210, 3, 16, 8, 0, 209, 208, 1, 0, 0, 0, 210, 213,
3803
+ 1, 0, 0, 0, 211, 209, 1, 0, 0, 0, 211, 212, 1, 0, 0, 0, 212, 215, 1, 0, 0, 0, 213, 211,
3804
+ 1, 0, 0, 0, 214, 216, 3, 14, 7, 0, 215, 214, 1, 0, 0, 0, 215, 216, 1, 0, 0, 0, 216, 19,
3805
+ 1, 0, 0, 0, 217, 218, 5, 16, 0, 0, 218, 219, 3, 18, 9, 0, 219, 21, 1, 0, 0, 0, 220, 223,
3806
+ 3, 18, 9, 0, 221, 223, 3, 14, 7, 0, 222, 220, 1, 0, 0, 0, 222, 221, 1, 0, 0, 0, 223, 23,
3807
+ 1, 0, 0, 0, 224, 225, 7, 2, 0, 0, 225, 25, 1, 0, 0, 0, 226, 229, 5, 17, 0, 0, 227, 230,
3808
+ 3, 22, 11, 0, 228, 230, 5, 19, 0, 0, 229, 227, 1, 0, 0, 0, 229, 228, 1, 0, 0, 0, 230, 27,
3809
+ 1, 0, 0, 0, 231, 241, 5, 18, 0, 0, 232, 237, 3, 22, 11, 0, 233, 234, 5, 2, 0, 0, 234, 236,
3810
+ 3, 22, 11, 0, 235, 233, 1, 0, 0, 0, 236, 239, 1, 0, 0, 0, 237, 235, 1, 0, 0, 0, 237, 238,
3811
+ 1, 0, 0, 0, 238, 242, 1, 0, 0, 0, 239, 237, 1, 0, 0, 0, 240, 242, 5, 19, 0, 0, 241, 232,
3812
+ 1, 0, 0, 0, 241, 240, 1, 0, 0, 0, 242, 29, 1, 0, 0, 0, 243, 244, 5, 17, 0, 0, 244, 245,
3813
+ 3, 22, 11, 0, 245, 246, 5, 18, 0, 0, 246, 251, 3, 22, 11, 0, 247, 248, 5, 2, 0, 0, 248,
3814
+ 250, 3, 22, 11, 0, 249, 247, 1, 0, 0, 0, 250, 253, 1, 0, 0, 0, 251, 249, 1, 0, 0, 0, 251,
3815
+ 252, 1, 0, 0, 0, 252, 254, 1, 0, 0, 0, 253, 251, 1, 0, 0, 0, 254, 255, 5, 1, 0, 0, 255,
3816
+ 256, 5, 64, 0, 0, 256, 259, 5, 66, 0, 0, 257, 260, 5, 64, 0, 0, 258, 260, 3, 32, 16, 0,
3817
+ 259, 257, 1, 0, 0, 0, 259, 258, 1, 0, 0, 0, 260, 261, 1, 0, 0, 0, 261, 259, 1, 0, 0, 0,
3818
+ 261, 262, 1, 0, 0, 0, 262, 263, 1, 0, 0, 0, 263, 264, 5, 67, 0, 0, 264, 31, 1, 0, 0, 0,
3819
+ 265, 266, 3, 24, 12, 0, 266, 267, 5, 1, 0, 0, 267, 272, 3, 34, 17, 0, 268, 269, 5, 2,
3820
+ 0, 0, 269, 271, 3, 34, 17, 0, 270, 268, 1, 0, 0, 0, 271, 274, 1, 0, 0, 0, 272, 270, 1,
3821
+ 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,
3822
+ 0, 0, 276, 35, 1, 0, 0, 0, 277, 278, 3, 26, 13, 0, 278, 279, 5, 1, 0, 0, 279, 280, 5, 64,
3823
+ 0, 0, 280, 283, 5, 66, 0, 0, 281, 284, 5, 64, 0, 0, 282, 284, 3, 38, 19, 0, 283, 281,
3824
+ 1, 0, 0, 0, 283, 282, 1, 0, 0, 0, 284, 285, 1, 0, 0, 0, 285, 283, 1, 0, 0, 0, 285, 286,
3825
+ 1, 0, 0, 0, 286, 287, 1, 0, 0, 0, 287, 288, 5, 67, 0, 0, 288, 37, 1, 0, 0, 0, 289, 292,
3826
+ 3, 2, 1, 0, 290, 292, 3, 40, 20, 0, 291, 289, 1, 0, 0, 0, 291, 290, 1, 0, 0, 0, 292, 39,
3827
+ 1, 0, 0, 0, 293, 294, 3, 24, 12, 0, 294, 297, 5, 1, 0, 0, 295, 298, 3, 42, 21, 0, 296,
3810
3828
  298, 3, 44, 22, 0, 297, 295, 1, 0, 0, 0, 297, 296, 1, 0, 0, 0, 298, 41, 1, 0, 0, 0, 299,
3811
3829
  302, 3, 2, 1, 0, 300, 302, 5, 54, 0, 0, 301, 299, 1, 0, 0, 0, 301, 300, 1, 0, 0, 0, 302,
3812
3830
  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,
@@ -3913,13 +3931,15 @@ CircuitScriptParser._serializedATN = [
3913
3931
  648, 3, 62, 31, 0, 648, 649, 5, 1, 0, 0, 649, 650, 3, 4, 2, 0, 650, 121, 1, 0, 0, 0, 651,
3914
3932
  652, 5, 30, 0, 0, 652, 653, 5, 1, 0, 0, 653, 654, 3, 4, 2, 0, 654, 123, 1, 0, 0, 0, 655,
3915
3933
  656, 5, 27, 0, 0, 656, 657, 3, 62, 31, 0, 657, 658, 5, 1, 0, 0, 658, 659, 3, 4, 2, 0, 659,
3916
- 125, 1, 0, 0, 0, 660, 661, 5, 25, 0, 0, 661, 662, 5, 56, 0, 0, 662, 663, 5, 26, 0, 0, 663,
3917
- 664, 3, 62, 31, 0, 664, 665, 5, 1, 0, 0, 665, 666, 3, 4, 2, 0, 666, 127, 1, 0, 0, 0, 70,
3934
+ 125, 1, 0, 0, 0, 660, 661, 5, 25, 0, 0, 661, 666, 5, 56, 0, 0, 662, 663, 5, 2, 0, 0, 663,
3935
+ 665, 5, 56, 0, 0, 664, 662, 1, 0, 0, 0, 665, 668, 1, 0, 0, 0, 666, 664, 1, 0, 0, 0, 666,
3936
+ 667, 1, 0, 0, 0, 667, 669, 1, 0, 0, 0, 668, 666, 1, 0, 0, 0, 669, 670, 5, 26, 0, 0, 670,
3937
+ 671, 3, 62, 31, 0, 671, 672, 5, 1, 0, 0, 672, 673, 3, 4, 2, 0, 673, 127, 1, 0, 0, 0, 71,
3918
3938
  130, 132, 158, 164, 166, 173, 185, 187, 202, 206, 211, 215, 222, 229, 237, 241,
3919
3939
  251, 259, 261, 272, 283, 285, 291, 297, 301, 326, 333, 341, 344, 362, 372, 387,
3920
3940
  389, 397, 405, 413, 415, 421, 428, 437, 449, 452, 459, 464, 469, 472, 478, 481,
3921
3941
  485, 501, 503, 511, 513, 530, 532, 540, 542, 548, 556, 564, 572, 586, 589, 594,
3922
- 597, 603, 612, 617, 639, 643
3942
+ 597, 603, 612, 617, 639, 643, 666
3923
3943
  ];
3924
3944
  CircuitScriptParser.vocabulary = new antlr.Vocabulary(CircuitScriptParser.literalNames, CircuitScriptParser.symbolicNames, []);
3925
3945
  CircuitScriptParser.decisionsToDFA = CircuitScriptParser._ATN.decisionToState.map((ds, index) => new antlr.DFA(ds, index));
@@ -6107,8 +6127,13 @@ class For_exprContext extends antlr.ParserRuleContext {
6107
6127
  For() {
6108
6128
  return this.getToken(CircuitScriptParser.For, 0);
6109
6129
  }
6110
- ID() {
6111
- return this.getToken(CircuitScriptParser.ID, 0);
6130
+ ID(i) {
6131
+ if (i === undefined) {
6132
+ return this.getTokens(CircuitScriptParser.ID);
6133
+ }
6134
+ else {
6135
+ return this.getToken(CircuitScriptParser.ID, i);
6136
+ }
6112
6137
  }
6113
6138
  In() {
6114
6139
  return this.getToken(CircuitScriptParser.In, 0);
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.linkBuiltInMethods = void 0;
4
+ function linkBuiltInMethods(context, visitor) {
5
+ context.createFunction('print', (params) => {
6
+ const args = getPositionParams(params);
7
+ const items = args.map(item => toString(item));
8
+ if (visitor.printToConsole) {
9
+ console.log('::', ...items);
10
+ }
11
+ const printedValue = items.join(" ");
12
+ visitor.printStream.push(printedValue);
13
+ return [visitor, printedValue];
14
+ });
15
+ const builtIns = [
16
+ ['enumerate', enumerate],
17
+ ['toMils', toMils],
18
+ ['range', range],
19
+ ['len', objectLength],
20
+ ];
21
+ builtIns.forEach(([functionName, functionImpl]) => {
22
+ context.createFunction(functionName, params => {
23
+ const args = getPositionParams(params);
24
+ const functionReturn = functionImpl(...args);
25
+ return [visitor, functionReturn];
26
+ });
27
+ });
28
+ }
29
+ exports.linkBuiltInMethods = linkBuiltInMethods;
30
+ function range(...args) {
31
+ let startValue = 0;
32
+ let endValue = 0;
33
+ if (args.length === 1) {
34
+ endValue = args[0];
35
+ }
36
+ else if (args.length === 2) {
37
+ startValue = args[0];
38
+ endValue = args[1];
39
+ }
40
+ const returnArray = [];
41
+ for (let i = startValue; i < endValue; i++) {
42
+ returnArray.push(i);
43
+ }
44
+ return returnArray;
45
+ }
46
+ function enumerate(array) {
47
+ if (!Array.isArray(array)) {
48
+ throw "Invalid parameter for enumerate function!";
49
+ }
50
+ const output = array.map((item, index) => {
51
+ return [index, item];
52
+ });
53
+ return output;
54
+ }
55
+ function toMils(value) {
56
+ if (isNaN(value)) {
57
+ throw "Invalid input for method toMils";
58
+ }
59
+ return value / 25.4 * 1000;
60
+ }
61
+ function objectLength(obj) {
62
+ if (Array.isArray(obj)) {
63
+ return obj.length;
64
+ }
65
+ else {
66
+ if (obj.length) {
67
+ return obj.length;
68
+ }
69
+ else {
70
+ throw "Could not get length of object: " + obj;
71
+ }
72
+ }
73
+ }
74
+ function getPositionParams(params) {
75
+ return params.map(([, , value]) => value);
76
+ }
77
+ function toString(obj) {
78
+ if (typeof obj === 'string') {
79
+ return `"${obj}"`;
80
+ }
81
+ else if (typeof obj === 'number') {
82
+ return obj.toString();
83
+ }
84
+ else if (Array.isArray(obj)) {
85
+ const inner = obj.map(item => toString(item)).join(", ");
86
+ return "[" + inner + "]";
87
+ }
88
+ else {
89
+ if (obj.toString) {
90
+ return obj.toString();
91
+ }
92
+ else {
93
+ throw "Could not create string from object: " + obj;
94
+ }
95
+ }
96
+ }
@@ -53,6 +53,7 @@ function generateKiCADNetList(netlist) {
53
53
  if (instance.typeProp !== globals_js_1.ComponentTypes.label &&
54
54
  instance.typeProp !== globals_js_1.ComponentTypes.net &&
55
55
  instance.typeProp !== globals_js_1.ComponentTypes.point &&
56
+ instance.typeProp !== globals_js_1.ComponentTypes.frame &&
56
57
  instance.typeProp !== null) {
57
58
  console.log('Skipping', instance.instanceName);
58
59
  }
@@ -78,6 +78,7 @@ var ComponentTypes;
78
78
  ComponentTypes["net"] = "net";
79
79
  ComponentTypes["label"] = "label";
80
80
  ComponentTypes["point"] = "point";
81
+ ComponentTypes["frame"] = "frame";
81
82
  })(ComponentTypes || (exports.ComponentTypes = ComponentTypes = {}));
82
83
  var ReferenceTypes;
83
84
  (function (ReferenceTypes) {
@@ -161,7 +161,7 @@ function validateScript(scriptData, options) {
161
161
  }
162
162
  exports.validateScript = validateScript;
163
163
  function renderScript(scriptData, outputPath, options) {
164
- const { currentDirectory = null, defaultLibsPath, dumpNets = false, dumpData = false, kicadNetlistPath = null, showStats = false } = options;
164
+ const { currentDirectory = null, defaultLibsPath, dumpNets = false, dumpData = false, showStats = false } = options;
165
165
  const onErrorHandler = (line, column, message, error) => {
166
166
  if (error instanceof visitor_js_1.VisitorExecutionException) {
167
167
  console.log('Error', line, column, message, error.errorMessage);
@@ -194,14 +194,6 @@ function renderScript(scriptData, outputPath, options) {
194
194
  catch (err) {
195
195
  console.log('Error during annotation: ', err);
196
196
  }
197
- if (kicadNetlistPath) {
198
- const { tree: kicadNetList, missingFootprints } = (0, export_js_1.generateKiCADNetList)(visitor.getNetList());
199
- missingFootprints.forEach(entry => {
200
- console.log(`${entry.refdes} (${entry.instanceName}) does not have footprint`);
201
- });
202
- (0, fs_1.writeFileSync)(kicadNetlistPath, (0, export_js_1.printTree)(kicadNetList));
203
- console.log('Generated KiCad netlist file');
204
- }
205
197
  const { sequence, nets } = visitor.getGraph();
206
198
  const tmpSequence = sequence.map(item => {
207
199
  const tmp = [...item];
@@ -230,6 +222,15 @@ function renderScript(scriptData, outputPath, options) {
230
222
  outputDefaultZoom = 1;
231
223
  }
232
224
  }
225
+ if (fileExtension === 'net') {
226
+ const { tree: kicadNetList, missingFootprints } = (0, export_js_1.generateKiCADNetList)(visitor.getNetList());
227
+ missingFootprints.forEach(entry => {
228
+ console.log(`${entry.refdes} (${entry.instanceName}) does not have footprint`);
229
+ });
230
+ (0, fs_1.writeFileSync)(outputPath, (0, export_js_1.printTree)(kicadNetList));
231
+ console.log('Generated file', outputPath);
232
+ return null;
233
+ }
233
234
  const layoutEngine = new layout_js_1.LayoutEngine();
234
235
  const layoutTimer = new utils_js_1.SimpleStopwatch();
235
236
  const sheetFrames = layoutEngine.runLayout(sequence, nets);
@@ -287,8 +287,8 @@ class LayoutEngine {
287
287
  boundPoints.push([innerFrame.x, innerFrame.y], [innerFrame.x + frameWidth, innerFrame.y + frameHeight]);
288
288
  });
289
289
  const contentsBounds = (0, utils_js_1.resizeBounds)(getBoundsFromPoints(boundPoints), frame.padding);
290
- if (frame.frame.parameters.has(Frame_js_1.FrameParamKeys.SheetFrame)) {
291
- const frameComponent = frame.frame.parameters.get(Frame_js_1.FrameParamKeys.SheetFrame);
290
+ if (frame.frame.parameters.has(Frame_js_1.FrameParamKeys.SheetType)) {
291
+ const frameComponent = frame.frame.parameters.get(Frame_js_1.FrameParamKeys.SheetType);
292
292
  const rects = ExtractDrawingRects(frameComponent.displayProp);
293
293
  let frameWidth = 0;
294
294
  let frameHeight = 0;
package/dist/cjs/main.js CHANGED
@@ -21,7 +21,6 @@ async function main() {
21
21
  .argument('[output path]', 'Output path')
22
22
  .option('-i, --input text <input text>', 'Input text directly')
23
23
  .option('-c, --current-directory <path>', 'Set current directory')
24
- .option('-k, --kicad-netlist <filename>', 'Create KiCad netlist')
25
24
  .option('-w, --watch', 'Watch for file changes')
26
25
  .option('-n, --dump-nets', 'Dump out net information')
27
26
  .option('-d, --dump-data', 'Dump data during parsing')
@@ -38,7 +37,6 @@ async function main() {
38
37
  const watchFileChanges = options.watch;
39
38
  const dumpNets = options.dumpNets;
40
39
  const dumpData = options.dumpData;
41
- const kicadNetlist = options.kicadNetlist;
42
40
  let currentDirectory = options.currentDirectory ?? null;
43
41
  if (watchFileChanges) {
44
42
  console.log('watching for file changes...');
@@ -75,7 +73,6 @@ async function main() {
75
73
  defaultLibsPath,
76
74
  dumpNets,
77
75
  dumpData,
78
- kicadNetlistPath: kicadNetlist,
79
76
  showStats: options.stats,
80
77
  };
81
78
  let outputPath = null;
@@ -18,7 +18,7 @@ var FrameParamKeys;
18
18
  FrameParamKeys["Width"] = "width";
19
19
  FrameParamKeys["Height"] = "height";
20
20
  FrameParamKeys["PaperSize"] = "paper_size";
21
- FrameParamKeys["SheetFrame"] = "sheet_frame";
21
+ FrameParamKeys["SheetType"] = "sheet_type";
22
22
  })(FrameParamKeys || (exports.FrameParamKeys = FrameParamKeys = {}));
23
23
  var FramePlotDirection;
24
24
  (function (FramePlotDirection) {
@@ -36,7 +36,7 @@ function renderSheetsToSVG(sheetFrames) {
36
36
  let sheetYOffset = 0;
37
37
  if (sheet.frame.frame) {
38
38
  const frameComponent = sheet.frame.frame.parameters
39
- .get(Frame_js_1.FrameParamKeys.SheetFrame);
39
+ .get(Frame_js_1.FrameParamKeys.SheetType);
40
40
  if (frameComponent) {
41
41
  if (frameComponent.displayProp === null) {
42
42
  throw 'Invalid graphic object for sheet frame';
@@ -257,8 +257,8 @@ function drawGrid(group, canvasSize, extendGrid) {
257
257
  }
258
258
  function drawSheetFrameBorder(frameGroup, frame) {
259
259
  const frameParams = frame.frame.parameters;
260
- if (frameParams.has(Frame_js_1.FrameParamKeys.SheetFrame)) {
261
- const frameComponent = frameParams.get(Frame_js_1.FrameParamKeys.SheetFrame);
260
+ if (frameParams.has(Frame_js_1.FrameParamKeys.SheetType)) {
261
+ const frameComponent = frameParams.get(Frame_js_1.FrameParamKeys.SheetType);
262
262
  const { displayProp = null } = frameComponent ?? {};
263
263
  if (displayProp) {
264
264
  const sheetFrameGroup = frameGroup.group();
@@ -842,7 +842,7 @@ class ParserVisitor extends BaseVisitor_js_1.BaseVisitor {
842
842
  this.log('exit while loop');
843
843
  };
844
844
  this.visitFor_expr = (ctx) => {
845
- const forVariableName = ctx.ID().getText();
845
+ const forVariableNames = ctx.ID().map(item => item.getText());
846
846
  const ctxDataExpr = ctx.data_expr();
847
847
  this.visit(ctxDataExpr);
848
848
  const listItems = this.getResult(ctxDataExpr);
@@ -851,7 +851,13 @@ class ParserVisitor extends BaseVisitor_js_1.BaseVisitor {
851
851
  let counter = 0;
852
852
  while (keepLooping) {
853
853
  if (counter < listItems.length) {
854
- this.getExecutor().scope.variables.set(forVariableName, listItems[counter]);
854
+ let useValueArray = listItems[counter];
855
+ if (!Array.isArray(useValueArray)) {
856
+ useValueArray = [useValueArray];
857
+ }
858
+ useValueArray.forEach((value, index) => {
859
+ this.getExecutor().scope.variables.set(forVariableNames[index], value);
860
+ });
855
861
  this.visit(ctx.expressions_block());
856
862
  keepLooping = true;
857
863
  const currentResult = this.getResult(ctx) ?? {};
@@ -1129,11 +1135,11 @@ class ParserVisitor extends BaseVisitor_js_1.BaseVisitor {
1129
1135
  const baseScope = this.getExecutor().scope;
1130
1136
  const document = baseScope.variables.get(globals_js_1.GlobalDocumentName);
1131
1137
  let frameComponent = null;
1132
- if (document && document[Frame_js_1.FrameParamKeys.SheetFrame]) {
1133
- frameComponent = document[Frame_js_1.FrameParamKeys.SheetFrame];
1138
+ if (document && document[Frame_js_1.FrameParamKeys.SheetType]) {
1139
+ frameComponent = document[Frame_js_1.FrameParamKeys.SheetType];
1134
1140
  baseScope.frames.forEach(item => {
1135
1141
  if (item.frameType === globals_js_1.FrameType.Sheet) {
1136
- item.parameters.set(Frame_js_1.FrameParamKeys.SheetFrame, frameComponent);
1142
+ item.parameters.set(Frame_js_1.FrameParamKeys.SheetType, frameComponent);
1137
1143
  }
1138
1144
  });
1139
1145
  }
@@ -1218,6 +1224,9 @@ class ComponentAnnotater {
1218
1224
  this.counter[type] = 1;
1219
1225
  }
1220
1226
  }
1227
+ if (ComponentRefDesPrefixes[type] === undefined) {
1228
+ return null;
1229
+ }
1221
1230
  let attempts = 100;
1222
1231
  let proposedName;
1223
1232
  while (attempts >= 0) {