circuitscript 0.1.9 → 0.1.11
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/SemanticTokenVisitor.js +6 -1
- package/dist/cjs/antlr/CircuitScriptParser.js +144 -137
- package/dist/cjs/builtinMethods.js +15 -0
- package/dist/cjs/draw_symbols.js +2 -1
- package/dist/cjs/geometry.js +3 -9
- package/dist/cjs/validate/SymbolValidatorVisitor.js +5 -0
- package/dist/cjs/visitor.js +24 -7
- package/dist/esm/SemanticTokenVisitor.js +6 -1
- package/dist/esm/antlr/CircuitScriptParser.js +144 -137
- package/dist/esm/builtinMethods.js +15 -0
- package/dist/esm/draw_symbols.js +2 -1
- package/dist/esm/geometry.js +3 -9
- package/dist/esm/validate/SymbolValidatorVisitor.js +5 -0
- package/dist/esm/visitor.js +24 -7
- package/dist/types/SemanticTokenVisitor.d.ts +2 -1
- package/dist/types/antlr/CircuitScriptParser.d.ts +3 -3
- package/dist/types/geometry.d.ts +0 -1
- package/dist/types/validate/SymbolValidatorVisitor.d.ts +2 -1
- package/package.json +3 -2
|
@@ -100,6 +100,11 @@ class SemanticTokensVisitor extends BaseVisitor_js_1.BaseVisitor {
|
|
|
100
100
|
this.visitImport_expr = (ctx) => {
|
|
101
101
|
this.addSemanticToken(ctx.ID(), [], 'namespace');
|
|
102
102
|
};
|
|
103
|
+
this.visitFor_expr = (ctx) => {
|
|
104
|
+
ctx.ID().forEach(item => {
|
|
105
|
+
this.addSemanticToken(item, [], 'variable');
|
|
106
|
+
});
|
|
107
|
+
};
|
|
103
108
|
this.lexer = lexer;
|
|
104
109
|
this.script = script;
|
|
105
110
|
}
|
|
@@ -187,7 +192,7 @@ const languageKeywords = [
|
|
|
187
192
|
'break', 'branch', 'create', 'component',
|
|
188
193
|
'graphic', 'wire', 'pin', 'add', 'at', 'to',
|
|
189
194
|
'point', 'join', 'parallel', 'return', 'def', 'import',
|
|
190
|
-
'true', 'false', 'nc', 'sheet', 'frame', 'if', 'for',
|
|
195
|
+
'true', 'false', 'nc', 'sheet', 'frame', 'if', 'else', 'for', 'in',
|
|
191
196
|
];
|
|
192
197
|
const operatorKeywords = [
|
|
193
198
|
'at', 'to', 'wire', 'add', 'frame', 'join', 'parallel', 'point'
|
|
@@ -577,21 +577,13 @@ class CircuitScriptParser extends antlr.Parser {
|
|
|
577
577
|
pin_select_expr() {
|
|
578
578
|
let localContext = new Pin_select_exprContext(this.context, this.state);
|
|
579
579
|
this.enterRule(localContext, 14, CircuitScriptParser.RULE_pin_select_expr);
|
|
580
|
-
let _la;
|
|
581
580
|
try {
|
|
582
581
|
this.enterOuterAlt(localContext, 1);
|
|
583
582
|
{
|
|
584
583
|
this.state = 202;
|
|
585
584
|
this.match(CircuitScriptParser.Pin);
|
|
586
585
|
this.state = 203;
|
|
587
|
-
|
|
588
|
-
if (!(_la === 57 || _la === 60)) {
|
|
589
|
-
this.errorHandler.recoverInline(this);
|
|
590
|
-
}
|
|
591
|
-
else {
|
|
592
|
-
this.errorHandler.reportMatch(this);
|
|
593
|
-
this.consume();
|
|
594
|
-
}
|
|
586
|
+
this.data_expr(0);
|
|
595
587
|
}
|
|
596
588
|
}
|
|
597
589
|
catch (re) {
|
|
@@ -3201,8 +3193,22 @@ class CircuitScriptParser extends antlr.Parser {
|
|
|
3201
3193
|
{
|
|
3202
3194
|
this.state = 630;
|
|
3203
3195
|
this.match(CircuitScriptParser.Point);
|
|
3204
|
-
this.state =
|
|
3205
|
-
this.
|
|
3196
|
+
this.state = 633;
|
|
3197
|
+
this.errorHandler.sync(this);
|
|
3198
|
+
switch (this.interpreter.adaptivePredict(this.tokenStream, 69, this.context)) {
|
|
3199
|
+
case 1:
|
|
3200
|
+
{
|
|
3201
|
+
this.state = 631;
|
|
3202
|
+
this.match(CircuitScriptParser.ID);
|
|
3203
|
+
}
|
|
3204
|
+
break;
|
|
3205
|
+
case 2:
|
|
3206
|
+
{
|
|
3207
|
+
this.state = 632;
|
|
3208
|
+
this.data_expr(0);
|
|
3209
|
+
}
|
|
3210
|
+
break;
|
|
3211
|
+
}
|
|
3206
3212
|
}
|
|
3207
3213
|
}
|
|
3208
3214
|
catch (re) {
|
|
@@ -3225,9 +3231,9 @@ class CircuitScriptParser extends antlr.Parser {
|
|
|
3225
3231
|
try {
|
|
3226
3232
|
this.enterOuterAlt(localContext, 1);
|
|
3227
3233
|
{
|
|
3228
|
-
this.state =
|
|
3234
|
+
this.state = 635;
|
|
3229
3235
|
this.match(CircuitScriptParser.Import);
|
|
3230
|
-
this.state =
|
|
3236
|
+
this.state = 636;
|
|
3231
3237
|
this.match(CircuitScriptParser.ID);
|
|
3232
3238
|
}
|
|
3233
3239
|
}
|
|
@@ -3252,7 +3258,7 @@ class CircuitScriptParser extends antlr.Parser {
|
|
|
3252
3258
|
try {
|
|
3253
3259
|
this.enterOuterAlt(localContext, 1);
|
|
3254
3260
|
{
|
|
3255
|
-
this.state =
|
|
3261
|
+
this.state = 638;
|
|
3256
3262
|
_la = this.tokenStream.LA(1);
|
|
3257
3263
|
if (!(_la === 32 || _la === 33)) {
|
|
3258
3264
|
this.errorHandler.recoverInline(this);
|
|
@@ -3261,9 +3267,9 @@ class CircuitScriptParser extends antlr.Parser {
|
|
|
3261
3267
|
this.errorHandler.reportMatch(this);
|
|
3262
3268
|
this.consume();
|
|
3263
3269
|
}
|
|
3264
|
-
this.state =
|
|
3270
|
+
this.state = 639;
|
|
3265
3271
|
this.match(CircuitScriptParser.T__0);
|
|
3266
|
-
this.state =
|
|
3272
|
+
this.state = 640;
|
|
3267
3273
|
this.expressions_block();
|
|
3268
3274
|
}
|
|
3269
3275
|
}
|
|
@@ -3289,36 +3295,36 @@ class CircuitScriptParser extends antlr.Parser {
|
|
|
3289
3295
|
let alternative;
|
|
3290
3296
|
this.enterOuterAlt(localContext, 1);
|
|
3291
3297
|
{
|
|
3292
|
-
this.state =
|
|
3298
|
+
this.state = 642;
|
|
3293
3299
|
this.match(CircuitScriptParser.If);
|
|
3294
|
-
this.state =
|
|
3300
|
+
this.state = 643;
|
|
3295
3301
|
this.data_expr(0);
|
|
3296
|
-
this.state =
|
|
3302
|
+
this.state = 644;
|
|
3297
3303
|
this.match(CircuitScriptParser.T__0);
|
|
3298
|
-
this.state =
|
|
3304
|
+
this.state = 645;
|
|
3299
3305
|
this.expressions_block();
|
|
3300
|
-
this.state =
|
|
3306
|
+
this.state = 649;
|
|
3301
3307
|
this.errorHandler.sync(this);
|
|
3302
|
-
alternative = this.interpreter.adaptivePredict(this.tokenStream,
|
|
3308
|
+
alternative = this.interpreter.adaptivePredict(this.tokenStream, 70, this.context);
|
|
3303
3309
|
while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) {
|
|
3304
3310
|
if (alternative === 1) {
|
|
3305
3311
|
{
|
|
3306
3312
|
{
|
|
3307
|
-
this.state =
|
|
3313
|
+
this.state = 646;
|
|
3308
3314
|
this.if_inner_expr();
|
|
3309
3315
|
}
|
|
3310
3316
|
}
|
|
3311
3317
|
}
|
|
3312
|
-
this.state =
|
|
3318
|
+
this.state = 651;
|
|
3313
3319
|
this.errorHandler.sync(this);
|
|
3314
|
-
alternative = this.interpreter.adaptivePredict(this.tokenStream,
|
|
3320
|
+
alternative = this.interpreter.adaptivePredict(this.tokenStream, 70, this.context);
|
|
3315
3321
|
}
|
|
3316
|
-
this.state =
|
|
3322
|
+
this.state = 653;
|
|
3317
3323
|
this.errorHandler.sync(this);
|
|
3318
3324
|
_la = this.tokenStream.LA(1);
|
|
3319
3325
|
if (_la === 30) {
|
|
3320
3326
|
{
|
|
3321
|
-
this.state =
|
|
3327
|
+
this.state = 652;
|
|
3322
3328
|
this.else_expr();
|
|
3323
3329
|
}
|
|
3324
3330
|
}
|
|
@@ -3344,15 +3350,15 @@ class CircuitScriptParser extends antlr.Parser {
|
|
|
3344
3350
|
try {
|
|
3345
3351
|
this.enterOuterAlt(localContext, 1);
|
|
3346
3352
|
{
|
|
3347
|
-
this.state =
|
|
3353
|
+
this.state = 655;
|
|
3348
3354
|
this.match(CircuitScriptParser.Else);
|
|
3349
|
-
this.state =
|
|
3355
|
+
this.state = 656;
|
|
3350
3356
|
this.match(CircuitScriptParser.If);
|
|
3351
|
-
this.state =
|
|
3357
|
+
this.state = 657;
|
|
3352
3358
|
this.data_expr(0);
|
|
3353
|
-
this.state =
|
|
3359
|
+
this.state = 658;
|
|
3354
3360
|
this.match(CircuitScriptParser.T__0);
|
|
3355
|
-
this.state =
|
|
3361
|
+
this.state = 659;
|
|
3356
3362
|
this.expressions_block();
|
|
3357
3363
|
}
|
|
3358
3364
|
}
|
|
@@ -3376,11 +3382,11 @@ class CircuitScriptParser extends antlr.Parser {
|
|
|
3376
3382
|
try {
|
|
3377
3383
|
this.enterOuterAlt(localContext, 1);
|
|
3378
3384
|
{
|
|
3379
|
-
this.state =
|
|
3385
|
+
this.state = 661;
|
|
3380
3386
|
this.match(CircuitScriptParser.Else);
|
|
3381
|
-
this.state =
|
|
3387
|
+
this.state = 662;
|
|
3382
3388
|
this.match(CircuitScriptParser.T__0);
|
|
3383
|
-
this.state =
|
|
3389
|
+
this.state = 663;
|
|
3384
3390
|
this.expressions_block();
|
|
3385
3391
|
}
|
|
3386
3392
|
}
|
|
@@ -3404,13 +3410,13 @@ class CircuitScriptParser extends antlr.Parser {
|
|
|
3404
3410
|
try {
|
|
3405
3411
|
this.enterOuterAlt(localContext, 1);
|
|
3406
3412
|
{
|
|
3407
|
-
this.state =
|
|
3413
|
+
this.state = 665;
|
|
3408
3414
|
this.match(CircuitScriptParser.While);
|
|
3409
|
-
this.state =
|
|
3415
|
+
this.state = 666;
|
|
3410
3416
|
this.data_expr(0);
|
|
3411
|
-
this.state =
|
|
3417
|
+
this.state = 667;
|
|
3412
3418
|
this.match(CircuitScriptParser.T__0);
|
|
3413
|
-
this.state =
|
|
3419
|
+
this.state = 668;
|
|
3414
3420
|
this.expressions_block();
|
|
3415
3421
|
}
|
|
3416
3422
|
}
|
|
@@ -3435,33 +3441,33 @@ class CircuitScriptParser extends antlr.Parser {
|
|
|
3435
3441
|
try {
|
|
3436
3442
|
this.enterOuterAlt(localContext, 1);
|
|
3437
3443
|
{
|
|
3438
|
-
this.state =
|
|
3444
|
+
this.state = 670;
|
|
3439
3445
|
this.match(CircuitScriptParser.For);
|
|
3440
|
-
this.state =
|
|
3446
|
+
this.state = 671;
|
|
3441
3447
|
this.match(CircuitScriptParser.ID);
|
|
3442
|
-
this.state =
|
|
3448
|
+
this.state = 676;
|
|
3443
3449
|
this.errorHandler.sync(this);
|
|
3444
3450
|
_la = this.tokenStream.LA(1);
|
|
3445
3451
|
while (_la === 2) {
|
|
3446
3452
|
{
|
|
3447
3453
|
{
|
|
3448
|
-
this.state =
|
|
3454
|
+
this.state = 672;
|
|
3449
3455
|
this.match(CircuitScriptParser.T__1);
|
|
3450
|
-
this.state =
|
|
3456
|
+
this.state = 673;
|
|
3451
3457
|
this.match(CircuitScriptParser.ID);
|
|
3452
3458
|
}
|
|
3453
3459
|
}
|
|
3454
|
-
this.state =
|
|
3460
|
+
this.state = 678;
|
|
3455
3461
|
this.errorHandler.sync(this);
|
|
3456
3462
|
_la = this.tokenStream.LA(1);
|
|
3457
3463
|
}
|
|
3458
|
-
this.state =
|
|
3464
|
+
this.state = 679;
|
|
3459
3465
|
this.match(CircuitScriptParser.In);
|
|
3460
|
-
this.state =
|
|
3466
|
+
this.state = 680;
|
|
3461
3467
|
this.data_expr(0);
|
|
3462
|
-
this.state =
|
|
3468
|
+
this.state = 681;
|
|
3463
3469
|
this.match(CircuitScriptParser.T__0);
|
|
3464
|
-
this.state =
|
|
3470
|
+
this.state = 682;
|
|
3465
3471
|
this.expressions_block();
|
|
3466
3472
|
}
|
|
3467
3473
|
}
|
|
@@ -3685,7 +3691,7 @@ CircuitScriptParser.ruleNames = [
|
|
|
3685
3691
|
"for_expr",
|
|
3686
3692
|
];
|
|
3687
3693
|
CircuitScriptParser._serializedATN = [
|
|
3688
|
-
4, 1, 67,
|
|
3694
|
+
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
3695
|
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
3696
|
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
3697
|
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 +3744,69 @@ CircuitScriptParser._serializedATN = [
|
|
|
3738
3744
|
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
3745
|
606, 8, 53, 1, 54, 1, 54, 5, 54, 610, 8, 54, 10, 54, 12, 54, 613, 9, 54, 1, 55, 1, 55,
|
|
3740
3746
|
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
|
-
|
|
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,
|
|
3747
|
+
12, 55, 627, 9, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 3, 56, 634, 8, 56, 1, 57, 1, 57,
|
|
3748
|
+
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,
|
|
3749
|
+
10, 59, 12, 59, 651, 9, 59, 1, 59, 3, 59, 654, 8, 59, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60,
|
|
3750
|
+
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,
|
|
3751
|
+
1, 63, 5, 63, 675, 8, 63, 10, 63, 12, 63, 678, 9, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63,
|
|
3752
|
+
1, 63, 0, 1, 62, 64, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34,
|
|
3753
|
+
36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78,
|
|
3754
|
+
80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116,
|
|
3755
|
+
118, 120, 122, 124, 126, 0, 14, 2, 0, 9, 9, 19, 21, 1, 0, 56, 57, 2, 0, 57, 57, 60, 60,
|
|
3756
|
+
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,
|
|
3757
|
+
2, 0, 31, 31, 43, 43, 2, 0, 55, 55, 57, 61, 2, 0, 15, 15, 56, 56, 2, 0, 56, 57, 60, 60,
|
|
3758
|
+
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,
|
|
3759
|
+
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,
|
|
3760
|
+
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,
|
|
3761
|
+
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,
|
|
3762
|
+
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,
|
|
3763
|
+
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,
|
|
3764
|
+
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,
|
|
3765
|
+
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,
|
|
3766
|
+
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,
|
|
3767
|
+
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,
|
|
3768
|
+
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,
|
|
3769
|
+
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,
|
|
3770
|
+
586, 1, 0, 0, 0, 104, 597, 1, 0, 0, 0, 106, 605, 1, 0, 0, 0, 108, 607, 1, 0, 0, 0, 110,
|
|
3771
|
+
614, 1, 0, 0, 0, 112, 630, 1, 0, 0, 0, 114, 635, 1, 0, 0, 0, 116, 638, 1, 0, 0, 0, 118,
|
|
3772
|
+
642, 1, 0, 0, 0, 120, 655, 1, 0, 0, 0, 122, 661, 1, 0, 0, 0, 124, 665, 1, 0, 0, 0, 126,
|
|
3773
|
+
670, 1, 0, 0, 0, 128, 131, 3, 114, 57, 0, 129, 131, 5, 64, 0, 0, 130, 128, 1, 0, 0, 0,
|
|
3774
|
+
130, 129, 1, 0, 0, 0, 131, 134, 1, 0, 0, 0, 132, 130, 1, 0, 0, 0, 132, 133, 1, 0, 0, 0,
|
|
3775
|
+
133, 137, 1, 0, 0, 0, 134, 132, 1, 0, 0, 0, 135, 138, 3, 2, 1, 0, 136, 138, 5, 64, 0, 0,
|
|
3776
|
+
137, 135, 1, 0, 0, 0, 137, 136, 1, 0, 0, 0, 138, 139, 1, 0, 0, 0, 139, 137, 1, 0, 0, 0,
|
|
3777
|
+
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,
|
|
3778
|
+
166, 3, 20, 10, 0, 144, 166, 3, 28, 14, 0, 145, 166, 3, 26, 13, 0, 146, 166, 3, 50, 25,
|
|
3779
|
+
0, 147, 166, 3, 52, 26, 0, 148, 166, 3, 58, 29, 0, 149, 166, 3, 10, 5, 0, 150, 166, 3,
|
|
3780
|
+
60, 30, 0, 151, 166, 3, 46, 23, 0, 152, 166, 3, 48, 24, 0, 153, 166, 3, 70, 35, 0, 154,
|
|
3781
|
+
166, 3, 80, 40, 0, 155, 166, 3, 108, 54, 0, 156, 166, 3, 114, 57, 0, 157, 166, 3, 116,
|
|
3782
|
+
58, 0, 158, 166, 3, 76, 38, 0, 159, 166, 3, 36, 18, 0, 160, 166, 3, 6, 3, 0, 161, 166,
|
|
3783
|
+
3, 112, 56, 0, 162, 166, 3, 118, 59, 0, 163, 166, 3, 124, 62, 0, 164, 166, 3, 126, 63,
|
|
3784
|
+
0, 165, 143, 1, 0, 0, 0, 165, 144, 1, 0, 0, 0, 165, 145, 1, 0, 0, 0, 165, 146, 1, 0, 0,
|
|
3785
|
+
0, 165, 147, 1, 0, 0, 0, 165, 148, 1, 0, 0, 0, 165, 149, 1, 0, 0, 0, 165, 150, 1, 0, 0,
|
|
3786
|
+
0, 165, 151, 1, 0, 0, 0, 165, 152, 1, 0, 0, 0, 165, 153, 1, 0, 0, 0, 165, 154, 1, 0, 0,
|
|
3787
|
+
0, 165, 155, 1, 0, 0, 0, 165, 156, 1, 0, 0, 0, 165, 157, 1, 0, 0, 0, 165, 158, 1, 0, 0,
|
|
3788
|
+
0, 165, 159, 1, 0, 0, 0, 165, 160, 1, 0, 0, 0, 165, 161, 1, 0, 0, 0, 165, 162, 1, 0, 0,
|
|
3789
|
+
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,
|
|
3790
|
+
168, 171, 5, 66, 0, 0, 169, 172, 5, 64, 0, 0, 170, 172, 3, 2, 1, 0, 171, 169, 1, 0, 0,
|
|
3791
|
+
0, 171, 170, 1, 0, 0, 0, 172, 173, 1, 0, 0, 0, 173, 171, 1, 0, 0, 0, 173, 174, 1, 0, 0,
|
|
3792
|
+
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,
|
|
3793
|
+
178, 177, 1, 0, 0, 0, 179, 180, 1, 0, 0, 0, 180, 178, 1, 0, 0, 0, 180, 181, 1, 0, 0, 0,
|
|
3794
|
+
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,
|
|
3795
|
+
9, 1, 0, 0, 0, 186, 187, 3, 76, 38, 0, 187, 188, 5, 1, 0, 0, 188, 189, 5, 64, 0, 0, 189,
|
|
3796
|
+
192, 5, 66, 0, 0, 190, 193, 5, 64, 0, 0, 191, 193, 3, 12, 6, 0, 192, 190, 1, 0, 0, 0, 192,
|
|
3797
|
+
191, 1, 0, 0, 0, 193, 194, 1, 0, 0, 0, 194, 192, 1, 0, 0, 0, 194, 195, 1, 0, 0, 0, 195,
|
|
3798
|
+
196, 1, 0, 0, 0, 196, 197, 5, 67, 0, 0, 197, 11, 1, 0, 0, 0, 198, 199, 7, 1, 0, 0, 199,
|
|
3799
|
+
200, 5, 1, 0, 0, 200, 201, 3, 68, 34, 0, 201, 13, 1, 0, 0, 0, 202, 203, 5, 15, 0, 0, 203,
|
|
3800
|
+
204, 3, 62, 31, 0, 204, 15, 1, 0, 0, 0, 205, 206, 5, 56, 0, 0, 206, 209, 5, 1, 0, 0, 207,
|
|
3801
|
+
210, 3, 68, 34, 0, 208, 210, 5, 56, 0, 0, 209, 207, 1, 0, 0, 0, 209, 208, 1, 0, 0, 0, 210,
|
|
3802
|
+
17, 1, 0, 0, 0, 211, 214, 3, 62, 31, 0, 212, 214, 3, 50, 25, 0, 213, 211, 1, 0, 0, 0, 213,
|
|
3803
|
+
212, 1, 0, 0, 0, 214, 218, 1, 0, 0, 0, 215, 217, 3, 16, 8, 0, 216, 215, 1, 0, 0, 0, 217,
|
|
3804
|
+
220, 1, 0, 0, 0, 218, 216, 1, 0, 0, 0, 218, 219, 1, 0, 0, 0, 219, 222, 1, 0, 0, 0, 220,
|
|
3805
|
+
218, 1, 0, 0, 0, 221, 223, 3, 14, 7, 0, 222, 221, 1, 0, 0, 0, 222, 223, 1, 0, 0, 0, 223,
|
|
3806
|
+
19, 1, 0, 0, 0, 224, 225, 5, 16, 0, 0, 225, 226, 3, 18, 9, 0, 226, 21, 1, 0, 0, 0, 227,
|
|
3807
|
+
231, 3, 18, 9, 0, 228, 231, 3, 14, 7, 0, 229, 231, 5, 19, 0, 0, 230, 227, 1, 0, 0, 0, 230,
|
|
3808
|
+
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,
|
|
3809
|
+
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
3810
|
5, 18, 0, 0, 238, 243, 3, 22, 11, 0, 239, 240, 5, 2, 0, 0, 240, 242, 3, 22, 11, 0, 241,
|
|
3805
3811
|
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
3812
|
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 +3922,26 @@ CircuitScriptParser._serializedATN = [
|
|
|
3916
3922
|
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
3923
|
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
3924
|
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
|
-
|
|
3925
|
+
1, 0, 0, 0, 628, 629, 5, 7, 0, 0, 629, 111, 1, 0, 0, 0, 630, 633, 5, 19, 0, 0, 631, 634,
|
|
3926
|
+
5, 56, 0, 0, 632, 634, 3, 62, 31, 0, 633, 631, 1, 0, 0, 0, 633, 632, 1, 0, 0, 0, 634, 113,
|
|
3927
|
+
1, 0, 0, 0, 635, 636, 5, 24, 0, 0, 636, 637, 5, 56, 0, 0, 637, 115, 1, 0, 0, 0, 638, 639,
|
|
3928
|
+
7, 13, 0, 0, 639, 640, 5, 1, 0, 0, 640, 641, 3, 4, 2, 0, 641, 117, 1, 0, 0, 0, 642, 643,
|
|
3929
|
+
5, 29, 0, 0, 643, 644, 3, 62, 31, 0, 644, 645, 5, 1, 0, 0, 645, 649, 3, 4, 2, 0, 646, 648,
|
|
3930
|
+
3, 120, 60, 0, 647, 646, 1, 0, 0, 0, 648, 651, 1, 0, 0, 0, 649, 647, 1, 0, 0, 0, 649, 650,
|
|
3931
|
+
1, 0, 0, 0, 650, 653, 1, 0, 0, 0, 651, 649, 1, 0, 0, 0, 652, 654, 3, 122, 61, 0, 653, 652,
|
|
3932
|
+
1, 0, 0, 0, 653, 654, 1, 0, 0, 0, 654, 119, 1, 0, 0, 0, 655, 656, 5, 30, 0, 0, 656, 657,
|
|
3933
|
+
5, 29, 0, 0, 657, 658, 3, 62, 31, 0, 658, 659, 5, 1, 0, 0, 659, 660, 3, 4, 2, 0, 660, 121,
|
|
3934
|
+
1, 0, 0, 0, 661, 662, 5, 30, 0, 0, 662, 663, 5, 1, 0, 0, 663, 664, 3, 4, 2, 0, 664, 123,
|
|
3935
|
+
1, 0, 0, 0, 665, 666, 5, 27, 0, 0, 666, 667, 3, 62, 31, 0, 667, 668, 5, 1, 0, 0, 668, 669,
|
|
3936
|
+
3, 4, 2, 0, 669, 125, 1, 0, 0, 0, 670, 671, 5, 25, 0, 0, 671, 676, 5, 56, 0, 0, 672, 673,
|
|
3937
|
+
5, 2, 0, 0, 673, 675, 5, 56, 0, 0, 674, 672, 1, 0, 0, 0, 675, 678, 1, 0, 0, 0, 676, 674,
|
|
3938
|
+
1, 0, 0, 0, 676, 677, 1, 0, 0, 0, 677, 679, 1, 0, 0, 0, 678, 676, 1, 0, 0, 0, 679, 680,
|
|
3939
|
+
5, 26, 0, 0, 680, 681, 3, 62, 31, 0, 681, 682, 5, 1, 0, 0, 682, 683, 3, 4, 2, 0, 683, 127,
|
|
3940
|
+
1, 0, 0, 0, 73, 130, 132, 137, 139, 165, 171, 173, 180, 192, 194, 209, 213, 218, 222,
|
|
3941
|
+
230, 243, 254, 262, 264, 275, 286, 288, 294, 300, 304, 329, 336, 344, 347, 365,
|
|
3942
|
+
375, 390, 392, 400, 408, 416, 418, 424, 431, 440, 452, 455, 462, 467, 472, 475,
|
|
3943
|
+
481, 484, 488, 504, 506, 514, 516, 525, 538, 540, 548, 550, 556, 564, 572, 580,
|
|
3944
|
+
594, 597, 602, 605, 611, 620, 625, 633, 649, 653, 676
|
|
3938
3945
|
];
|
|
3939
3946
|
CircuitScriptParser.vocabulary = new antlr.Vocabulary(CircuitScriptParser.literalNames, CircuitScriptParser.symbolicNames, []);
|
|
3940
3947
|
CircuitScriptParser.decisionsToDFA = CircuitScriptParser._ATN.decisionToState.map((ds, index) => new antlr.DFA(ds, index));
|
|
@@ -4226,11 +4233,8 @@ class Pin_select_exprContext extends antlr.ParserRuleContext {
|
|
|
4226
4233
|
Pin() {
|
|
4227
4234
|
return this.getToken(CircuitScriptParser.Pin, 0);
|
|
4228
4235
|
}
|
|
4229
|
-
|
|
4230
|
-
return this.
|
|
4231
|
-
}
|
|
4232
|
-
STRING_VALUE() {
|
|
4233
|
-
return this.getToken(CircuitScriptParser.STRING_VALUE, 0);
|
|
4236
|
+
data_expr() {
|
|
4237
|
+
return this.getRuleContext(0, Data_exprContext);
|
|
4234
4238
|
}
|
|
4235
4239
|
get ruleIndex() {
|
|
4236
4240
|
return CircuitScriptParser.RULE_pin_select_expr;
|
|
@@ -5952,6 +5956,9 @@ class Point_exprContext extends antlr.ParserRuleContext {
|
|
|
5952
5956
|
ID() {
|
|
5953
5957
|
return this.getToken(CircuitScriptParser.ID, 0);
|
|
5954
5958
|
}
|
|
5959
|
+
data_expr() {
|
|
5960
|
+
return this.getRuleContext(0, Data_exprContext);
|
|
5961
|
+
}
|
|
5955
5962
|
get ruleIndex() {
|
|
5956
5963
|
return CircuitScriptParser.RULE_point_expr;
|
|
5957
5964
|
}
|
|
@@ -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
|
@@ -427,7 +427,8 @@ class SymbolPlaceholder extends SymbolGraphic {
|
|
|
427
427
|
drawing.addArc(...positionParams);
|
|
428
428
|
break;
|
|
429
429
|
case PlaceHolderCommands.circle:
|
|
430
|
-
drawing.addArc(...positionParams, (0, ParamDefinition_js_1.numeric)(0), (0, ParamDefinition_js_1.numeric)(
|
|
430
|
+
drawing.addArc(...positionParams, (0, ParamDefinition_js_1.numeric)(0), (0, ParamDefinition_js_1.numeric)(180));
|
|
431
|
+
drawing.addArc(...positionParams, (0, ParamDefinition_js_1.numeric)(180), (0, ParamDefinition_js_1.numeric)(360));
|
|
431
432
|
break;
|
|
432
433
|
case PlaceHolderCommands.triangle:
|
|
433
434
|
drawing.addTriangle(...positionParams);
|
package/dist/cjs/geometry.js
CHANGED
|
@@ -266,17 +266,12 @@ class Geometry {
|
|
|
266
266
|
const x = item.center.x;
|
|
267
267
|
const y = item.center.y;
|
|
268
268
|
const radius = item.r;
|
|
269
|
-
let useEndAngle = item.endAngle;
|
|
270
269
|
let extraEnd = '';
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
isClosedPolygon = true;
|
|
274
|
-
extraEnd = ' Z';
|
|
275
|
-
}
|
|
276
|
-
const startPoint = getArcPointRadians(x, y, radius, item.startAngle);
|
|
270
|
+
const { startAngle: useStartAngle, endAngle: useEndAngle } = item;
|
|
271
|
+
const startPoint = getArcPointRadians(x, y, radius, useStartAngle);
|
|
277
272
|
const endPoint = getArcPointRadians(x, y, radius, useEndAngle);
|
|
278
273
|
let largeArcSweepFlag = 0;
|
|
279
|
-
if (useEndAngle -
|
|
274
|
+
if (useEndAngle - useStartAngle > Math.PI) {
|
|
280
275
|
largeArcSweepFlag = 1;
|
|
281
276
|
}
|
|
282
277
|
let sweepFlag = 1;
|
|
@@ -428,7 +423,6 @@ class Geometry {
|
|
|
428
423
|
}
|
|
429
424
|
}
|
|
430
425
|
exports.Geometry = Geometry;
|
|
431
|
-
Geometry.FullCircleRadians = 2 * Math.PI;
|
|
432
426
|
function replaceSegments(segments, index, replacedSegments) {
|
|
433
427
|
if (replacedSegments.length > 0) {
|
|
434
428
|
segments.splice(index, 1);
|
|
@@ -103,6 +103,11 @@ class SymbolValidatorVisitor extends BaseVisitor_js_1.BaseVisitor {
|
|
|
103
103
|
this.runExpressions(newExecutor, ctx.function_expr());
|
|
104
104
|
this.executionStack.pop();
|
|
105
105
|
};
|
|
106
|
+
this.visitFor_expr = (ctx) => {
|
|
107
|
+
ctx.ID().forEach(item => {
|
|
108
|
+
this.addSymbolVariable(item.getSymbol(), item.getText(), null);
|
|
109
|
+
});
|
|
110
|
+
};
|
|
106
111
|
}
|
|
107
112
|
enterFile(filePath) {
|
|
108
113
|
this.filePathStack.push(filePath);
|
package/dist/cjs/visitor.js
CHANGED
|
@@ -22,13 +22,16 @@ class ParserVisitor extends BaseVisitor_js_1.BaseVisitor {
|
|
|
22
22
|
};
|
|
23
23
|
this.visitPin_select_expr = (ctx) => {
|
|
24
24
|
let value = null;
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
28
|
-
value =
|
|
25
|
+
const ctxData = ctx.data_expr();
|
|
26
|
+
const result = this.visitResult(ctxData);
|
|
27
|
+
if (result instanceof ParamDefinition_js_1.NumericValue) {
|
|
28
|
+
value = result.toNumber();
|
|
29
29
|
}
|
|
30
|
-
else if (
|
|
31
|
-
value =
|
|
30
|
+
else if (typeof result === 'string') {
|
|
31
|
+
value = result;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
throw new utils_js_1.RuntimeExecutionError("Invalid value for pin", ctx);
|
|
32
35
|
}
|
|
33
36
|
this.setResult(ctx, value);
|
|
34
37
|
};
|
|
@@ -882,7 +885,21 @@ class ParserVisitor extends BaseVisitor_js_1.BaseVisitor {
|
|
|
882
885
|
};
|
|
883
886
|
this.visitPoint_expr = (ctx) => {
|
|
884
887
|
const ID = ctx.ID();
|
|
885
|
-
|
|
888
|
+
const ctxData = ctx.data_expr();
|
|
889
|
+
let pointValue;
|
|
890
|
+
if (ctxData) {
|
|
891
|
+
const resultValue = this.visitResult(ctxData);
|
|
892
|
+
if (typeof resultValue === 'string') {
|
|
893
|
+
pointValue = resultValue;
|
|
894
|
+
}
|
|
895
|
+
else {
|
|
896
|
+
throw new utils_js_1.RuntimeExecutionError('Invalid value for point');
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
else if (ID) {
|
|
900
|
+
pointValue = ID.getText();
|
|
901
|
+
}
|
|
902
|
+
return this.getExecutor().addPoint(pointValue);
|
|
886
903
|
};
|
|
887
904
|
this.visitProperty_set_expr = (ctx) => {
|
|
888
905
|
const result = this.visitResult(ctx.data_expr());
|
|
@@ -102,6 +102,11 @@ export class SemanticTokensVisitor extends BaseVisitor {
|
|
|
102
102
|
visitImport_expr = (ctx) => {
|
|
103
103
|
this.addSemanticToken(ctx.ID(), [], 'namespace');
|
|
104
104
|
};
|
|
105
|
+
visitFor_expr = (ctx) => {
|
|
106
|
+
ctx.ID().forEach(item => {
|
|
107
|
+
this.addSemanticToken(item, [], 'variable');
|
|
108
|
+
});
|
|
109
|
+
};
|
|
105
110
|
addSemanticToken(node, modifiers, tokenType = null) {
|
|
106
111
|
const parsedToken = this.parseToken(node, modifiers, tokenType);
|
|
107
112
|
this.semanticTokens.set(parsedToken.line + "_" + parsedToken.column, parsedToken);
|
|
@@ -184,7 +189,7 @@ const languageKeywords = [
|
|
|
184
189
|
'break', 'branch', 'create', 'component',
|
|
185
190
|
'graphic', 'wire', 'pin', 'add', 'at', 'to',
|
|
186
191
|
'point', 'join', 'parallel', 'return', 'def', 'import',
|
|
187
|
-
'true', 'false', 'nc', 'sheet', 'frame', 'if', 'for',
|
|
192
|
+
'true', 'false', 'nc', 'sheet', 'frame', 'if', 'else', 'for', 'in',
|
|
188
193
|
];
|
|
189
194
|
const operatorKeywords = [
|
|
190
195
|
'at', 'to', 'wire', 'add', 'frame', 'join', 'parallel', 'point'
|