circuitscript 0.1.8 → 0.1.10
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 +7 -6
- package/dist/cjs/antlr/CircuitScriptParser.js +141 -123
- package/dist/cjs/builtinMethods.js +15 -0
- package/dist/cjs/draw_symbols.js +3 -0
- package/dist/cjs/execute.js +90 -2
- package/dist/cjs/helpers.js +1 -0
- package/dist/cjs/layout.js +33 -44
- package/dist/cjs/objects/ClassComponent.js +1 -0
- package/dist/cjs/objects/ExecutionScope.js +5 -4
- package/dist/cjs/utils.js +57 -14
- package/dist/cjs/visitor.js +99 -39
- package/dist/esm/BaseVisitor.js +7 -6
- package/dist/esm/antlr/CircuitScriptParser.js +141 -123
- package/dist/esm/builtinMethods.js +15 -0
- package/dist/esm/draw_symbols.js +4 -1
- package/dist/esm/execute.js +91 -3
- package/dist/esm/helpers.js +2 -1
- package/dist/esm/layout.js +34 -45
- package/dist/esm/objects/ClassComponent.js +1 -0
- package/dist/esm/objects/ExecutionScope.js +5 -4
- package/dist/esm/utils.js +54 -13
- package/dist/esm/visitor.js +100 -40
- package/dist/types/BaseVisitor.d.ts +3 -1
- package/dist/types/antlr/CircuitScriptParser.d.ts +2 -1
- package/dist/types/execute.d.ts +6 -1
- package/dist/types/objects/ClassComponent.d.ts +1 -0
- package/dist/types/objects/ExecutionScope.d.ts +3 -2
- package/dist/types/utils.d.ts +9 -1
- package/dist/types/visitor.d.ts +2 -0
- package/package.json +1 -1
package/dist/esm/BaseVisitor.js
CHANGED
|
@@ -33,6 +33,7 @@ export class BaseVisitor extends CircuitScriptVisitor {
|
|
|
33
33
|
onErrorHandler = null;
|
|
34
34
|
environment;
|
|
35
35
|
importedFiles = [];
|
|
36
|
+
warnings = [];
|
|
36
37
|
onImportFile = async (visitor, filePath, fileData, onErrorHandler) => {
|
|
37
38
|
throw "Import file not implemented";
|
|
38
39
|
};
|
|
@@ -41,7 +42,7 @@ export class BaseVisitor extends CircuitScriptVisitor {
|
|
|
41
42
|
this.logger = new Logger();
|
|
42
43
|
this.onErrorHandler = onErrorHandler;
|
|
43
44
|
this.environment = environment;
|
|
44
|
-
this.startingContext = new ExecutionContext(DoubleDelimiter1, `${DoubleDelimiter1}.`, '/', 0, 0, silent, this.logger, null);
|
|
45
|
+
this.startingContext = new ExecutionContext(DoubleDelimiter1, `${DoubleDelimiter1}.`, '/', 0, 0, silent, this.logger, this.warnings, null);
|
|
45
46
|
const scope = this.startingContext.scope;
|
|
46
47
|
scope.sequence.push([
|
|
47
48
|
SequenceAction.At, scope.componentRoot, scope.currentPin
|
|
@@ -423,7 +424,7 @@ export class BaseVisitor extends CircuitScriptVisitor {
|
|
|
423
424
|
this.setResult(ctx, returnList);
|
|
424
425
|
};
|
|
425
426
|
visitImport_expr = (ctx) => {
|
|
426
|
-
throw new RuntimeExecutionError("Cannot parse imports here", ctx
|
|
427
|
+
throw new RuntimeExecutionError("Cannot parse imports here", ctx);
|
|
427
428
|
};
|
|
428
429
|
visitFunction_return_expr = (ctx) => {
|
|
429
430
|
const executor = this.getExecutor();
|
|
@@ -517,7 +518,7 @@ export class BaseVisitor extends CircuitScriptVisitor {
|
|
|
517
518
|
}
|
|
518
519
|
catch (err) {
|
|
519
520
|
if (ctx != null) {
|
|
520
|
-
throw new RuntimeExecutionError("An error occurred while importing file", ctx
|
|
521
|
+
throw new RuntimeExecutionError("An error occurred while importing file", ctx);
|
|
521
522
|
}
|
|
522
523
|
else {
|
|
523
524
|
this.log('An error occurred while importing file:', err.message);
|
|
@@ -533,7 +534,7 @@ export class BaseVisitor extends CircuitScriptVisitor {
|
|
|
533
534
|
}
|
|
534
535
|
}
|
|
535
536
|
if (errorMessage !== null && ctx) {
|
|
536
|
-
throw new RuntimeExecutionError(errorMessage, ctx
|
|
537
|
+
throw new RuntimeExecutionError(errorMessage, ctx);
|
|
537
538
|
}
|
|
538
539
|
const newImportedFile = {
|
|
539
540
|
id: name.trim(),
|
|
@@ -637,7 +638,7 @@ export class BaseVisitor extends CircuitScriptVisitor {
|
|
|
637
638
|
const executionLevel = currentExecutionContext.executionLevel;
|
|
638
639
|
const executionContextNamespace = currentExecutionContext.namespace
|
|
639
640
|
+ executionContextName + ".";
|
|
640
|
-
const newExecutor = new ExecutionContext(executionContextName, executionContextNamespace, netNamespace, executionLevel + 1, this.getExecutor().scope.indentLevel + 1, currentExecutionContext.silent, currentExecutionContext.logger, parentContext);
|
|
641
|
+
const newExecutor = new ExecutionContext(executionContextName, executionContextNamespace, netNamespace, executionLevel + 1, this.getExecutor().scope.indentLevel + 1, currentExecutionContext.silent, currentExecutionContext.logger, currentExecutionContext.warnings, parentContext);
|
|
641
642
|
executionStack.push(newExecutor);
|
|
642
643
|
this.setupDefinedParameters(funcDefinedParameters, passedInParameters, newExecutor);
|
|
643
644
|
return newExecutor;
|
|
@@ -654,7 +655,7 @@ export class BaseVisitor extends CircuitScriptVisitor {
|
|
|
654
655
|
}
|
|
655
656
|
const result = validateFunction(value);
|
|
656
657
|
if (!result) {
|
|
657
|
-
throw new RuntimeExecutionError(`Invalid ${expectedType}`, context
|
|
658
|
+
throw new RuntimeExecutionError(`Invalid ${expectedType}`, context);
|
|
658
659
|
}
|
|
659
660
|
return result;
|
|
660
661
|
}
|
|
@@ -3348,8 +3348,22 @@ export class CircuitScriptParser extends antlr.Parser {
|
|
|
3348
3348
|
{
|
|
3349
3349
|
this.state = 630;
|
|
3350
3350
|
this.match(CircuitScriptParser.Point);
|
|
3351
|
-
this.state =
|
|
3352
|
-
this.
|
|
3351
|
+
this.state = 633;
|
|
3352
|
+
this.errorHandler.sync(this);
|
|
3353
|
+
switch (this.interpreter.adaptivePredict(this.tokenStream, 69, this.context)) {
|
|
3354
|
+
case 1:
|
|
3355
|
+
{
|
|
3356
|
+
this.state = 631;
|
|
3357
|
+
this.match(CircuitScriptParser.ID);
|
|
3358
|
+
}
|
|
3359
|
+
break;
|
|
3360
|
+
case 2:
|
|
3361
|
+
{
|
|
3362
|
+
this.state = 632;
|
|
3363
|
+
this.data_expr(0);
|
|
3364
|
+
}
|
|
3365
|
+
break;
|
|
3366
|
+
}
|
|
3353
3367
|
}
|
|
3354
3368
|
}
|
|
3355
3369
|
catch (re) {
|
|
@@ -3372,9 +3386,9 @@ export class CircuitScriptParser extends antlr.Parser {
|
|
|
3372
3386
|
try {
|
|
3373
3387
|
this.enterOuterAlt(localContext, 1);
|
|
3374
3388
|
{
|
|
3375
|
-
this.state =
|
|
3389
|
+
this.state = 635;
|
|
3376
3390
|
this.match(CircuitScriptParser.Import);
|
|
3377
|
-
this.state =
|
|
3391
|
+
this.state = 636;
|
|
3378
3392
|
this.match(CircuitScriptParser.ID);
|
|
3379
3393
|
}
|
|
3380
3394
|
}
|
|
@@ -3399,7 +3413,7 @@ export class CircuitScriptParser extends antlr.Parser {
|
|
|
3399
3413
|
try {
|
|
3400
3414
|
this.enterOuterAlt(localContext, 1);
|
|
3401
3415
|
{
|
|
3402
|
-
this.state =
|
|
3416
|
+
this.state = 638;
|
|
3403
3417
|
_la = this.tokenStream.LA(1);
|
|
3404
3418
|
if (!(_la === 32 || _la === 33)) {
|
|
3405
3419
|
this.errorHandler.recoverInline(this);
|
|
@@ -3408,9 +3422,9 @@ export class CircuitScriptParser extends antlr.Parser {
|
|
|
3408
3422
|
this.errorHandler.reportMatch(this);
|
|
3409
3423
|
this.consume();
|
|
3410
3424
|
}
|
|
3411
|
-
this.state =
|
|
3425
|
+
this.state = 639;
|
|
3412
3426
|
this.match(CircuitScriptParser.T__0);
|
|
3413
|
-
this.state =
|
|
3427
|
+
this.state = 640;
|
|
3414
3428
|
this.expressions_block();
|
|
3415
3429
|
}
|
|
3416
3430
|
}
|
|
@@ -3436,36 +3450,36 @@ export class CircuitScriptParser extends antlr.Parser {
|
|
|
3436
3450
|
let alternative;
|
|
3437
3451
|
this.enterOuterAlt(localContext, 1);
|
|
3438
3452
|
{
|
|
3439
|
-
this.state =
|
|
3453
|
+
this.state = 642;
|
|
3440
3454
|
this.match(CircuitScriptParser.If);
|
|
3441
|
-
this.state =
|
|
3455
|
+
this.state = 643;
|
|
3442
3456
|
this.data_expr(0);
|
|
3443
|
-
this.state =
|
|
3457
|
+
this.state = 644;
|
|
3444
3458
|
this.match(CircuitScriptParser.T__0);
|
|
3445
|
-
this.state =
|
|
3459
|
+
this.state = 645;
|
|
3446
3460
|
this.expressions_block();
|
|
3447
|
-
this.state =
|
|
3461
|
+
this.state = 649;
|
|
3448
3462
|
this.errorHandler.sync(this);
|
|
3449
|
-
alternative = this.interpreter.adaptivePredict(this.tokenStream,
|
|
3463
|
+
alternative = this.interpreter.adaptivePredict(this.tokenStream, 70, this.context);
|
|
3450
3464
|
while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) {
|
|
3451
3465
|
if (alternative === 1) {
|
|
3452
3466
|
{
|
|
3453
3467
|
{
|
|
3454
|
-
this.state =
|
|
3468
|
+
this.state = 646;
|
|
3455
3469
|
this.if_inner_expr();
|
|
3456
3470
|
}
|
|
3457
3471
|
}
|
|
3458
3472
|
}
|
|
3459
|
-
this.state =
|
|
3473
|
+
this.state = 651;
|
|
3460
3474
|
this.errorHandler.sync(this);
|
|
3461
|
-
alternative = this.interpreter.adaptivePredict(this.tokenStream,
|
|
3475
|
+
alternative = this.interpreter.adaptivePredict(this.tokenStream, 70, this.context);
|
|
3462
3476
|
}
|
|
3463
|
-
this.state =
|
|
3477
|
+
this.state = 653;
|
|
3464
3478
|
this.errorHandler.sync(this);
|
|
3465
3479
|
_la = this.tokenStream.LA(1);
|
|
3466
3480
|
if (_la === 30) {
|
|
3467
3481
|
{
|
|
3468
|
-
this.state =
|
|
3482
|
+
this.state = 652;
|
|
3469
3483
|
this.else_expr();
|
|
3470
3484
|
}
|
|
3471
3485
|
}
|
|
@@ -3491,15 +3505,15 @@ export class CircuitScriptParser extends antlr.Parser {
|
|
|
3491
3505
|
try {
|
|
3492
3506
|
this.enterOuterAlt(localContext, 1);
|
|
3493
3507
|
{
|
|
3494
|
-
this.state =
|
|
3508
|
+
this.state = 655;
|
|
3495
3509
|
this.match(CircuitScriptParser.Else);
|
|
3496
|
-
this.state =
|
|
3510
|
+
this.state = 656;
|
|
3497
3511
|
this.match(CircuitScriptParser.If);
|
|
3498
|
-
this.state =
|
|
3512
|
+
this.state = 657;
|
|
3499
3513
|
this.data_expr(0);
|
|
3500
|
-
this.state =
|
|
3514
|
+
this.state = 658;
|
|
3501
3515
|
this.match(CircuitScriptParser.T__0);
|
|
3502
|
-
this.state =
|
|
3516
|
+
this.state = 659;
|
|
3503
3517
|
this.expressions_block();
|
|
3504
3518
|
}
|
|
3505
3519
|
}
|
|
@@ -3523,11 +3537,11 @@ export class CircuitScriptParser extends antlr.Parser {
|
|
|
3523
3537
|
try {
|
|
3524
3538
|
this.enterOuterAlt(localContext, 1);
|
|
3525
3539
|
{
|
|
3526
|
-
this.state =
|
|
3540
|
+
this.state = 661;
|
|
3527
3541
|
this.match(CircuitScriptParser.Else);
|
|
3528
|
-
this.state =
|
|
3542
|
+
this.state = 662;
|
|
3529
3543
|
this.match(CircuitScriptParser.T__0);
|
|
3530
|
-
this.state =
|
|
3544
|
+
this.state = 663;
|
|
3531
3545
|
this.expressions_block();
|
|
3532
3546
|
}
|
|
3533
3547
|
}
|
|
@@ -3551,13 +3565,13 @@ export class CircuitScriptParser extends antlr.Parser {
|
|
|
3551
3565
|
try {
|
|
3552
3566
|
this.enterOuterAlt(localContext, 1);
|
|
3553
3567
|
{
|
|
3554
|
-
this.state =
|
|
3568
|
+
this.state = 665;
|
|
3555
3569
|
this.match(CircuitScriptParser.While);
|
|
3556
|
-
this.state =
|
|
3570
|
+
this.state = 666;
|
|
3557
3571
|
this.data_expr(0);
|
|
3558
|
-
this.state =
|
|
3572
|
+
this.state = 667;
|
|
3559
3573
|
this.match(CircuitScriptParser.T__0);
|
|
3560
|
-
this.state =
|
|
3574
|
+
this.state = 668;
|
|
3561
3575
|
this.expressions_block();
|
|
3562
3576
|
}
|
|
3563
3577
|
}
|
|
@@ -3582,33 +3596,33 @@ export class CircuitScriptParser extends antlr.Parser {
|
|
|
3582
3596
|
try {
|
|
3583
3597
|
this.enterOuterAlt(localContext, 1);
|
|
3584
3598
|
{
|
|
3585
|
-
this.state =
|
|
3599
|
+
this.state = 670;
|
|
3586
3600
|
this.match(CircuitScriptParser.For);
|
|
3587
|
-
this.state =
|
|
3601
|
+
this.state = 671;
|
|
3588
3602
|
this.match(CircuitScriptParser.ID);
|
|
3589
|
-
this.state =
|
|
3603
|
+
this.state = 676;
|
|
3590
3604
|
this.errorHandler.sync(this);
|
|
3591
3605
|
_la = this.tokenStream.LA(1);
|
|
3592
3606
|
while (_la === 2) {
|
|
3593
3607
|
{
|
|
3594
3608
|
{
|
|
3595
|
-
this.state =
|
|
3609
|
+
this.state = 672;
|
|
3596
3610
|
this.match(CircuitScriptParser.T__1);
|
|
3597
|
-
this.state =
|
|
3611
|
+
this.state = 673;
|
|
3598
3612
|
this.match(CircuitScriptParser.ID);
|
|
3599
3613
|
}
|
|
3600
3614
|
}
|
|
3601
|
-
this.state =
|
|
3615
|
+
this.state = 678;
|
|
3602
3616
|
this.errorHandler.sync(this);
|
|
3603
3617
|
_la = this.tokenStream.LA(1);
|
|
3604
3618
|
}
|
|
3605
|
-
this.state =
|
|
3619
|
+
this.state = 679;
|
|
3606
3620
|
this.match(CircuitScriptParser.In);
|
|
3607
|
-
this.state =
|
|
3621
|
+
this.state = 680;
|
|
3608
3622
|
this.data_expr(0);
|
|
3609
|
-
this.state =
|
|
3623
|
+
this.state = 681;
|
|
3610
3624
|
this.match(CircuitScriptParser.T__0);
|
|
3611
|
-
this.state =
|
|
3625
|
+
this.state = 682;
|
|
3612
3626
|
this.expressions_block();
|
|
3613
3627
|
}
|
|
3614
3628
|
}
|
|
@@ -3647,7 +3661,7 @@ export class CircuitScriptParser extends antlr.Parser {
|
|
|
3647
3661
|
return true;
|
|
3648
3662
|
}
|
|
3649
3663
|
static _serializedATN = [
|
|
3650
|
-
4, 1, 67,
|
|
3664
|
+
4, 1, 67, 685, 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,
|
|
3651
3665
|
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,
|
|
3652
3666
|
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,
|
|
3653
3667
|
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,
|
|
@@ -3700,69 +3714,69 @@ export class CircuitScriptParser extends antlr.Parser {
|
|
|
3700
3714
|
52, 596, 9, 52, 3, 52, 598, 8, 52, 1, 53, 1, 53, 1, 53, 3, 53, 603, 8, 53, 1, 53, 3, 53,
|
|
3701
3715
|
606, 8, 53, 1, 54, 1, 54, 5, 54, 610, 8, 54, 10, 54, 12, 54, 613, 9, 54, 1, 55, 1, 55,
|
|
3702
3716
|
1, 55, 1, 55, 5, 55, 619, 8, 55, 10, 55, 12, 55, 622, 9, 55, 5, 55, 624, 8, 55, 10, 55,
|
|
3703
|
-
12, 55, 627, 9, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56,
|
|
3704
|
-
1, 58, 1, 58, 1,
|
|
3705
|
-
|
|
3706
|
-
1, 61, 1, 61, 1,
|
|
3707
|
-
|
|
3708
|
-
0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34,
|
|
3709
|
-
46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78,
|
|
3710
|
-
90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116,
|
|
3711
|
-
126, 0, 14, 2, 0, 9, 9, 19, 21, 1, 0, 56, 57, 2, 0, 57, 57, 60, 60,
|
|
3712
|
-
1, 0, 47, 51, 1, 0, 44, 46, 1, 0, 42, 43, 1, 0, 40, 41, 1, 0, 34, 39,
|
|
3713
|
-
2, 0,
|
|
3714
|
-
|
|
3715
|
-
0, 0,
|
|
3716
|
-
|
|
3717
|
-
1, 0, 0, 0,
|
|
3718
|
-
0, 0,
|
|
3719
|
-
|
|
3720
|
-
1, 0, 0, 0,
|
|
3721
|
-
0, 0,
|
|
3722
|
-
|
|
3723
|
-
1, 0, 0, 0,
|
|
3724
|
-
0, 0,
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
137,
|
|
3733
|
-
140, 141, 1, 0, 0, 0, 141, 142, 5, 0, 0, 1, 142, 1, 1, 0, 0, 0, 143,
|
|
3734
|
-
144, 166, 3, 28, 14, 0, 145, 166, 3, 26, 13, 0, 146, 166, 3, 50, 25,
|
|
3735
|
-
52, 26, 0, 148, 166, 3, 58, 29, 0, 149, 166, 3, 10, 5, 0, 150, 166, 3,
|
|
3736
|
-
166, 3, 46, 23, 0, 152, 166, 3, 48, 24, 0, 153, 166, 3, 70, 35, 0, 154,
|
|
3737
|
-
0, 155, 166, 3, 108, 54, 0, 156, 166, 3, 114, 57, 0, 157, 166, 3, 116,
|
|
3738
|
-
3, 76, 38, 0, 159, 166, 3, 36, 18, 0, 160, 166, 3, 6, 3, 0, 161, 166,
|
|
3739
|
-
166, 3, 118, 59, 0, 163, 166, 3, 124, 62, 0, 164, 166, 3, 126, 63,
|
|
3740
|
-
0,
|
|
3741
|
-
0,
|
|
3742
|
-
0,
|
|
3743
|
-
0,
|
|
3744
|
-
0,
|
|
3745
|
-
0, 0, 165, 164, 1, 0, 0, 0, 166, 3, 1, 0, 0, 0, 167, 168, 5, 64, 0, 0,
|
|
3746
|
-
0, 0, 169, 172, 5, 64, 0, 0, 170, 172, 3, 2, 1, 0, 171, 169, 1, 0, 0,
|
|
3747
|
-
0,
|
|
3748
|
-
0, 0, 175, 176, 5, 67, 0, 0, 176, 5, 1, 0, 0, 0, 177, 179, 3, 8, 4, 0,
|
|
3749
|
-
|
|
3750
|
-
182, 183, 7, 0, 0, 0, 183, 184, 5, 1, 0, 0, 184, 185, 3, 4, 2, 0, 185,
|
|
3751
|
-
187, 3, 76, 38, 0, 187, 188, 5, 1, 0, 0, 188, 189, 5, 64, 0, 0, 189,
|
|
3752
|
-
190, 193, 5, 64, 0, 0, 191, 193, 3, 12, 6, 0, 192, 190, 1, 0, 0, 0, 192,
|
|
3753
|
-
0, 193, 194, 1, 0, 0, 0, 194, 192, 1, 0, 0, 0, 194, 195, 1, 0, 0, 0, 195,
|
|
3754
|
-
0, 196, 197, 5, 67, 0, 0, 197, 11, 1, 0, 0, 0, 198, 199, 7, 1, 0, 0, 199,
|
|
3755
|
-
0, 200, 201, 3, 68, 34, 0, 201, 13, 1, 0, 0, 0, 202, 203, 5, 15, 0, 0, 203,
|
|
3756
|
-
0, 0, 204, 15, 1, 0, 0, 0, 205, 206, 5, 56, 0, 0, 206, 209, 5, 1, 0, 0, 207,
|
|
3757
|
-
34, 0, 208, 210, 5, 56, 0, 0, 209, 207, 1, 0, 0, 0, 209, 208, 1, 0, 0, 0, 210,
|
|
3758
|
-
0, 0, 211, 214, 3, 62, 31, 0, 212, 214, 3, 50, 25, 0, 213, 211, 1, 0, 0, 0, 213,
|
|
3759
|
-
1, 0, 0, 0, 214, 218, 1, 0, 0, 0, 215, 217, 3, 16, 8, 0, 216, 215, 1, 0, 0, 0, 217,
|
|
3760
|
-
1, 0, 0, 0, 218, 216, 1, 0, 0, 0, 218, 219, 1, 0, 0, 0, 219, 222, 1, 0, 0, 0, 220,
|
|
3761
|
-
1, 0, 0, 0, 221, 223, 3, 14, 7, 0, 222, 221, 1, 0, 0, 0, 222, 223, 1, 0, 0, 0, 223,
|
|
3762
|
-
1, 0, 0, 0, 224, 225, 5, 16, 0, 0, 225, 226, 3, 18, 9, 0, 226, 21, 1, 0, 0, 0, 227,
|
|
3763
|
-
3, 18, 9, 0, 228, 231, 3, 14, 7, 0, 229, 231, 5, 19, 0, 0, 230, 227, 1, 0, 0, 0, 230,
|
|
3764
|
-
1, 0, 0, 0, 230, 229, 1, 0, 0, 0, 231, 23, 1, 0, 0, 0, 232, 233, 7, 2, 0, 0, 233, 25,
|
|
3765
|
-
0, 0, 0, 234, 235, 5, 17, 0, 0, 235, 236, 3, 22, 11, 0, 236, 27, 1, 0, 0, 0, 237, 238,
|
|
3717
|
+
12, 55, 627, 9, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 3, 56, 634, 8, 56, 1, 57, 1, 57,
|
|
3718
|
+
1, 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 5, 59, 648, 8, 59,
|
|
3719
|
+
10, 59, 12, 59, 651, 9, 59, 1, 59, 3, 59, 654, 8, 59, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60,
|
|
3720
|
+
1, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 63, 1, 63, 1, 63,
|
|
3721
|
+
1, 63, 5, 63, 675, 8, 63, 10, 63, 12, 63, 678, 9, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63,
|
|
3722
|
+
1, 63, 0, 1, 62, 64, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34,
|
|
3723
|
+
36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78,
|
|
3724
|
+
80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116,
|
|
3725
|
+
118, 120, 122, 124, 126, 0, 14, 2, 0, 9, 9, 19, 21, 1, 0, 56, 57, 2, 0, 57, 57, 60, 60,
|
|
3726
|
+
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, 39,
|
|
3727
|
+
2, 0, 31, 31, 43, 43, 2, 0, 55, 55, 57, 61, 2, 0, 15, 15, 56, 56, 2, 0, 56, 57, 60, 60,
|
|
3728
|
+
1, 0, 32, 33, 724, 0, 132, 1, 0, 0, 0, 2, 165, 1, 0, 0, 0, 4, 167, 1, 0, 0, 0, 6, 178, 1,
|
|
3729
|
+
0, 0, 0, 8, 182, 1, 0, 0, 0, 10, 186, 1, 0, 0, 0, 12, 198, 1, 0, 0, 0, 14, 202, 1, 0, 0, 0,
|
|
3730
|
+
16, 205, 1, 0, 0, 0, 18, 213, 1, 0, 0, 0, 20, 224, 1, 0, 0, 0, 22, 230, 1, 0, 0, 0, 24, 232,
|
|
3731
|
+
1, 0, 0, 0, 26, 234, 1, 0, 0, 0, 28, 237, 1, 0, 0, 0, 30, 246, 1, 0, 0, 0, 32, 268, 1, 0,
|
|
3732
|
+
0, 0, 34, 278, 1, 0, 0, 0, 36, 280, 1, 0, 0, 0, 38, 294, 1, 0, 0, 0, 40, 296, 1, 0, 0, 0,
|
|
3733
|
+
42, 304, 1, 0, 0, 0, 44, 306, 1, 0, 0, 0, 46, 308, 1, 0, 0, 0, 48, 310, 1, 0, 0, 0, 50, 312,
|
|
3734
|
+
1, 0, 0, 0, 52, 316, 1, 0, 0, 0, 54, 320, 1, 0, 0, 0, 56, 347, 1, 0, 0, 0, 58, 349, 1, 0,
|
|
3735
|
+
0, 0, 60, 353, 1, 0, 0, 0, 62, 375, 1, 0, 0, 0, 64, 395, 1, 0, 0, 0, 66, 397, 1, 0, 0, 0,
|
|
3736
|
+
68, 400, 1, 0, 0, 0, 70, 404, 1, 0, 0, 0, 72, 424, 1, 0, 0, 0, 74, 455, 1, 0, 0, 0, 76, 457,
|
|
3737
|
+
1, 0, 0, 0, 78, 472, 1, 0, 0, 0, 80, 475, 1, 0, 0, 0, 82, 484, 1, 0, 0, 0, 84, 490, 1, 0,
|
|
3738
|
+
0, 0, 86, 493, 1, 0, 0, 0, 88, 497, 1, 0, 0, 0, 90, 510, 1, 0, 0, 0, 92, 520, 1, 0, 0, 0,
|
|
3739
|
+
94, 530, 1, 0, 0, 0, 96, 544, 1, 0, 0, 0, 98, 580, 1, 0, 0, 0, 100, 582, 1, 0, 0, 0, 102,
|
|
3740
|
+
586, 1, 0, 0, 0, 104, 597, 1, 0, 0, 0, 106, 605, 1, 0, 0, 0, 108, 607, 1, 0, 0, 0, 110,
|
|
3741
|
+
614, 1, 0, 0, 0, 112, 630, 1, 0, 0, 0, 114, 635, 1, 0, 0, 0, 116, 638, 1, 0, 0, 0, 118,
|
|
3742
|
+
642, 1, 0, 0, 0, 120, 655, 1, 0, 0, 0, 122, 661, 1, 0, 0, 0, 124, 665, 1, 0, 0, 0, 126,
|
|
3743
|
+
670, 1, 0, 0, 0, 128, 131, 3, 114, 57, 0, 129, 131, 5, 64, 0, 0, 130, 128, 1, 0, 0, 0,
|
|
3744
|
+
130, 129, 1, 0, 0, 0, 131, 134, 1, 0, 0, 0, 132, 130, 1, 0, 0, 0, 132, 133, 1, 0, 0, 0,
|
|
3745
|
+
133, 137, 1, 0, 0, 0, 134, 132, 1, 0, 0, 0, 135, 138, 3, 2, 1, 0, 136, 138, 5, 64, 0, 0,
|
|
3746
|
+
137, 135, 1, 0, 0, 0, 137, 136, 1, 0, 0, 0, 138, 139, 1, 0, 0, 0, 139, 137, 1, 0, 0, 0,
|
|
3747
|
+
139, 140, 1, 0, 0, 0, 140, 141, 1, 0, 0, 0, 141, 142, 5, 0, 0, 1, 142, 1, 1, 0, 0, 0, 143,
|
|
3748
|
+
166, 3, 20, 10, 0, 144, 166, 3, 28, 14, 0, 145, 166, 3, 26, 13, 0, 146, 166, 3, 50, 25,
|
|
3749
|
+
0, 147, 166, 3, 52, 26, 0, 148, 166, 3, 58, 29, 0, 149, 166, 3, 10, 5, 0, 150, 166, 3,
|
|
3750
|
+
60, 30, 0, 151, 166, 3, 46, 23, 0, 152, 166, 3, 48, 24, 0, 153, 166, 3, 70, 35, 0, 154,
|
|
3751
|
+
166, 3, 80, 40, 0, 155, 166, 3, 108, 54, 0, 156, 166, 3, 114, 57, 0, 157, 166, 3, 116,
|
|
3752
|
+
58, 0, 158, 166, 3, 76, 38, 0, 159, 166, 3, 36, 18, 0, 160, 166, 3, 6, 3, 0, 161, 166,
|
|
3753
|
+
3, 112, 56, 0, 162, 166, 3, 118, 59, 0, 163, 166, 3, 124, 62, 0, 164, 166, 3, 126, 63,
|
|
3754
|
+
0, 165, 143, 1, 0, 0, 0, 165, 144, 1, 0, 0, 0, 165, 145, 1, 0, 0, 0, 165, 146, 1, 0, 0,
|
|
3755
|
+
0, 165, 147, 1, 0, 0, 0, 165, 148, 1, 0, 0, 0, 165, 149, 1, 0, 0, 0, 165, 150, 1, 0, 0,
|
|
3756
|
+
0, 165, 151, 1, 0, 0, 0, 165, 152, 1, 0, 0, 0, 165, 153, 1, 0, 0, 0, 165, 154, 1, 0, 0,
|
|
3757
|
+
0, 165, 155, 1, 0, 0, 0, 165, 156, 1, 0, 0, 0, 165, 157, 1, 0, 0, 0, 165, 158, 1, 0, 0,
|
|
3758
|
+
0, 165, 159, 1, 0, 0, 0, 165, 160, 1, 0, 0, 0, 165, 161, 1, 0, 0, 0, 165, 162, 1, 0, 0,
|
|
3759
|
+
0, 165, 163, 1, 0, 0, 0, 165, 164, 1, 0, 0, 0, 166, 3, 1, 0, 0, 0, 167, 168, 5, 64, 0, 0,
|
|
3760
|
+
168, 171, 5, 66, 0, 0, 169, 172, 5, 64, 0, 0, 170, 172, 3, 2, 1, 0, 171, 169, 1, 0, 0,
|
|
3761
|
+
0, 171, 170, 1, 0, 0, 0, 172, 173, 1, 0, 0, 0, 173, 171, 1, 0, 0, 0, 173, 174, 1, 0, 0,
|
|
3762
|
+
0, 174, 175, 1, 0, 0, 0, 175, 176, 5, 67, 0, 0, 176, 5, 1, 0, 0, 0, 177, 179, 3, 8, 4, 0,
|
|
3763
|
+
178, 177, 1, 0, 0, 0, 179, 180, 1, 0, 0, 0, 180, 178, 1, 0, 0, 0, 180, 181, 1, 0, 0, 0,
|
|
3764
|
+
181, 7, 1, 0, 0, 0, 182, 183, 7, 0, 0, 0, 183, 184, 5, 1, 0, 0, 184, 185, 3, 4, 2, 0, 185,
|
|
3765
|
+
9, 1, 0, 0, 0, 186, 187, 3, 76, 38, 0, 187, 188, 5, 1, 0, 0, 188, 189, 5, 64, 0, 0, 189,
|
|
3766
|
+
192, 5, 66, 0, 0, 190, 193, 5, 64, 0, 0, 191, 193, 3, 12, 6, 0, 192, 190, 1, 0, 0, 0, 192,
|
|
3767
|
+
191, 1, 0, 0, 0, 193, 194, 1, 0, 0, 0, 194, 192, 1, 0, 0, 0, 194, 195, 1, 0, 0, 0, 195,
|
|
3768
|
+
196, 1, 0, 0, 0, 196, 197, 5, 67, 0, 0, 197, 11, 1, 0, 0, 0, 198, 199, 7, 1, 0, 0, 199,
|
|
3769
|
+
200, 5, 1, 0, 0, 200, 201, 3, 68, 34, 0, 201, 13, 1, 0, 0, 0, 202, 203, 5, 15, 0, 0, 203,
|
|
3770
|
+
204, 7, 2, 0, 0, 204, 15, 1, 0, 0, 0, 205, 206, 5, 56, 0, 0, 206, 209, 5, 1, 0, 0, 207,
|
|
3771
|
+
210, 3, 68, 34, 0, 208, 210, 5, 56, 0, 0, 209, 207, 1, 0, 0, 0, 209, 208, 1, 0, 0, 0, 210,
|
|
3772
|
+
17, 1, 0, 0, 0, 211, 214, 3, 62, 31, 0, 212, 214, 3, 50, 25, 0, 213, 211, 1, 0, 0, 0, 213,
|
|
3773
|
+
212, 1, 0, 0, 0, 214, 218, 1, 0, 0, 0, 215, 217, 3, 16, 8, 0, 216, 215, 1, 0, 0, 0, 217,
|
|
3774
|
+
220, 1, 0, 0, 0, 218, 216, 1, 0, 0, 0, 218, 219, 1, 0, 0, 0, 219, 222, 1, 0, 0, 0, 220,
|
|
3775
|
+
218, 1, 0, 0, 0, 221, 223, 3, 14, 7, 0, 222, 221, 1, 0, 0, 0, 222, 223, 1, 0, 0, 0, 223,
|
|
3776
|
+
19, 1, 0, 0, 0, 224, 225, 5, 16, 0, 0, 225, 226, 3, 18, 9, 0, 226, 21, 1, 0, 0, 0, 227,
|
|
3777
|
+
231, 3, 18, 9, 0, 228, 231, 3, 14, 7, 0, 229, 231, 5, 19, 0, 0, 230, 227, 1, 0, 0, 0, 230,
|
|
3778
|
+
228, 1, 0, 0, 0, 230, 229, 1, 0, 0, 0, 231, 23, 1, 0, 0, 0, 232, 233, 7, 2, 0, 0, 233, 25,
|
|
3779
|
+
1, 0, 0, 0, 234, 235, 5, 17, 0, 0, 235, 236, 3, 22, 11, 0, 236, 27, 1, 0, 0, 0, 237, 238,
|
|
3766
3780
|
5, 18, 0, 0, 238, 243, 3, 22, 11, 0, 239, 240, 5, 2, 0, 0, 240, 242, 3, 22, 11, 0, 241,
|
|
3767
3781
|
239, 1, 0, 0, 0, 242, 245, 1, 0, 0, 0, 243, 241, 1, 0, 0, 0, 243, 244, 1, 0, 0, 0, 244,
|
|
3768
3782
|
29, 1, 0, 0, 0, 245, 243, 1, 0, 0, 0, 246, 247, 5, 17, 0, 0, 247, 248, 3, 22, 11, 0, 248,
|
|
@@ -3878,25 +3892,26 @@ export class CircuitScriptParser extends antlr.Parser {
|
|
|
3878
3892
|
3, 62, 31, 0, 618, 616, 1, 0, 0, 0, 619, 622, 1, 0, 0, 0, 620, 618, 1, 0, 0, 0, 620, 621,
|
|
3879
3893
|
1, 0, 0, 0, 621, 624, 1, 0, 0, 0, 622, 620, 1, 0, 0, 0, 623, 615, 1, 0, 0, 0, 624, 627,
|
|
3880
3894
|
1, 0, 0, 0, 625, 623, 1, 0, 0, 0, 625, 626, 1, 0, 0, 0, 626, 628, 1, 0, 0, 0, 627, 625,
|
|
3881
|
-
1, 0, 0, 0, 628, 629, 5, 7, 0, 0, 629, 111, 1, 0, 0, 0, 630,
|
|
3882
|
-
5, 56, 0, 0, 632,
|
|
3883
|
-
1, 0, 0, 0,
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
681, 3,
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3895
|
+
1, 0, 0, 0, 628, 629, 5, 7, 0, 0, 629, 111, 1, 0, 0, 0, 630, 633, 5, 19, 0, 0, 631, 634,
|
|
3896
|
+
5, 56, 0, 0, 632, 634, 3, 62, 31, 0, 633, 631, 1, 0, 0, 0, 633, 632, 1, 0, 0, 0, 634, 113,
|
|
3897
|
+
1, 0, 0, 0, 635, 636, 5, 24, 0, 0, 636, 637, 5, 56, 0, 0, 637, 115, 1, 0, 0, 0, 638, 639,
|
|
3898
|
+
7, 13, 0, 0, 639, 640, 5, 1, 0, 0, 640, 641, 3, 4, 2, 0, 641, 117, 1, 0, 0, 0, 642, 643,
|
|
3899
|
+
5, 29, 0, 0, 643, 644, 3, 62, 31, 0, 644, 645, 5, 1, 0, 0, 645, 649, 3, 4, 2, 0, 646, 648,
|
|
3900
|
+
3, 120, 60, 0, 647, 646, 1, 0, 0, 0, 648, 651, 1, 0, 0, 0, 649, 647, 1, 0, 0, 0, 649, 650,
|
|
3901
|
+
1, 0, 0, 0, 650, 653, 1, 0, 0, 0, 651, 649, 1, 0, 0, 0, 652, 654, 3, 122, 61, 0, 653, 652,
|
|
3902
|
+
1, 0, 0, 0, 653, 654, 1, 0, 0, 0, 654, 119, 1, 0, 0, 0, 655, 656, 5, 30, 0, 0, 656, 657,
|
|
3903
|
+
5, 29, 0, 0, 657, 658, 3, 62, 31, 0, 658, 659, 5, 1, 0, 0, 659, 660, 3, 4, 2, 0, 660, 121,
|
|
3904
|
+
1, 0, 0, 0, 661, 662, 5, 30, 0, 0, 662, 663, 5, 1, 0, 0, 663, 664, 3, 4, 2, 0, 664, 123,
|
|
3905
|
+
1, 0, 0, 0, 665, 666, 5, 27, 0, 0, 666, 667, 3, 62, 31, 0, 667, 668, 5, 1, 0, 0, 668, 669,
|
|
3906
|
+
3, 4, 2, 0, 669, 125, 1, 0, 0, 0, 670, 671, 5, 25, 0, 0, 671, 676, 5, 56, 0, 0, 672, 673,
|
|
3907
|
+
5, 2, 0, 0, 673, 675, 5, 56, 0, 0, 674, 672, 1, 0, 0, 0, 675, 678, 1, 0, 0, 0, 676, 674,
|
|
3908
|
+
1, 0, 0, 0, 676, 677, 1, 0, 0, 0, 677, 679, 1, 0, 0, 0, 678, 676, 1, 0, 0, 0, 679, 680,
|
|
3909
|
+
5, 26, 0, 0, 680, 681, 3, 62, 31, 0, 681, 682, 5, 1, 0, 0, 682, 683, 3, 4, 2, 0, 683, 127,
|
|
3910
|
+
1, 0, 0, 0, 73, 130, 132, 137, 139, 165, 171, 173, 180, 192, 194, 209, 213, 218, 222,
|
|
3911
|
+
230, 243, 254, 262, 264, 275, 286, 288, 294, 300, 304, 329, 336, 344, 347, 365,
|
|
3912
|
+
375, 390, 392, 400, 408, 416, 418, 424, 431, 440, 452, 455, 462, 467, 472, 475,
|
|
3913
|
+
481, 484, 488, 504, 506, 514, 516, 525, 538, 540, 548, 550, 556, 564, 572, 580,
|
|
3914
|
+
594, 597, 602, 605, 611, 620, 625, 633, 649, 653, 676
|
|
3900
3915
|
];
|
|
3901
3916
|
static __ATN;
|
|
3902
3917
|
static get _ATN() {
|
|
@@ -5854,6 +5869,9 @@ export class Point_exprContext extends antlr.ParserRuleContext {
|
|
|
5854
5869
|
ID() {
|
|
5855
5870
|
return this.getToken(CircuitScriptParser.ID, 0);
|
|
5856
5871
|
}
|
|
5872
|
+
data_expr() {
|
|
5873
|
+
return this.getRuleContext(0, Data_exprContext);
|
|
5874
|
+
}
|
|
5857
5875
|
get ruleIndex() {
|
|
5858
5876
|
return CircuitScriptParser.RULE_point_expr;
|
|
5859
5877
|
}
|
|
@@ -8,6 +8,7 @@ const builtInMethods = [
|
|
|
8
8
|
['len', objectLength],
|
|
9
9
|
['arrayPush', arrayPush],
|
|
10
10
|
['arrayGet', arrayGet],
|
|
11
|
+
['arraySet', arraySet],
|
|
11
12
|
['print', null],
|
|
12
13
|
];
|
|
13
14
|
export const buildInMethodNamesList = builtInMethods.map(item => item[0]);
|
|
@@ -106,6 +107,20 @@ function arrayGet(arrayObject, index) {
|
|
|
106
107
|
}
|
|
107
108
|
return arrayObject[useValue];
|
|
108
109
|
}
|
|
110
|
+
function arraySet(arrayObject, index, setValue) {
|
|
111
|
+
if (!Array.isArray(arrayObject)) {
|
|
112
|
+
throw "Invalid array object";
|
|
113
|
+
}
|
|
114
|
+
let useValue;
|
|
115
|
+
if (index instanceof NumericValue) {
|
|
116
|
+
useValue = index.toNumber();
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
useValue = index;
|
|
120
|
+
}
|
|
121
|
+
arrayObject[useValue] = setValue;
|
|
122
|
+
return arrayObject;
|
|
123
|
+
}
|
|
109
124
|
function getPositionParams(params) {
|
|
110
125
|
return params.map(([, , value]) => value);
|
|
111
126
|
}
|
package/dist/esm/draw_symbols.js
CHANGED
|
@@ -2,7 +2,7 @@ import { milsToMM } from "./helpers.js";
|
|
|
2
2
|
import { ColorScheme, CustomSymbolParamTextSize, CustomSymbolPinIdSize, CustomSymbolPinTextSize, CustomSymbolRefDesSize, PortArrowSize, PortPaddingHorizontal, PortPaddingVertical, ReferenceTypes, RenderFlags, SymbolPinSide, defaultFont, defaultPinIdTextSize, defaultPinNameTextSize, defaultSymbolLineWidth, fontDisplayScale } from "./globals.js";
|
|
3
3
|
import { Geometry, GeometryProp, HorizontalAlign, HorizontalAlignProp, Textbox, VerticalAlign, VerticalAlignProp } from "./geometry.js";
|
|
4
4
|
import { PinTypes } from "./objects/PinTypes.js";
|
|
5
|
-
import { roundValue, throwWithContext } from "./utils.js";
|
|
5
|
+
import { roundValue, RuntimeExecutionError, throwWithContext } from "./utils.js";
|
|
6
6
|
import { DeclaredReference, UndeclaredReference } from "./objects/types.js";
|
|
7
7
|
import { numeric, NumericValue } from "./objects/ParamDefinition.js";
|
|
8
8
|
export class SymbolGraphic {
|
|
@@ -81,6 +81,9 @@ export class SymbolGraphic {
|
|
|
81
81
|
}
|
|
82
82
|
pinPosition(id) {
|
|
83
83
|
const pin = this.drawing.getPinPosition(id);
|
|
84
|
+
if (pin === null) {
|
|
85
|
+
throw new RuntimeExecutionError(`Could not determine pin ${id} position`);
|
|
86
|
+
}
|
|
84
87
|
const [x, y] = pin.start;
|
|
85
88
|
const useX = roundValue(x);
|
|
86
89
|
const useY = roundValue(y);
|