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/cjs/BaseVisitor.js
CHANGED
|
@@ -34,6 +34,7 @@ class BaseVisitor extends CircuitScriptVisitor_js_1.CircuitScriptVisitor {
|
|
|
34
34
|
];
|
|
35
35
|
this.onErrorHandler = null;
|
|
36
36
|
this.importedFiles = [];
|
|
37
|
+
this.warnings = [];
|
|
37
38
|
this.onImportFile = async (visitor, filePath, fileData, onErrorHandler) => {
|
|
38
39
|
throw "Import file not implemented";
|
|
39
40
|
};
|
|
@@ -329,7 +330,7 @@ class BaseVisitor extends CircuitScriptVisitor_js_1.CircuitScriptVisitor {
|
|
|
329
330
|
this.setResult(ctx, returnList);
|
|
330
331
|
};
|
|
331
332
|
this.visitImport_expr = (ctx) => {
|
|
332
|
-
throw new utils_js_1.RuntimeExecutionError("Cannot parse imports here", ctx
|
|
333
|
+
throw new utils_js_1.RuntimeExecutionError("Cannot parse imports here", ctx);
|
|
333
334
|
};
|
|
334
335
|
this.visitFunction_return_expr = (ctx) => {
|
|
335
336
|
const executor = this.getExecutor();
|
|
@@ -378,7 +379,7 @@ class BaseVisitor extends CircuitScriptVisitor_js_1.CircuitScriptVisitor {
|
|
|
378
379
|
this.logger = new logger_js_1.Logger();
|
|
379
380
|
this.onErrorHandler = onErrorHandler;
|
|
380
381
|
this.environment = environment;
|
|
381
|
-
this.startingContext = new execute_js_1.ExecutionContext(globals_js_1.DoubleDelimiter1, `${globals_js_1.DoubleDelimiter1}.`, '/', 0, 0, silent, this.logger, null);
|
|
382
|
+
this.startingContext = new execute_js_1.ExecutionContext(globals_js_1.DoubleDelimiter1, `${globals_js_1.DoubleDelimiter1}.`, '/', 0, 0, silent, this.logger, this.warnings, null);
|
|
382
383
|
const scope = this.startingContext.scope;
|
|
383
384
|
scope.sequence.push([
|
|
384
385
|
ExecutionScope_js_1.SequenceAction.At, scope.componentRoot, scope.currentPin
|
|
@@ -522,7 +523,7 @@ class BaseVisitor extends CircuitScriptVisitor_js_1.CircuitScriptVisitor {
|
|
|
522
523
|
}
|
|
523
524
|
catch (err) {
|
|
524
525
|
if (ctx != null) {
|
|
525
|
-
throw new utils_js_1.RuntimeExecutionError("An error occurred while importing file", ctx
|
|
526
|
+
throw new utils_js_1.RuntimeExecutionError("An error occurred while importing file", ctx);
|
|
526
527
|
}
|
|
527
528
|
else {
|
|
528
529
|
this.log('An error occurred while importing file:', err.message);
|
|
@@ -538,7 +539,7 @@ class BaseVisitor extends CircuitScriptVisitor_js_1.CircuitScriptVisitor {
|
|
|
538
539
|
}
|
|
539
540
|
}
|
|
540
541
|
if (errorMessage !== null && ctx) {
|
|
541
|
-
throw new utils_js_1.RuntimeExecutionError(errorMessage, ctx
|
|
542
|
+
throw new utils_js_1.RuntimeExecutionError(errorMessage, ctx);
|
|
542
543
|
}
|
|
543
544
|
const newImportedFile = {
|
|
544
545
|
id: name.trim(),
|
|
@@ -636,7 +637,7 @@ class BaseVisitor extends CircuitScriptVisitor_js_1.CircuitScriptVisitor {
|
|
|
636
637
|
const executionLevel = currentExecutionContext.executionLevel;
|
|
637
638
|
const executionContextNamespace = currentExecutionContext.namespace
|
|
638
639
|
+ executionContextName + ".";
|
|
639
|
-
const newExecutor = new execute_js_1.ExecutionContext(executionContextName, executionContextNamespace, netNamespace, executionLevel + 1, this.getExecutor().scope.indentLevel + 1, currentExecutionContext.silent, currentExecutionContext.logger, parentContext);
|
|
640
|
+
const newExecutor = new execute_js_1.ExecutionContext(executionContextName, executionContextNamespace, netNamespace, executionLevel + 1, this.getExecutor().scope.indentLevel + 1, currentExecutionContext.silent, currentExecutionContext.logger, currentExecutionContext.warnings, parentContext);
|
|
640
641
|
executionStack.push(newExecutor);
|
|
641
642
|
this.setupDefinedParameters(funcDefinedParameters, passedInParameters, newExecutor);
|
|
642
643
|
return newExecutor;
|
|
@@ -653,7 +654,7 @@ class BaseVisitor extends CircuitScriptVisitor_js_1.CircuitScriptVisitor {
|
|
|
653
654
|
}
|
|
654
655
|
const result = validateFunction(value);
|
|
655
656
|
if (!result) {
|
|
656
|
-
throw new utils_js_1.RuntimeExecutionError(`Invalid ${expectedType}`, context
|
|
657
|
+
throw new utils_js_1.RuntimeExecutionError(`Invalid ${expectedType}`, context);
|
|
657
658
|
}
|
|
658
659
|
return result;
|
|
659
660
|
}
|
|
@@ -3201,8 +3201,22 @@ class CircuitScriptParser extends antlr.Parser {
|
|
|
3201
3201
|
{
|
|
3202
3202
|
this.state = 630;
|
|
3203
3203
|
this.match(CircuitScriptParser.Point);
|
|
3204
|
-
this.state =
|
|
3205
|
-
this.
|
|
3204
|
+
this.state = 633;
|
|
3205
|
+
this.errorHandler.sync(this);
|
|
3206
|
+
switch (this.interpreter.adaptivePredict(this.tokenStream, 69, this.context)) {
|
|
3207
|
+
case 1:
|
|
3208
|
+
{
|
|
3209
|
+
this.state = 631;
|
|
3210
|
+
this.match(CircuitScriptParser.ID);
|
|
3211
|
+
}
|
|
3212
|
+
break;
|
|
3213
|
+
case 2:
|
|
3214
|
+
{
|
|
3215
|
+
this.state = 632;
|
|
3216
|
+
this.data_expr(0);
|
|
3217
|
+
}
|
|
3218
|
+
break;
|
|
3219
|
+
}
|
|
3206
3220
|
}
|
|
3207
3221
|
}
|
|
3208
3222
|
catch (re) {
|
|
@@ -3225,9 +3239,9 @@ class CircuitScriptParser extends antlr.Parser {
|
|
|
3225
3239
|
try {
|
|
3226
3240
|
this.enterOuterAlt(localContext, 1);
|
|
3227
3241
|
{
|
|
3228
|
-
this.state =
|
|
3242
|
+
this.state = 635;
|
|
3229
3243
|
this.match(CircuitScriptParser.Import);
|
|
3230
|
-
this.state =
|
|
3244
|
+
this.state = 636;
|
|
3231
3245
|
this.match(CircuitScriptParser.ID);
|
|
3232
3246
|
}
|
|
3233
3247
|
}
|
|
@@ -3252,7 +3266,7 @@ class CircuitScriptParser extends antlr.Parser {
|
|
|
3252
3266
|
try {
|
|
3253
3267
|
this.enterOuterAlt(localContext, 1);
|
|
3254
3268
|
{
|
|
3255
|
-
this.state =
|
|
3269
|
+
this.state = 638;
|
|
3256
3270
|
_la = this.tokenStream.LA(1);
|
|
3257
3271
|
if (!(_la === 32 || _la === 33)) {
|
|
3258
3272
|
this.errorHandler.recoverInline(this);
|
|
@@ -3261,9 +3275,9 @@ class CircuitScriptParser extends antlr.Parser {
|
|
|
3261
3275
|
this.errorHandler.reportMatch(this);
|
|
3262
3276
|
this.consume();
|
|
3263
3277
|
}
|
|
3264
|
-
this.state =
|
|
3278
|
+
this.state = 639;
|
|
3265
3279
|
this.match(CircuitScriptParser.T__0);
|
|
3266
|
-
this.state =
|
|
3280
|
+
this.state = 640;
|
|
3267
3281
|
this.expressions_block();
|
|
3268
3282
|
}
|
|
3269
3283
|
}
|
|
@@ -3289,36 +3303,36 @@ class CircuitScriptParser extends antlr.Parser {
|
|
|
3289
3303
|
let alternative;
|
|
3290
3304
|
this.enterOuterAlt(localContext, 1);
|
|
3291
3305
|
{
|
|
3292
|
-
this.state =
|
|
3306
|
+
this.state = 642;
|
|
3293
3307
|
this.match(CircuitScriptParser.If);
|
|
3294
|
-
this.state =
|
|
3308
|
+
this.state = 643;
|
|
3295
3309
|
this.data_expr(0);
|
|
3296
|
-
this.state =
|
|
3310
|
+
this.state = 644;
|
|
3297
3311
|
this.match(CircuitScriptParser.T__0);
|
|
3298
|
-
this.state =
|
|
3312
|
+
this.state = 645;
|
|
3299
3313
|
this.expressions_block();
|
|
3300
|
-
this.state =
|
|
3314
|
+
this.state = 649;
|
|
3301
3315
|
this.errorHandler.sync(this);
|
|
3302
|
-
alternative = this.interpreter.adaptivePredict(this.tokenStream,
|
|
3316
|
+
alternative = this.interpreter.adaptivePredict(this.tokenStream, 70, this.context);
|
|
3303
3317
|
while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) {
|
|
3304
3318
|
if (alternative === 1) {
|
|
3305
3319
|
{
|
|
3306
3320
|
{
|
|
3307
|
-
this.state =
|
|
3321
|
+
this.state = 646;
|
|
3308
3322
|
this.if_inner_expr();
|
|
3309
3323
|
}
|
|
3310
3324
|
}
|
|
3311
3325
|
}
|
|
3312
|
-
this.state =
|
|
3326
|
+
this.state = 651;
|
|
3313
3327
|
this.errorHandler.sync(this);
|
|
3314
|
-
alternative = this.interpreter.adaptivePredict(this.tokenStream,
|
|
3328
|
+
alternative = this.interpreter.adaptivePredict(this.tokenStream, 70, this.context);
|
|
3315
3329
|
}
|
|
3316
|
-
this.state =
|
|
3330
|
+
this.state = 653;
|
|
3317
3331
|
this.errorHandler.sync(this);
|
|
3318
3332
|
_la = this.tokenStream.LA(1);
|
|
3319
3333
|
if (_la === 30) {
|
|
3320
3334
|
{
|
|
3321
|
-
this.state =
|
|
3335
|
+
this.state = 652;
|
|
3322
3336
|
this.else_expr();
|
|
3323
3337
|
}
|
|
3324
3338
|
}
|
|
@@ -3344,15 +3358,15 @@ class CircuitScriptParser extends antlr.Parser {
|
|
|
3344
3358
|
try {
|
|
3345
3359
|
this.enterOuterAlt(localContext, 1);
|
|
3346
3360
|
{
|
|
3347
|
-
this.state =
|
|
3361
|
+
this.state = 655;
|
|
3348
3362
|
this.match(CircuitScriptParser.Else);
|
|
3349
|
-
this.state =
|
|
3363
|
+
this.state = 656;
|
|
3350
3364
|
this.match(CircuitScriptParser.If);
|
|
3351
|
-
this.state =
|
|
3365
|
+
this.state = 657;
|
|
3352
3366
|
this.data_expr(0);
|
|
3353
|
-
this.state =
|
|
3367
|
+
this.state = 658;
|
|
3354
3368
|
this.match(CircuitScriptParser.T__0);
|
|
3355
|
-
this.state =
|
|
3369
|
+
this.state = 659;
|
|
3356
3370
|
this.expressions_block();
|
|
3357
3371
|
}
|
|
3358
3372
|
}
|
|
@@ -3376,11 +3390,11 @@ class CircuitScriptParser extends antlr.Parser {
|
|
|
3376
3390
|
try {
|
|
3377
3391
|
this.enterOuterAlt(localContext, 1);
|
|
3378
3392
|
{
|
|
3379
|
-
this.state =
|
|
3393
|
+
this.state = 661;
|
|
3380
3394
|
this.match(CircuitScriptParser.Else);
|
|
3381
|
-
this.state =
|
|
3395
|
+
this.state = 662;
|
|
3382
3396
|
this.match(CircuitScriptParser.T__0);
|
|
3383
|
-
this.state =
|
|
3397
|
+
this.state = 663;
|
|
3384
3398
|
this.expressions_block();
|
|
3385
3399
|
}
|
|
3386
3400
|
}
|
|
@@ -3404,13 +3418,13 @@ class CircuitScriptParser extends antlr.Parser {
|
|
|
3404
3418
|
try {
|
|
3405
3419
|
this.enterOuterAlt(localContext, 1);
|
|
3406
3420
|
{
|
|
3407
|
-
this.state =
|
|
3421
|
+
this.state = 665;
|
|
3408
3422
|
this.match(CircuitScriptParser.While);
|
|
3409
|
-
this.state =
|
|
3423
|
+
this.state = 666;
|
|
3410
3424
|
this.data_expr(0);
|
|
3411
|
-
this.state =
|
|
3425
|
+
this.state = 667;
|
|
3412
3426
|
this.match(CircuitScriptParser.T__0);
|
|
3413
|
-
this.state =
|
|
3427
|
+
this.state = 668;
|
|
3414
3428
|
this.expressions_block();
|
|
3415
3429
|
}
|
|
3416
3430
|
}
|
|
@@ -3435,33 +3449,33 @@ class CircuitScriptParser extends antlr.Parser {
|
|
|
3435
3449
|
try {
|
|
3436
3450
|
this.enterOuterAlt(localContext, 1);
|
|
3437
3451
|
{
|
|
3438
|
-
this.state =
|
|
3452
|
+
this.state = 670;
|
|
3439
3453
|
this.match(CircuitScriptParser.For);
|
|
3440
|
-
this.state =
|
|
3454
|
+
this.state = 671;
|
|
3441
3455
|
this.match(CircuitScriptParser.ID);
|
|
3442
|
-
this.state =
|
|
3456
|
+
this.state = 676;
|
|
3443
3457
|
this.errorHandler.sync(this);
|
|
3444
3458
|
_la = this.tokenStream.LA(1);
|
|
3445
3459
|
while (_la === 2) {
|
|
3446
3460
|
{
|
|
3447
3461
|
{
|
|
3448
|
-
this.state =
|
|
3462
|
+
this.state = 672;
|
|
3449
3463
|
this.match(CircuitScriptParser.T__1);
|
|
3450
|
-
this.state =
|
|
3464
|
+
this.state = 673;
|
|
3451
3465
|
this.match(CircuitScriptParser.ID);
|
|
3452
3466
|
}
|
|
3453
3467
|
}
|
|
3454
|
-
this.state =
|
|
3468
|
+
this.state = 678;
|
|
3455
3469
|
this.errorHandler.sync(this);
|
|
3456
3470
|
_la = this.tokenStream.LA(1);
|
|
3457
3471
|
}
|
|
3458
|
-
this.state =
|
|
3472
|
+
this.state = 679;
|
|
3459
3473
|
this.match(CircuitScriptParser.In);
|
|
3460
|
-
this.state =
|
|
3474
|
+
this.state = 680;
|
|
3461
3475
|
this.data_expr(0);
|
|
3462
|
-
this.state =
|
|
3476
|
+
this.state = 681;
|
|
3463
3477
|
this.match(CircuitScriptParser.T__0);
|
|
3464
|
-
this.state =
|
|
3478
|
+
this.state = 682;
|
|
3465
3479
|
this.expressions_block();
|
|
3466
3480
|
}
|
|
3467
3481
|
}
|
|
@@ -3685,7 +3699,7 @@ CircuitScriptParser.ruleNames = [
|
|
|
3685
3699
|
"for_expr",
|
|
3686
3700
|
];
|
|
3687
3701
|
CircuitScriptParser._serializedATN = [
|
|
3688
|
-
4, 1, 67,
|
|
3702
|
+
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,
|
|
3689
3703
|
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,
|
|
3690
3704
|
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,
|
|
3691
3705
|
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,
|
|
@@ -3738,69 +3752,69 @@ CircuitScriptParser._serializedATN = [
|
|
|
3738
3752
|
52, 596, 9, 52, 3, 52, 598, 8, 52, 1, 53, 1, 53, 1, 53, 3, 53, 603, 8, 53, 1, 53, 3, 53,
|
|
3739
3753
|
606, 8, 53, 1, 54, 1, 54, 5, 54, 610, 8, 54, 10, 54, 12, 54, 613, 9, 54, 1, 55, 1, 55,
|
|
3740
3754
|
1, 55, 1, 55, 5, 55, 619, 8, 55, 10, 55, 12, 55, 622, 9, 55, 5, 55, 624, 8, 55, 10, 55,
|
|
3741
|
-
12, 55, 627, 9, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56,
|
|
3742
|
-
1, 58, 1, 58, 1,
|
|
3743
|
-
|
|
3744
|
-
1, 61, 1, 61, 1,
|
|
3745
|
-
|
|
3746
|
-
0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34,
|
|
3747
|
-
46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78,
|
|
3748
|
-
90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116,
|
|
3749
|
-
126, 0, 14, 2, 0, 9, 9, 19, 21, 1, 0, 56, 57, 2, 0, 57, 57, 60, 60,
|
|
3750
|
-
1, 0, 47, 51, 1, 0, 44, 46, 1, 0, 42, 43, 1, 0, 40, 41, 1, 0, 34, 39,
|
|
3751
|
-
2, 0,
|
|
3752
|
-
|
|
3753
|
-
0, 0,
|
|
3754
|
-
|
|
3755
|
-
1, 0, 0, 0,
|
|
3756
|
-
0, 0,
|
|
3757
|
-
|
|
3758
|
-
1, 0, 0, 0,
|
|
3759
|
-
0, 0,
|
|
3760
|
-
|
|
3761
|
-
1, 0, 0, 0,
|
|
3762
|
-
0, 0,
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
137,
|
|
3771
|
-
140, 141, 1, 0, 0, 0, 141, 142, 5, 0, 0, 1, 142, 1, 1, 0, 0, 0, 143,
|
|
3772
|
-
144, 166, 3, 28, 14, 0, 145, 166, 3, 26, 13, 0, 146, 166, 3, 50, 25,
|
|
3773
|
-
52, 26, 0, 148, 166, 3, 58, 29, 0, 149, 166, 3, 10, 5, 0, 150, 166, 3,
|
|
3774
|
-
166, 3, 46, 23, 0, 152, 166, 3, 48, 24, 0, 153, 166, 3, 70, 35, 0, 154,
|
|
3775
|
-
0, 155, 166, 3, 108, 54, 0, 156, 166, 3, 114, 57, 0, 157, 166, 3, 116,
|
|
3776
|
-
3, 76, 38, 0, 159, 166, 3, 36, 18, 0, 160, 166, 3, 6, 3, 0, 161, 166,
|
|
3777
|
-
166, 3, 118, 59, 0, 163, 166, 3, 124, 62, 0, 164, 166, 3, 126, 63,
|
|
3778
|
-
0,
|
|
3779
|
-
0,
|
|
3780
|
-
0,
|
|
3781
|
-
0,
|
|
3782
|
-
0,
|
|
3783
|
-
0, 0, 165, 164, 1, 0, 0, 0, 166, 3, 1, 0, 0, 0, 167, 168, 5, 64, 0, 0,
|
|
3784
|
-
0, 0, 169, 172, 5, 64, 0, 0, 170, 172, 3, 2, 1, 0, 171, 169, 1, 0, 0,
|
|
3785
|
-
0,
|
|
3786
|
-
0, 0, 175, 176, 5, 67, 0, 0, 176, 5, 1, 0, 0, 0, 177, 179, 3, 8, 4, 0,
|
|
3787
|
-
|
|
3788
|
-
182, 183, 7, 0, 0, 0, 183, 184, 5, 1, 0, 0, 184, 185, 3, 4, 2, 0, 185,
|
|
3789
|
-
187, 3, 76, 38, 0, 187, 188, 5, 1, 0, 0, 188, 189, 5, 64, 0, 0, 189,
|
|
3790
|
-
190, 193, 5, 64, 0, 0, 191, 193, 3, 12, 6, 0, 192, 190, 1, 0, 0, 0, 192,
|
|
3791
|
-
0, 193, 194, 1, 0, 0, 0, 194, 192, 1, 0, 0, 0, 194, 195, 1, 0, 0, 0, 195,
|
|
3792
|
-
0, 196, 197, 5, 67, 0, 0, 197, 11, 1, 0, 0, 0, 198, 199, 7, 1, 0, 0, 199,
|
|
3793
|
-
0, 200, 201, 3, 68, 34, 0, 201, 13, 1, 0, 0, 0, 202, 203, 5, 15, 0, 0, 203,
|
|
3794
|
-
0, 0, 204, 15, 1, 0, 0, 0, 205, 206, 5, 56, 0, 0, 206, 209, 5, 1, 0, 0, 207,
|
|
3795
|
-
34, 0, 208, 210, 5, 56, 0, 0, 209, 207, 1, 0, 0, 0, 209, 208, 1, 0, 0, 0, 210,
|
|
3796
|
-
0, 0, 211, 214, 3, 62, 31, 0, 212, 214, 3, 50, 25, 0, 213, 211, 1, 0, 0, 0, 213,
|
|
3797
|
-
1, 0, 0, 0, 214, 218, 1, 0, 0, 0, 215, 217, 3, 16, 8, 0, 216, 215, 1, 0, 0, 0, 217,
|
|
3798
|
-
1, 0, 0, 0, 218, 216, 1, 0, 0, 0, 218, 219, 1, 0, 0, 0, 219, 222, 1, 0, 0, 0, 220,
|
|
3799
|
-
1, 0, 0, 0, 221, 223, 3, 14, 7, 0, 222, 221, 1, 0, 0, 0, 222, 223, 1, 0, 0, 0, 223,
|
|
3800
|
-
1, 0, 0, 0, 224, 225, 5, 16, 0, 0, 225, 226, 3, 18, 9, 0, 226, 21, 1, 0, 0, 0, 227,
|
|
3801
|
-
3, 18, 9, 0, 228, 231, 3, 14, 7, 0, 229, 231, 5, 19, 0, 0, 230, 227, 1, 0, 0, 0, 230,
|
|
3802
|
-
1, 0, 0, 0, 230, 229, 1, 0, 0, 0, 231, 23, 1, 0, 0, 0, 232, 233, 7, 2, 0, 0, 233, 25,
|
|
3803
|
-
0, 0, 0, 234, 235, 5, 17, 0, 0, 235, 236, 3, 22, 11, 0, 236, 27, 1, 0, 0, 0, 237, 238,
|
|
3755
|
+
12, 55, 627, 9, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 3, 56, 634, 8, 56, 1, 57, 1, 57,
|
|
3756
|
+
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,
|
|
3757
|
+
10, 59, 12, 59, 651, 9, 59, 1, 59, 3, 59, 654, 8, 59, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60,
|
|
3758
|
+
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,
|
|
3759
|
+
1, 63, 5, 63, 675, 8, 63, 10, 63, 12, 63, 678, 9, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63,
|
|
3760
|
+
1, 63, 0, 1, 62, 64, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34,
|
|
3761
|
+
36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78,
|
|
3762
|
+
80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116,
|
|
3763
|
+
118, 120, 122, 124, 126, 0, 14, 2, 0, 9, 9, 19, 21, 1, 0, 56, 57, 2, 0, 57, 57, 60, 60,
|
|
3764
|
+
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,
|
|
3765
|
+
2, 0, 31, 31, 43, 43, 2, 0, 55, 55, 57, 61, 2, 0, 15, 15, 56, 56, 2, 0, 56, 57, 60, 60,
|
|
3766
|
+
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,
|
|
3767
|
+
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,
|
|
3768
|
+
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,
|
|
3769
|
+
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,
|
|
3770
|
+
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,
|
|
3771
|
+
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,
|
|
3772
|
+
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,
|
|
3773
|
+
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,
|
|
3774
|
+
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,
|
|
3775
|
+
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,
|
|
3776
|
+
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,
|
|
3777
|
+
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,
|
|
3778
|
+
586, 1, 0, 0, 0, 104, 597, 1, 0, 0, 0, 106, 605, 1, 0, 0, 0, 108, 607, 1, 0, 0, 0, 110,
|
|
3779
|
+
614, 1, 0, 0, 0, 112, 630, 1, 0, 0, 0, 114, 635, 1, 0, 0, 0, 116, 638, 1, 0, 0, 0, 118,
|
|
3780
|
+
642, 1, 0, 0, 0, 120, 655, 1, 0, 0, 0, 122, 661, 1, 0, 0, 0, 124, 665, 1, 0, 0, 0, 126,
|
|
3781
|
+
670, 1, 0, 0, 0, 128, 131, 3, 114, 57, 0, 129, 131, 5, 64, 0, 0, 130, 128, 1, 0, 0, 0,
|
|
3782
|
+
130, 129, 1, 0, 0, 0, 131, 134, 1, 0, 0, 0, 132, 130, 1, 0, 0, 0, 132, 133, 1, 0, 0, 0,
|
|
3783
|
+
133, 137, 1, 0, 0, 0, 134, 132, 1, 0, 0, 0, 135, 138, 3, 2, 1, 0, 136, 138, 5, 64, 0, 0,
|
|
3784
|
+
137, 135, 1, 0, 0, 0, 137, 136, 1, 0, 0, 0, 138, 139, 1, 0, 0, 0, 139, 137, 1, 0, 0, 0,
|
|
3785
|
+
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,
|
|
3786
|
+
166, 3, 20, 10, 0, 144, 166, 3, 28, 14, 0, 145, 166, 3, 26, 13, 0, 146, 166, 3, 50, 25,
|
|
3787
|
+
0, 147, 166, 3, 52, 26, 0, 148, 166, 3, 58, 29, 0, 149, 166, 3, 10, 5, 0, 150, 166, 3,
|
|
3788
|
+
60, 30, 0, 151, 166, 3, 46, 23, 0, 152, 166, 3, 48, 24, 0, 153, 166, 3, 70, 35, 0, 154,
|
|
3789
|
+
166, 3, 80, 40, 0, 155, 166, 3, 108, 54, 0, 156, 166, 3, 114, 57, 0, 157, 166, 3, 116,
|
|
3790
|
+
58, 0, 158, 166, 3, 76, 38, 0, 159, 166, 3, 36, 18, 0, 160, 166, 3, 6, 3, 0, 161, 166,
|
|
3791
|
+
3, 112, 56, 0, 162, 166, 3, 118, 59, 0, 163, 166, 3, 124, 62, 0, 164, 166, 3, 126, 63,
|
|
3792
|
+
0, 165, 143, 1, 0, 0, 0, 165, 144, 1, 0, 0, 0, 165, 145, 1, 0, 0, 0, 165, 146, 1, 0, 0,
|
|
3793
|
+
0, 165, 147, 1, 0, 0, 0, 165, 148, 1, 0, 0, 0, 165, 149, 1, 0, 0, 0, 165, 150, 1, 0, 0,
|
|
3794
|
+
0, 165, 151, 1, 0, 0, 0, 165, 152, 1, 0, 0, 0, 165, 153, 1, 0, 0, 0, 165, 154, 1, 0, 0,
|
|
3795
|
+
0, 165, 155, 1, 0, 0, 0, 165, 156, 1, 0, 0, 0, 165, 157, 1, 0, 0, 0, 165, 158, 1, 0, 0,
|
|
3796
|
+
0, 165, 159, 1, 0, 0, 0, 165, 160, 1, 0, 0, 0, 165, 161, 1, 0, 0, 0, 165, 162, 1, 0, 0,
|
|
3797
|
+
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,
|
|
3798
|
+
168, 171, 5, 66, 0, 0, 169, 172, 5, 64, 0, 0, 170, 172, 3, 2, 1, 0, 171, 169, 1, 0, 0,
|
|
3799
|
+
0, 171, 170, 1, 0, 0, 0, 172, 173, 1, 0, 0, 0, 173, 171, 1, 0, 0, 0, 173, 174, 1, 0, 0,
|
|
3800
|
+
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,
|
|
3801
|
+
178, 177, 1, 0, 0, 0, 179, 180, 1, 0, 0, 0, 180, 178, 1, 0, 0, 0, 180, 181, 1, 0, 0, 0,
|
|
3802
|
+
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,
|
|
3803
|
+
9, 1, 0, 0, 0, 186, 187, 3, 76, 38, 0, 187, 188, 5, 1, 0, 0, 188, 189, 5, 64, 0, 0, 189,
|
|
3804
|
+
192, 5, 66, 0, 0, 190, 193, 5, 64, 0, 0, 191, 193, 3, 12, 6, 0, 192, 190, 1, 0, 0, 0, 192,
|
|
3805
|
+
191, 1, 0, 0, 0, 193, 194, 1, 0, 0, 0, 194, 192, 1, 0, 0, 0, 194, 195, 1, 0, 0, 0, 195,
|
|
3806
|
+
196, 1, 0, 0, 0, 196, 197, 5, 67, 0, 0, 197, 11, 1, 0, 0, 0, 198, 199, 7, 1, 0, 0, 199,
|
|
3807
|
+
200, 5, 1, 0, 0, 200, 201, 3, 68, 34, 0, 201, 13, 1, 0, 0, 0, 202, 203, 5, 15, 0, 0, 203,
|
|
3808
|
+
204, 7, 2, 0, 0, 204, 15, 1, 0, 0, 0, 205, 206, 5, 56, 0, 0, 206, 209, 5, 1, 0, 0, 207,
|
|
3809
|
+
210, 3, 68, 34, 0, 208, 210, 5, 56, 0, 0, 209, 207, 1, 0, 0, 0, 209, 208, 1, 0, 0, 0, 210,
|
|
3810
|
+
17, 1, 0, 0, 0, 211, 214, 3, 62, 31, 0, 212, 214, 3, 50, 25, 0, 213, 211, 1, 0, 0, 0, 213,
|
|
3811
|
+
212, 1, 0, 0, 0, 214, 218, 1, 0, 0, 0, 215, 217, 3, 16, 8, 0, 216, 215, 1, 0, 0, 0, 217,
|
|
3812
|
+
220, 1, 0, 0, 0, 218, 216, 1, 0, 0, 0, 218, 219, 1, 0, 0, 0, 219, 222, 1, 0, 0, 0, 220,
|
|
3813
|
+
218, 1, 0, 0, 0, 221, 223, 3, 14, 7, 0, 222, 221, 1, 0, 0, 0, 222, 223, 1, 0, 0, 0, 223,
|
|
3814
|
+
19, 1, 0, 0, 0, 224, 225, 5, 16, 0, 0, 225, 226, 3, 18, 9, 0, 226, 21, 1, 0, 0, 0, 227,
|
|
3815
|
+
231, 3, 18, 9, 0, 228, 231, 3, 14, 7, 0, 229, 231, 5, 19, 0, 0, 230, 227, 1, 0, 0, 0, 230,
|
|
3816
|
+
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,
|
|
3817
|
+
1, 0, 0, 0, 234, 235, 5, 17, 0, 0, 235, 236, 3, 22, 11, 0, 236, 27, 1, 0, 0, 0, 237, 238,
|
|
3804
3818
|
5, 18, 0, 0, 238, 243, 3, 22, 11, 0, 239, 240, 5, 2, 0, 0, 240, 242, 3, 22, 11, 0, 241,
|
|
3805
3819
|
239, 1, 0, 0, 0, 242, 245, 1, 0, 0, 0, 243, 241, 1, 0, 0, 0, 243, 244, 1, 0, 0, 0, 244,
|
|
3806
3820
|
29, 1, 0, 0, 0, 245, 243, 1, 0, 0, 0, 246, 247, 5, 17, 0, 0, 247, 248, 3, 22, 11, 0, 248,
|
|
@@ -3916,25 +3930,26 @@ CircuitScriptParser._serializedATN = [
|
|
|
3916
3930
|
3, 62, 31, 0, 618, 616, 1, 0, 0, 0, 619, 622, 1, 0, 0, 0, 620, 618, 1, 0, 0, 0, 620, 621,
|
|
3917
3931
|
1, 0, 0, 0, 621, 624, 1, 0, 0, 0, 622, 620, 1, 0, 0, 0, 623, 615, 1, 0, 0, 0, 624, 627,
|
|
3918
3932
|
1, 0, 0, 0, 625, 623, 1, 0, 0, 0, 625, 626, 1, 0, 0, 0, 626, 628, 1, 0, 0, 0, 627, 625,
|
|
3919
|
-
1, 0, 0, 0, 628, 629, 5, 7, 0, 0, 629, 111, 1, 0, 0, 0, 630,
|
|
3920
|
-
5, 56, 0, 0, 632,
|
|
3921
|
-
1, 0, 0, 0,
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
681, 3,
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3933
|
+
1, 0, 0, 0, 628, 629, 5, 7, 0, 0, 629, 111, 1, 0, 0, 0, 630, 633, 5, 19, 0, 0, 631, 634,
|
|
3934
|
+
5, 56, 0, 0, 632, 634, 3, 62, 31, 0, 633, 631, 1, 0, 0, 0, 633, 632, 1, 0, 0, 0, 634, 113,
|
|
3935
|
+
1, 0, 0, 0, 635, 636, 5, 24, 0, 0, 636, 637, 5, 56, 0, 0, 637, 115, 1, 0, 0, 0, 638, 639,
|
|
3936
|
+
7, 13, 0, 0, 639, 640, 5, 1, 0, 0, 640, 641, 3, 4, 2, 0, 641, 117, 1, 0, 0, 0, 642, 643,
|
|
3937
|
+
5, 29, 0, 0, 643, 644, 3, 62, 31, 0, 644, 645, 5, 1, 0, 0, 645, 649, 3, 4, 2, 0, 646, 648,
|
|
3938
|
+
3, 120, 60, 0, 647, 646, 1, 0, 0, 0, 648, 651, 1, 0, 0, 0, 649, 647, 1, 0, 0, 0, 649, 650,
|
|
3939
|
+
1, 0, 0, 0, 650, 653, 1, 0, 0, 0, 651, 649, 1, 0, 0, 0, 652, 654, 3, 122, 61, 0, 653, 652,
|
|
3940
|
+
1, 0, 0, 0, 653, 654, 1, 0, 0, 0, 654, 119, 1, 0, 0, 0, 655, 656, 5, 30, 0, 0, 656, 657,
|
|
3941
|
+
5, 29, 0, 0, 657, 658, 3, 62, 31, 0, 658, 659, 5, 1, 0, 0, 659, 660, 3, 4, 2, 0, 660, 121,
|
|
3942
|
+
1, 0, 0, 0, 661, 662, 5, 30, 0, 0, 662, 663, 5, 1, 0, 0, 663, 664, 3, 4, 2, 0, 664, 123,
|
|
3943
|
+
1, 0, 0, 0, 665, 666, 5, 27, 0, 0, 666, 667, 3, 62, 31, 0, 667, 668, 5, 1, 0, 0, 668, 669,
|
|
3944
|
+
3, 4, 2, 0, 669, 125, 1, 0, 0, 0, 670, 671, 5, 25, 0, 0, 671, 676, 5, 56, 0, 0, 672, 673,
|
|
3945
|
+
5, 2, 0, 0, 673, 675, 5, 56, 0, 0, 674, 672, 1, 0, 0, 0, 675, 678, 1, 0, 0, 0, 676, 674,
|
|
3946
|
+
1, 0, 0, 0, 676, 677, 1, 0, 0, 0, 677, 679, 1, 0, 0, 0, 678, 676, 1, 0, 0, 0, 679, 680,
|
|
3947
|
+
5, 26, 0, 0, 680, 681, 3, 62, 31, 0, 681, 682, 5, 1, 0, 0, 682, 683, 3, 4, 2, 0, 683, 127,
|
|
3948
|
+
1, 0, 0, 0, 73, 130, 132, 137, 139, 165, 171, 173, 180, 192, 194, 209, 213, 218, 222,
|
|
3949
|
+
230, 243, 254, 262, 264, 275, 286, 288, 294, 300, 304, 329, 336, 344, 347, 365,
|
|
3950
|
+
375, 390, 392, 400, 408, 416, 418, 424, 431, 440, 452, 455, 462, 467, 472, 475,
|
|
3951
|
+
481, 484, 488, 504, 506, 514, 516, 525, 538, 540, 548, 550, 556, 564, 572, 580,
|
|
3952
|
+
594, 597, 602, 605, 611, 620, 625, 633, 649, 653, 676
|
|
3938
3953
|
];
|
|
3939
3954
|
CircuitScriptParser.vocabulary = new antlr.Vocabulary(CircuitScriptParser.literalNames, CircuitScriptParser.symbolicNames, []);
|
|
3940
3955
|
CircuitScriptParser.decisionsToDFA = CircuitScriptParser._ATN.decisionToState.map((ds, index) => new antlr.DFA(ds, index));
|
|
@@ -5952,6 +5967,9 @@ class Point_exprContext extends antlr.ParserRuleContext {
|
|
|
5952
5967
|
ID() {
|
|
5953
5968
|
return this.getToken(CircuitScriptParser.ID, 0);
|
|
5954
5969
|
}
|
|
5970
|
+
data_expr() {
|
|
5971
|
+
return this.getRuleContext(0, Data_exprContext);
|
|
5972
|
+
}
|
|
5955
5973
|
get ruleIndex() {
|
|
5956
5974
|
return CircuitScriptParser.RULE_point_expr;
|
|
5957
5975
|
}
|
|
@@ -14,6 +14,7 @@ const builtInMethods = [
|
|
|
14
14
|
['len', objectLength],
|
|
15
15
|
['arrayPush', arrayPush],
|
|
16
16
|
['arrayGet', arrayGet],
|
|
17
|
+
['arraySet', arraySet],
|
|
17
18
|
['print', null],
|
|
18
19
|
];
|
|
19
20
|
exports.buildInMethodNamesList = builtInMethods.map(item => item[0]);
|
|
@@ -113,6 +114,20 @@ function arrayGet(arrayObject, index) {
|
|
|
113
114
|
}
|
|
114
115
|
return arrayObject[useValue];
|
|
115
116
|
}
|
|
117
|
+
function arraySet(arrayObject, index, setValue) {
|
|
118
|
+
if (!Array.isArray(arrayObject)) {
|
|
119
|
+
throw "Invalid array object";
|
|
120
|
+
}
|
|
121
|
+
let useValue;
|
|
122
|
+
if (index instanceof ParamDefinition_js_1.NumericValue) {
|
|
123
|
+
useValue = index.toNumber();
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
useValue = index;
|
|
127
|
+
}
|
|
128
|
+
arrayObject[useValue] = setValue;
|
|
129
|
+
return arrayObject;
|
|
130
|
+
}
|
|
116
131
|
function getPositionParams(params) {
|
|
117
132
|
return params.map(([, , value]) => value);
|
|
118
133
|
}
|
package/dist/cjs/draw_symbols.js
CHANGED
|
@@ -83,6 +83,9 @@ class SymbolGraphic {
|
|
|
83
83
|
}
|
|
84
84
|
pinPosition(id) {
|
|
85
85
|
const pin = this.drawing.getPinPosition(id);
|
|
86
|
+
if (pin === null) {
|
|
87
|
+
throw new utils_js_1.RuntimeExecutionError(`Could not determine pin ${id} position`);
|
|
88
|
+
}
|
|
86
89
|
const [x, y] = pin.start;
|
|
87
90
|
const useX = (0, utils_js_1.roundValue)(x);
|
|
88
91
|
const useY = (0, utils_js_1.roundValue)(y);
|