circuitscript 0.3.1 → 0.4.0
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 +394 -262
- package/dist/cjs/LexerDiagnosticListener.js +375 -0
- package/dist/cjs/{ComponentAnnotater.js → annotate/ComponentAnnotater.js} +29 -15
- package/dist/cjs/annotate/DefaultPostAnnotationCallback.js +126 -0
- package/dist/cjs/{RefdesAnnotationVisitor.js → annotate/RefdesAnnotationVisitor.js} +10 -84
- package/dist/cjs/annotate/utils.js +70 -0
- package/dist/cjs/antlr/CircuitScriptLexer.js +279 -286
- package/dist/cjs/antlr/CircuitScriptParser.js +1954 -3535
- package/dist/cjs/antlr/CircuitScriptParserVisitor.js +7 -0
- package/dist/cjs/cache/deserializer.js +34 -0
- package/dist/cjs/cache/hash.js +8 -0
- package/dist/cjs/cache/serializer.js +122 -0
- package/dist/cjs/cache/storage.js +45 -0
- package/dist/cjs/cache/types.js +4 -0
- package/dist/cjs/{environment.js → environment/environment.js} +18 -6
- package/dist/cjs/environment/esm-environment.js +21 -0
- package/dist/cjs/environment/helpers.js +8 -0
- package/dist/cjs/execute.js +49 -15
- package/dist/cjs/globals.js +9 -1
- package/dist/cjs/helpers.js +3 -467
- package/dist/cjs/importResolver.js +102 -0
- package/dist/cjs/index.js +7 -6
- package/dist/cjs/lexer.js +48 -12
- package/dist/cjs/main.js +14 -4
- package/dist/cjs/objects/ClassComponent.js +1 -1
- package/dist/cjs/objects/ExecutionScope.js +0 -1
- package/dist/cjs/objects/types.js +17 -1
- package/dist/cjs/parser.js +18 -4
- package/dist/cjs/pipeline.js +284 -0
- package/dist/cjs/regenerate-tests.js +4 -3
- package/dist/cjs/render/KiCadNetListOutputHandler.js +30 -0
- package/dist/cjs/render/PaperSizes.js +46 -0
- package/dist/cjs/{draw_symbols.js → render/draw_symbols.js} +58 -36
- package/dist/cjs/{export.js → render/export.js} +2 -2
- package/dist/cjs/{geometry.js → render/geometry.js} +5 -5
- package/dist/cjs/{graph.js → render/graph.js} +7 -7
- package/dist/cjs/{layout.js → render/layout.js} +8 -8
- package/dist/cjs/{render.js → render/render.js} +9 -8
- package/dist/cjs/rules-check/no-connect-on-connected-pin.js +1 -1
- package/dist/cjs/rules-check/unconnected-pins.js +1 -1
- package/dist/cjs/{SemanticTokenVisitor.js → semantic-tokens/SemanticTokenVisitor.js} +12 -14
- package/dist/cjs/semantic-tokens/getSemanticTokens.js +55 -0
- package/dist/cjs/sizing.js +2 -2
- package/dist/cjs/utils.js +2 -2
- package/dist/cjs/validate/SymbolValidatorResolveVisitor.js +6 -0
- package/dist/cjs/validate/SymbolValidatorVisitor.js +34 -39
- package/dist/cjs/validate/validateScript.js +54 -0
- package/dist/cjs/validate.js +5 -4
- package/dist/cjs/visitor.js +158 -212
- package/dist/esm/BaseVisitor.js +396 -264
- package/dist/esm/LexerDiagnosticListener.js +371 -0
- package/dist/esm/{ComponentAnnotater.js → annotate/ComponentAnnotater.js} +29 -15
- package/dist/esm/annotate/DefaultPostAnnotationCallback.js +122 -0
- package/dist/esm/{RefdesAnnotationVisitor.js → annotate/RefdesAnnotationVisitor.js} +10 -84
- package/dist/esm/annotate/utils.js +66 -0
- package/dist/esm/antlr/CircuitScriptLexer.js +279 -286
- package/dist/esm/antlr/CircuitScriptParser.js +1962 -3522
- package/dist/esm/antlr/{CircuitScriptVisitor.js → CircuitScriptParserVisitor.js} +14 -35
- package/dist/esm/cache/deserializer.js +30 -0
- package/dist/esm/cache/hash.js +4 -0
- package/dist/esm/cache/serializer.js +118 -0
- package/dist/esm/cache/storage.js +39 -0
- package/dist/esm/cache/types.js +1 -0
- package/dist/esm/{environment.js → environment/environment.js} +18 -6
- package/dist/esm/environment/esm-environment.js +17 -0
- package/dist/esm/environment/helpers.js +4 -0
- package/dist/esm/execute.js +49 -15
- package/dist/esm/globals.js +8 -0
- package/dist/esm/helpers.js +5 -456
- package/dist/esm/importResolver.js +96 -0
- package/dist/esm/index.js +7 -6
- package/dist/esm/lexer.js +51 -12
- package/dist/esm/main.js +13 -3
- package/dist/esm/objects/ClassComponent.js +1 -1
- package/dist/esm/objects/ExecutionScope.js +0 -1
- package/dist/esm/objects/types.js +21 -1
- package/dist/esm/parser.js +19 -5
- package/dist/esm/pipeline.js +276 -0
- package/dist/esm/regenerate-tests.js +3 -2
- package/dist/esm/render/KiCadNetListOutputHandler.js +20 -0
- package/dist/esm/render/PaperSizes.js +41 -0
- package/dist/esm/{draw_symbols.js → render/draw_symbols.js} +58 -36
- package/dist/esm/{export.js → render/export.js} +2 -2
- package/dist/esm/{geometry.js → render/geometry.js} +5 -5
- package/dist/esm/{graph.js → render/graph.js} +7 -7
- package/dist/esm/{layout.js → render/layout.js} +8 -8
- package/dist/esm/{render.js → render/render.js} +8 -7
- package/dist/esm/rules-check/no-connect-on-connected-pin.js +1 -1
- package/dist/esm/rules-check/unconnected-pins.js +1 -1
- package/dist/esm/{SemanticTokenVisitor.js → semantic-tokens/SemanticTokenVisitor.js} +12 -14
- package/dist/esm/semantic-tokens/getSemanticTokens.js +51 -0
- package/dist/esm/sizing.js +2 -2
- package/dist/esm/utils.js +2 -2
- package/dist/esm/validate/SymbolValidatorResolveVisitor.js +3 -0
- package/dist/esm/validate/SymbolValidatorVisitor.js +36 -41
- package/dist/esm/validate/validateScript.js +50 -0
- package/dist/esm/validate.js +4 -3
- package/dist/esm/visitor.js +160 -214
- package/dist/libs/std.cst +15 -19
- package/dist/types/BaseVisitor.d.ts +25 -18
- package/dist/types/BomGeneration.d.ts +1 -1
- package/dist/types/LexerDiagnosticListener.d.ts +85 -0
- package/dist/types/{ComponentAnnotater.d.ts → annotate/ComponentAnnotater.d.ts} +1 -1
- package/dist/types/annotate/DefaultPostAnnotationCallback.d.ts +7 -0
- package/dist/types/{RefdesAnnotationVisitor.d.ts → annotate/RefdesAnnotationVisitor.d.ts} +7 -9
- package/dist/types/annotate/utils.d.ts +6 -0
- package/dist/types/antlr/CircuitScriptLexer.d.ts +71 -70
- package/dist/types/antlr/CircuitScriptParser.d.ts +357 -515
- package/dist/types/antlr/{CircuitScriptVisitor.d.ts → CircuitScriptParserVisitor.d.ts} +27 -69
- package/dist/types/cache/deserializer.d.ts +5 -0
- package/dist/types/cache/hash.d.ts +1 -0
- package/dist/types/cache/serializer.d.ts +3 -0
- package/dist/types/cache/storage.d.ts +4 -0
- package/dist/types/cache/types.d.ts +20 -0
- package/dist/types/{environment.d.ts → environment/environment.d.ts} +5 -4
- package/dist/types/environment/esm-environment.d.ts +4 -0
- package/dist/types/environment/helpers.d.ts +2 -0
- package/dist/types/execute.d.ts +3 -2
- package/dist/types/globals.d.ts +1 -0
- package/dist/types/helpers.d.ts +31 -36
- package/dist/types/importResolver.d.ts +4 -0
- package/dist/types/index.d.ts +7 -6
- package/dist/types/lexer.d.ts +9 -5
- package/dist/types/objects/ClassComponent.d.ts +1 -1
- package/dist/types/objects/ExecutionScope.d.ts +1 -4
- package/dist/types/objects/types.d.ts +16 -2
- package/dist/types/parser.d.ts +9 -2
- package/dist/types/pipeline.d.ts +9 -0
- package/dist/types/render/KiCadNetListOutputHandler.d.ts +10 -0
- package/dist/types/render/PaperSizes.d.ts +12 -0
- package/dist/types/{draw_symbols.d.ts → render/draw_symbols.d.ts} +4 -4
- package/dist/types/{export.d.ts → render/export.d.ts} +1 -1
- package/dist/types/{geometry.d.ts → render/geometry.d.ts} +2 -2
- package/dist/types/{graph.d.ts → render/graph.d.ts} +6 -6
- package/dist/types/{layout.d.ts → render/layout.d.ts} +10 -10
- package/dist/types/{render.d.ts → render/render.d.ts} +1 -1
- package/dist/types/{SemanticTokenVisitor.d.ts → semantic-tokens/SemanticTokenVisitor.d.ts} +6 -6
- package/dist/types/semantic-tokens/getSemanticTokens.d.ts +6 -0
- package/dist/types/sizing.d.ts +1 -1
- package/dist/types/utils.d.ts +1 -1
- package/dist/types/validate/SymbolValidatorResolveVisitor.d.ts +3 -0
- package/dist/types/validate/SymbolValidatorVisitor.d.ts +8 -8
- package/dist/types/validate/validateScript.d.ts +3 -0
- package/dist/types/visitor.d.ts +8 -14
- package/libs/std.cst +15 -19
- package/package.json +3 -6
- package/dist/cjs/antlr/CircuitScriptVisitor.js +0 -7
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SymbolDrawingCommands = exports.SymbolDrawing = exports.SymbolCustomModule = exports.SymbolCustom = exports.PlaceHolderCommands = exports.SymbolPlaceholder = exports.SymbolText = exports.SymbolGraphic = void 0;
|
|
4
|
-
const helpers_js_1 = require("
|
|
5
|
-
const globals_js_1 = require("
|
|
4
|
+
const helpers_js_1 = require("../helpers.js");
|
|
5
|
+
const globals_js_1 = require("../globals.js");
|
|
6
6
|
const geometry_js_1 = require("./geometry.js");
|
|
7
|
-
const PinTypes_js_1 = require("
|
|
8
|
-
const utils_js_1 = require("
|
|
9
|
-
const types_js_1 = require("
|
|
10
|
-
const ParamDefinition_js_1 = require("
|
|
11
|
-
const PinDefinition_js_1 = require("
|
|
7
|
+
const PinTypes_js_1 = require("../objects/PinTypes.js");
|
|
8
|
+
const utils_js_1 = require("../utils.js");
|
|
9
|
+
const types_js_1 = require("../objects/types.js");
|
|
10
|
+
const ParamDefinition_js_1 = require("../objects/ParamDefinition.js");
|
|
11
|
+
const PinDefinition_js_1 = require("../objects/PinDefinition.js");
|
|
12
12
|
class SymbolGraphic {
|
|
13
13
|
constructor() {
|
|
14
14
|
this.drawPortsName = true;
|
|
@@ -138,18 +138,19 @@ class SymbolGraphic {
|
|
|
138
138
|
for (const label of labels) {
|
|
139
139
|
const tmpLabel = label;
|
|
140
140
|
const { fontSize = (0, ParamDefinition_js_1.numeric)(50), anchor = geometry_js_1.HorizontalAlign.Left, vanchor = geometry_js_1.VerticalAlign.Bottom, fontWeight = 'regular', angle: tmpLabelAngle = (0, ParamDefinition_js_1.numeric)(0), textColor = "#333", } = tmpLabel.style ?? {};
|
|
141
|
-
const labelAngle = tmpLabelAngle.toNumber();
|
|
142
141
|
let anchorStyle = 'start';
|
|
143
142
|
let dominantBaseline = 'auto';
|
|
144
143
|
let useAnchor = anchor;
|
|
145
144
|
let useDominantBaseline = vanchor;
|
|
146
|
-
const
|
|
145
|
+
const labelAngle = tmpLabelAngle.toNumber();
|
|
146
|
+
const finalLabelAngle = labelAngle + this.angle;
|
|
147
|
+
const isRotation180 = Math.abs(finalLabelAngle) === 180;
|
|
147
148
|
if (isRotation180) {
|
|
148
149
|
useAnchor = this.flipTextAnchor(anchor);
|
|
149
150
|
useDominantBaseline = this.flipDominantBaseline(vanchor);
|
|
150
151
|
}
|
|
151
|
-
const isHorizontalLabel =
|
|
152
|
-
const isVerticalLabel =
|
|
152
|
+
const isHorizontalLabel = finalLabelAngle === 0 || finalLabelAngle === 180;
|
|
153
|
+
const isVerticalLabel = finalLabelAngle === 90 || finalLabelAngle === -90;
|
|
153
154
|
if (useAnchor === geometry_js_1.HorizontalAlign.Middle) {
|
|
154
155
|
anchorStyle = geometry_js_1.HorizontalAlignProp.Middle;
|
|
155
156
|
}
|
|
@@ -189,16 +190,9 @@ class SymbolGraphic {
|
|
|
189
190
|
const textContainer = group.group();
|
|
190
191
|
let translateX, translateY;
|
|
191
192
|
let useRotateAngle = 0;
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
useRotateAngle = 0;
|
|
196
|
-
}
|
|
197
|
-
else {
|
|
198
|
-
translateX = position[0];
|
|
199
|
-
translateY = position[1];
|
|
200
|
-
useRotateAngle = this.angle;
|
|
201
|
-
}
|
|
193
|
+
translateX = position[0];
|
|
194
|
+
translateY = position[1];
|
|
195
|
+
useRotateAngle = this.angle;
|
|
202
196
|
translateX = (0, utils_js_1.roundValue)(translateX);
|
|
203
197
|
translateY = (0, utils_js_1.roundValue)(translateY);
|
|
204
198
|
const { portType = null } = tmpLabel.style;
|
|
@@ -293,6 +287,10 @@ class SymbolGraphic {
|
|
|
293
287
|
}
|
|
294
288
|
textContainer.translate(translateX.toNumber(), translateY.toNumber())
|
|
295
289
|
.rotate(useRotateAngle, -translateX.toNumber(), -translateY.toNumber());
|
|
290
|
+
let useLabelAngle = labelAngle;
|
|
291
|
+
if (isRotation180) {
|
|
292
|
+
useLabelAngle = (labelAngle + 180) % 360;
|
|
293
|
+
}
|
|
296
294
|
textContainer.text(tmpLabel.text)
|
|
297
295
|
.fill(textColor)
|
|
298
296
|
.font({
|
|
@@ -303,7 +301,7 @@ class SymbolGraphic {
|
|
|
303
301
|
weight: fontWeight,
|
|
304
302
|
})
|
|
305
303
|
.attr("xml:space", "preserve")
|
|
306
|
-
.rotate(
|
|
304
|
+
.rotate(useLabelAngle, 0, 0);
|
|
307
305
|
const { a, b, c, d, e, f } = textContainer.matrix();
|
|
308
306
|
const newMatrix = {
|
|
309
307
|
a: (0, utils_js_1.roundValue)((0, ParamDefinition_js_1.numeric)(a)).toNumber(),
|
|
@@ -515,16 +513,21 @@ class SymbolPlaceholder extends SymbolGraphic {
|
|
|
515
513
|
drawPinParams(drawing, commandName, keywordParams, positionParams, lineColor, pinNameColor) {
|
|
516
514
|
drawing.log('add pin', ...positionParams);
|
|
517
515
|
positionParams = [...positionParams];
|
|
518
|
-
const keywordDisplayPinId = '
|
|
516
|
+
const keywordDisplayPinId = 'display_id';
|
|
517
|
+
const keywordDisplayPinName = 'display_name';
|
|
519
518
|
let displayPinId = true;
|
|
519
|
+
let displayPinName = true;
|
|
520
520
|
if (keywordParams.has(keywordDisplayPinId)) {
|
|
521
521
|
const value = keywordParams.get(keywordDisplayPinId);
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
522
|
+
displayPinId = ((value instanceof ParamDefinition_js_1.NumericValue && value.toNumber() === 0)
|
|
523
|
+
|| (value === 0)
|
|
524
|
+
|| (value === false)) ? false : true;
|
|
525
|
+
}
|
|
526
|
+
if (keywordParams.has(keywordDisplayPinName)) {
|
|
527
|
+
const value = keywordParams.get(keywordDisplayPinName);
|
|
528
|
+
displayPinName = ((value instanceof ParamDefinition_js_1.NumericValue && value.toNumber() === 0)
|
|
529
|
+
|| (value === 0)
|
|
530
|
+
|| (value === false)) ? false : true;
|
|
528
531
|
}
|
|
529
532
|
let pinNameParam = null;
|
|
530
533
|
let pinType = PinTypes_js_1.PinTypes.Any;
|
|
@@ -532,6 +535,10 @@ class SymbolPlaceholder extends SymbolGraphic {
|
|
|
532
535
|
pinType = positionParams[1].value;
|
|
533
536
|
positionParams = [positionParams[0], ...positionParams.slice(2)];
|
|
534
537
|
}
|
|
538
|
+
else if (typeof positionParams[1] === 'string' && globals_js_1.PinTypesList.indexOf(positionParams[1]) !== -1) {
|
|
539
|
+
pinType = positionParams[1];
|
|
540
|
+
positionParams = [positionParams[0], ...positionParams.slice(2)];
|
|
541
|
+
}
|
|
535
542
|
if (typeof positionParams[1] === 'string') {
|
|
536
543
|
pinNameParam = positionParams[1];
|
|
537
544
|
positionParams = [positionParams[0], ...positionParams.slice(2)];
|
|
@@ -581,12 +588,14 @@ class SymbolPlaceholder extends SymbolGraphic {
|
|
|
581
588
|
let pinNameAlignment = geometry_js_1.HorizontalAlign.Left;
|
|
582
589
|
const offset1 = 15;
|
|
583
590
|
const offset2 = 15;
|
|
584
|
-
let pinNameOffsetX = (0, helpers_js_1.milsToMM)(
|
|
591
|
+
let pinNameOffsetX = (0, helpers_js_1.milsToMM)(0);
|
|
592
|
+
let pinNameOffsetY = (0, helpers_js_1.milsToMM)(0);
|
|
585
593
|
let pinIdOffsetX = (0, ParamDefinition_js_1.numeric)(0);
|
|
586
594
|
let pinIdAlignment = geometry_js_1.HorizontalAlign.Left;
|
|
587
595
|
let pinIdVAlignment = geometry_js_1.VerticalAlign.Bottom;
|
|
588
596
|
let pinIdOffsetY = (0, helpers_js_1.milsToMM)(-offset2);
|
|
589
597
|
const angleValue = angle.toNumber();
|
|
598
|
+
let usePinIdAngle = 0;
|
|
590
599
|
switch (angleValue) {
|
|
591
600
|
case 0:
|
|
592
601
|
pinNameAlignment = geometry_js_1.HorizontalAlign.Left;
|
|
@@ -595,6 +604,15 @@ class SymbolPlaceholder extends SymbolGraphic {
|
|
|
595
604
|
pinIdOffsetX = (0, helpers_js_1.milsToMM)(-offset2);
|
|
596
605
|
break;
|
|
597
606
|
case 90:
|
|
607
|
+
pinNameAlignment = geometry_js_1.HorizontalAlign.Right;
|
|
608
|
+
pinNameOffsetX = (0, helpers_js_1.milsToMM)(0);
|
|
609
|
+
pinNameOffsetY = (0, helpers_js_1.milsToMM)(offset1);
|
|
610
|
+
pinIdAlignment = geometry_js_1.HorizontalAlign.Left;
|
|
611
|
+
pinIdOffsetX = (0, helpers_js_1.milsToMM)(-offset2);
|
|
612
|
+
pinIdOffsetY = (0, helpers_js_1.milsToMM)(-offset2);
|
|
613
|
+
pinIdVAlignment = geometry_js_1.VerticalAlign.Bottom;
|
|
614
|
+
usePinIdAngle = -90;
|
|
615
|
+
break;
|
|
598
616
|
case 180:
|
|
599
617
|
pinNameAlignment = geometry_js_1.HorizontalAlign.Right;
|
|
600
618
|
pinNameOffsetX = (0, helpers_js_1.milsToMM)(-offset1);
|
|
@@ -603,27 +621,31 @@ class SymbolPlaceholder extends SymbolGraphic {
|
|
|
603
621
|
break;
|
|
604
622
|
case 270:
|
|
605
623
|
pinNameAlignment = geometry_js_1.HorizontalAlign.Left;
|
|
606
|
-
pinNameOffsetX = (0, helpers_js_1.milsToMM)(
|
|
607
|
-
|
|
608
|
-
|
|
624
|
+
pinNameOffsetX = (0, helpers_js_1.milsToMM)(0);
|
|
625
|
+
pinNameOffsetY = (0, helpers_js_1.milsToMM)(-offset1);
|
|
626
|
+
pinIdAlignment = geometry_js_1.HorizontalAlign.Right;
|
|
627
|
+
pinIdOffsetX = (0, helpers_js_1.milsToMM)(-offset2);
|
|
609
628
|
pinIdOffsetY = (0, helpers_js_1.milsToMM)(offset2);
|
|
610
|
-
pinIdVAlignment = geometry_js_1.VerticalAlign.
|
|
629
|
+
pinIdVAlignment = geometry_js_1.VerticalAlign.Bottom;
|
|
630
|
+
usePinIdAngle = -90;
|
|
611
631
|
break;
|
|
612
632
|
}
|
|
613
633
|
if (angleValue === 0 || angleValue === 90 || angleValue === 180 || angleValue === 270) {
|
|
614
634
|
const usePinName = pinNameParam ?? "";
|
|
615
|
-
usePinName !== "" && drawing.addLabel(endX.add(pinNameOffsetX), endY, usePinName, {
|
|
635
|
+
displayPinName && usePinName !== "" && drawing.addLabel(endX.add(pinNameOffsetX), endY.add(pinNameOffsetY), usePinName, {
|
|
616
636
|
fontSize: (0, ParamDefinition_js_1.numeric)(globals_js_1.defaultPinNameTextSize),
|
|
617
637
|
anchor: pinNameAlignment,
|
|
618
638
|
vanchor: geometry_js_1.VerticalAlign.Middle,
|
|
619
639
|
textColor: pinNameColor,
|
|
640
|
+
angle: (0, ParamDefinition_js_1.numeric)(usePinIdAngle)
|
|
620
641
|
});
|
|
621
642
|
const pinDisplayText = pinId.toString();
|
|
622
643
|
displayPinId && drawing.addLabel(endX.add(pinIdOffsetX), endY.add(pinIdOffsetY), pinDisplayText, {
|
|
623
644
|
fontSize: (0, ParamDefinition_js_1.numeric)(globals_js_1.defaultPinIdTextSize),
|
|
624
645
|
anchor: pinIdAlignment,
|
|
625
646
|
vanchor: pinIdVAlignment,
|
|
626
|
-
textColor: lineColor
|
|
647
|
+
textColor: lineColor,
|
|
648
|
+
angle: (0, ParamDefinition_js_1.numeric)(usePinIdAngle)
|
|
627
649
|
});
|
|
628
650
|
}
|
|
629
651
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SExpObject = exports._id = exports.IdObject = exports.printTree = exports.generateKiCadNetList = void 0;
|
|
4
|
-
const globals_js_1 = require("
|
|
5
|
-
const ParamDefinition_js_1 = require("
|
|
4
|
+
const globals_js_1 = require("../globals.js");
|
|
5
|
+
const ParamDefinition_js_1 = require("../objects/ParamDefinition.js");
|
|
6
6
|
function generateKiCadNetList(netlist) {
|
|
7
7
|
const componentsList = [];
|
|
8
8
|
const nets = {};
|
|
@@ -5,11 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.VerticalAlignProp = exports.HorizontalAlignProp = exports.VerticalAlign = exports.HorizontalAlign = exports.Geometry = exports.GeometryProp = exports.Textbox = void 0;
|
|
7
7
|
const core_1 = __importDefault(require("@flatten-js/core"));
|
|
8
|
-
const sizing_js_1 = require("
|
|
9
|
-
const globals_js_1 = require("
|
|
10
|
-
const ParamDefinition_js_1 = require("
|
|
11
|
-
const PinTypes_js_1 = require("
|
|
12
|
-
const utils_js_1 = require("
|
|
8
|
+
const sizing_js_1 = require("../sizing.js");
|
|
9
|
+
const globals_js_1 = require("../globals.js");
|
|
10
|
+
const ParamDefinition_js_1 = require("../objects/ParamDefinition.js");
|
|
11
|
+
const PinTypes_js_1 = require("../objects/PinTypes.js");
|
|
12
|
+
const utils_js_1 = require("../utils.js");
|
|
13
13
|
class Textbox extends core_1.default.Polygon {
|
|
14
14
|
get box() {
|
|
15
15
|
return this.polygon.box;
|
|
@@ -26,15 +26,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.RenderItemType = exports.generateLayoutPinDefinition = exports.getWireName = exports.NetGraph = void 0;
|
|
27
27
|
const graphlib_1 = require("@dagrejs/graphlib");
|
|
28
28
|
const draw_symbols_js_1 = require("./draw_symbols.js");
|
|
29
|
-
const globals_js_1 = require("
|
|
30
|
-
const helpers_js_1 = require("
|
|
29
|
+
const globals_js_1 = require("../globals.js");
|
|
30
|
+
const helpers_js_1 = require("../helpers.js");
|
|
31
31
|
const layout_js_1 = require("./layout.js");
|
|
32
|
-
const ExecutionScope_js_1 = require("
|
|
33
|
-
const Frame_js_1 = require("
|
|
34
|
-
const ParamDefinition_js_1 = require("
|
|
35
|
-
const types_js_1 = require("
|
|
32
|
+
const ExecutionScope_js_1 = require("../objects/ExecutionScope.js");
|
|
33
|
+
const Frame_js_1 = require("../objects/Frame.js");
|
|
34
|
+
const ParamDefinition_js_1 = require("../objects/ParamDefinition.js");
|
|
35
|
+
const types_js_1 = require("../objects/types.js");
|
|
36
36
|
const ml_matrix_1 = __importStar(require("ml-matrix"));
|
|
37
|
-
const PinDefinition_js_1 = require("
|
|
37
|
+
const PinDefinition_js_1 = require("../objects/PinDefinition.js");
|
|
38
38
|
class NetGraph {
|
|
39
39
|
constructor(logger) {
|
|
40
40
|
this.logger = logger;
|
|
@@ -7,14 +7,14 @@ exports.ExtractDrawingRects = exports.CalculatePinPositions = exports.RenderJunc
|
|
|
7
7
|
const graphlib_1 = __importDefault(require("@dagrejs/graphlib"));
|
|
8
8
|
const { alg } = graphlib_1.default;
|
|
9
9
|
const draw_symbols_js_1 = require("./draw_symbols.js");
|
|
10
|
-
const globals_js_1 = require("
|
|
10
|
+
const globals_js_1 = require("../globals.js");
|
|
11
11
|
const geometry_js_1 = require("./geometry.js");
|
|
12
|
-
const Frame_js_1 = require("
|
|
13
|
-
const utils_js_1 = require("
|
|
14
|
-
const types_js_1 = require("
|
|
15
|
-
const PinDefinition_js_1 = require("
|
|
16
|
-
const helpers_js_1 = require("
|
|
17
|
-
const ParamDefinition_js_1 = require("
|
|
12
|
+
const Frame_js_1 = require("../objects/Frame.js");
|
|
13
|
+
const utils_js_1 = require("../utils.js");
|
|
14
|
+
const types_js_1 = require("../objects/types.js");
|
|
15
|
+
const PinDefinition_js_1 = require("../objects/PinDefinition.js");
|
|
16
|
+
const helpers_js_1 = require("../helpers.js");
|
|
17
|
+
const ParamDefinition_js_1 = require("../objects/ParamDefinition.js");
|
|
18
18
|
const graph_js_1 = require("./graph.js");
|
|
19
19
|
class LayoutEngine {
|
|
20
20
|
constructor(logger, options = { showBaseFrame: false }) {
|
|
@@ -1310,7 +1310,7 @@ function CalculatePinPositions(unit) {
|
|
|
1310
1310
|
}
|
|
1311
1311
|
applyComponentParamsToSymbol(unit, tmpSymbol);
|
|
1312
1312
|
tmpSymbol.refreshDrawing();
|
|
1313
|
-
const pins = unit
|
|
1313
|
+
const { pins } = unit;
|
|
1314
1314
|
pins.forEach((value, key) => {
|
|
1315
1315
|
if (unit._unplacedPins.indexOf(key) === -1) {
|
|
1316
1316
|
pinPositionMapping.set(key, tmpSymbol.pinPosition(key));
|
|
@@ -6,14 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.generatePdfOutput = exports.generateSvgOutput = exports.renderSheetsToSVG = void 0;
|
|
7
7
|
const svg_js_1 = require("@svgdotjs/svg.js");
|
|
8
8
|
const layout_js_1 = require("./layout.js");
|
|
9
|
-
const sizing_js_1 = require("
|
|
10
|
-
const globals_js_1 = require("
|
|
11
|
-
const ParamDefinition_js_1 = require("
|
|
12
|
-
const utils_js_1 = require("
|
|
13
|
-
const helpers_js_1 = require("
|
|
14
|
-
const
|
|
9
|
+
const sizing_js_1 = require("../sizing.js");
|
|
10
|
+
const globals_js_1 = require("../globals.js");
|
|
11
|
+
const ParamDefinition_js_1 = require("../objects/ParamDefinition.js");
|
|
12
|
+
const utils_js_1 = require("../utils.js");
|
|
13
|
+
const helpers_js_1 = require("../helpers.js");
|
|
14
|
+
const PaperSizes_js_1 = require("./PaperSizes.js");
|
|
15
|
+
const environment_js_1 = require("../environment/environment.js");
|
|
15
16
|
const svg_to_pdfkit_1 = __importDefault(require("svg-to-pdfkit"));
|
|
16
|
-
const Frame_js_1 = require("
|
|
17
|
+
const Frame_js_1 = require("../objects/Frame.js");
|
|
17
18
|
const draw_symbols_js_1 = require("./draw_symbols.js");
|
|
18
19
|
function createSvgCanvas() {
|
|
19
20
|
const env = environment_js_1.NodeScriptEnvironment.getInstance();
|
|
@@ -102,7 +103,7 @@ function generatePdfOutput(doc, canvas, sheetSize, sheetSizeDefined, zoomScale =
|
|
|
102
103
|
const children = canvas.children();
|
|
103
104
|
const numChildren = children.length;
|
|
104
105
|
const scale = globals_js_1.MMToPx * zoomScale;
|
|
105
|
-
const { originalWidthMM, originalHeightMM } = (0,
|
|
106
|
+
const { originalWidthMM, originalHeightMM } = (0, PaperSizes_js_1.getPaperSize)(sheetSize);
|
|
106
107
|
children.forEach((child, index) => {
|
|
107
108
|
const sheetCanvas = createSvgCanvas();
|
|
108
109
|
sheetCanvas.add(child);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RuleCheck_NoConnectOnConnectedPin = void 0;
|
|
4
|
-
const graph_js_1 = require("../graph.js");
|
|
4
|
+
const graph_js_1 = require("../render/graph.js");
|
|
5
5
|
const rules_js_1 = require("./rules.js");
|
|
6
6
|
function RuleCheck_NoConnectOnConnectedPin(graph, nets) {
|
|
7
7
|
const allNodes = graph.nodes();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RuleCheck_UnconnectedPinsWires = void 0;
|
|
4
|
-
const graph_js_1 = require("../graph.js");
|
|
4
|
+
const graph_js_1 = require("../render/graph.js");
|
|
5
5
|
const rules_js_1 = require("./rules.js");
|
|
6
6
|
function RuleCheck_UnconnectedPinsWires(graph) {
|
|
7
7
|
const items = [];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.prepareTokens = exports.SemanticTokensVisitor = void 0;
|
|
4
|
-
const CircuitScriptParser_js_1 = require("
|
|
5
|
-
const BaseVisitor_js_1 = require("
|
|
6
|
-
const builtinMethods_js_1 = require("
|
|
7
|
-
const globals_js_1 = require("
|
|
4
|
+
const CircuitScriptParser_js_1 = require("../antlr/CircuitScriptParser.js");
|
|
5
|
+
const BaseVisitor_js_1 = require("../BaseVisitor.js");
|
|
6
|
+
const builtinMethods_js_1 = require("../builtinMethods.js");
|
|
7
|
+
const globals_js_1 = require("../globals.js");
|
|
8
8
|
class SemanticTokensVisitor extends BaseVisitor_js_1.BaseVisitor {
|
|
9
9
|
constructor(silent = false, onErrorHandler = null, environment, lexer, script) {
|
|
10
10
|
super(silent, onErrorHandler, environment);
|
|
@@ -45,14 +45,16 @@ class SemanticTokensVisitor extends BaseVisitor_js_1.BaseVisitor {
|
|
|
45
45
|
this.runExpressions(newExecutor, ctx.function_expr());
|
|
46
46
|
this.executionStack.pop();
|
|
47
47
|
};
|
|
48
|
-
this.
|
|
48
|
+
this.visitCreateExpr = (ctx) => {
|
|
49
49
|
this.addSemanticToken(ctx.Create(), ['defaultLibrary'], 'function');
|
|
50
|
+
this.visit(ctx.create_expr());
|
|
51
|
+
};
|
|
52
|
+
this.visitCreate_component_expr = (ctx) => {
|
|
50
53
|
ctx.property_expr().forEach(property_expr => {
|
|
51
54
|
this.visit(property_expr);
|
|
52
55
|
});
|
|
53
56
|
};
|
|
54
57
|
this.visitCreate_graphic_expr = (ctx) => {
|
|
55
|
-
this.addSemanticToken(ctx.Create(), ['defaultLibrary'], 'function');
|
|
56
58
|
const graphicsExpressionsCtx = ctx.graphic_expressions_block();
|
|
57
59
|
this.visitResult(graphicsExpressionsCtx);
|
|
58
60
|
};
|
|
@@ -99,18 +101,14 @@ class SemanticTokensVisitor extends BaseVisitor_js_1.BaseVisitor {
|
|
|
99
101
|
}
|
|
100
102
|
};
|
|
101
103
|
this.visitAssignment_expr = (ctx) => {
|
|
102
|
-
this.visit(ctx.
|
|
104
|
+
this.visit(ctx.callable_expr());
|
|
103
105
|
this.visit(ctx.data_expr());
|
|
104
106
|
};
|
|
105
|
-
this.
|
|
106
|
-
if (ctx.parent instanceof CircuitScriptParser_js_1.Assignment_exprContext && ctx.ID(
|
|
107
|
-
this.addSemanticToken(ctx.ID(
|
|
107
|
+
this.visitCallable_expr = (ctx) => {
|
|
108
|
+
if (ctx.parent instanceof CircuitScriptParser_js_1.Assignment_exprContext && ctx.ID()) {
|
|
109
|
+
this.addSemanticToken(ctx.ID(), [], 'variable');
|
|
108
110
|
}
|
|
109
111
|
};
|
|
110
|
-
this.visitOperator_assignment_expr = (ctx) => {
|
|
111
|
-
this.visit(ctx.atom_expr());
|
|
112
|
-
this.visit(ctx.data_expr());
|
|
113
|
-
};
|
|
114
112
|
this.visitImport_expr = (ctx) => {
|
|
115
113
|
this.addSemanticToken(ctx.ID(), [], 'namespace');
|
|
116
114
|
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSemanticTokens = void 0;
|
|
4
|
+
const helpers_js_1 = require("../helpers.js");
|
|
5
|
+
const SemanticTokenVisitor_js_1 = require("./SemanticTokenVisitor.js");
|
|
6
|
+
const utils_js_1 = require("../utils.js");
|
|
7
|
+
async function getSemanticTokens(filePath, scriptData, options) {
|
|
8
|
+
const { parser, lexer, tokens } = (0, helpers_js_1.prepareFile)(scriptData);
|
|
9
|
+
const tree = parser.script();
|
|
10
|
+
const visitor = new SemanticTokenVisitor_js_1.SemanticTokensVisitor(true, null, options.environment, lexer, scriptData);
|
|
11
|
+
parser.removeErrorListeners();
|
|
12
|
+
visitor.onImportFile = async (visitor, filePath, textData) => {
|
|
13
|
+
let hasError = false;
|
|
14
|
+
let hasParseError = false;
|
|
15
|
+
if (textData !== null) {
|
|
16
|
+
const { parser } = (0, helpers_js_1.prepareFile)(textData);
|
|
17
|
+
const tree = parser.script();
|
|
18
|
+
try {
|
|
19
|
+
visitor.visit(tree);
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
console.log('Error while parsing: ', err);
|
|
23
|
+
hasParseError = true;
|
|
24
|
+
hasError = true;
|
|
25
|
+
throw new utils_js_1.ParseError(`Error parsing semantic tokens in imported file: ${err}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
console.log('File does not exist');
|
|
30
|
+
hasError = true;
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
hasError, hasParseError
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
await visitor.resolveImportsAndLoad(filePath, scriptData);
|
|
37
|
+
visitor.visit(tree);
|
|
38
|
+
const semanticTokens = visitor.getTokens();
|
|
39
|
+
const parsedTokens = (0, SemanticTokenVisitor_js_1.prepareTokens)(tokens.getTokens(), lexer, scriptData);
|
|
40
|
+
const finalParsedTokens = [];
|
|
41
|
+
parsedTokens.forEach(token => {
|
|
42
|
+
const location = `${token.line}_${token.column}_${token.length}`;
|
|
43
|
+
if (semanticTokens.has(location)) {
|
|
44
|
+
finalParsedTokens.push(semanticTokens.get(location));
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
finalParsedTokens.push(token);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
visitor,
|
|
52
|
+
parsedTokens: finalParsedTokens
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
exports.getSemanticTokens = getSemanticTokens;
|
package/dist/cjs/sizing.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.measureTextSize2 = exports.applyFontsToSVG = void 0;
|
|
4
4
|
const big_js_1 = require("big.js");
|
|
5
|
-
const geometry_js_1 = require("./geometry.js");
|
|
5
|
+
const geometry_js_1 = require("./render/geometry.js");
|
|
6
6
|
const globals_js_1 = require("./globals.js");
|
|
7
|
-
const environment_js_1 = require("./environment.js");
|
|
7
|
+
const environment_js_1 = require("./environment/environment.js");
|
|
8
8
|
function applyFontsToSVG(canvas) {
|
|
9
9
|
}
|
|
10
10
|
exports.applyFontsToSVG = applyFontsToSVG;
|
package/dist/cjs/utils.js
CHANGED
|
@@ -10,10 +10,10 @@ const globals_js_1 = require("./globals.js");
|
|
|
10
10
|
const types_js_1 = require("./objects/types.js");
|
|
11
11
|
class SimpleStopwatch {
|
|
12
12
|
constructor() {
|
|
13
|
-
this.startTime =
|
|
13
|
+
this.startTime = performance.now();
|
|
14
14
|
}
|
|
15
15
|
lap() {
|
|
16
|
-
return
|
|
16
|
+
return performance.now() - this.startTime;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
exports.SimpleStopwatch = SimpleStopwatch;
|
|
@@ -3,6 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SymbolValidatorResolveVisitor = void 0;
|
|
4
4
|
const SymbolValidatorVisitor_js_1 = require("./SymbolValidatorVisitor.js");
|
|
5
5
|
class SymbolValidatorResolveVisitor extends SymbolValidatorVisitor_js_1.SymbolValidatorVisitor {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.enableCacheImports = false;
|
|
9
|
+
this.enableCachedImportsRead = false;
|
|
10
|
+
this.enableCachedImportsWrite = false;
|
|
11
|
+
}
|
|
6
12
|
addSymbolVariable(token, name, value) {
|
|
7
13
|
}
|
|
8
14
|
addSymbolFunction(token, functionName, funcDefinedParameters) {
|
|
@@ -11,21 +11,25 @@ const globals_js_1 = require("../globals.js");
|
|
|
11
11
|
class SymbolValidatorVisitor extends BaseVisitor_js_1.BaseVisitor {
|
|
12
12
|
constructor() {
|
|
13
13
|
super(...arguments);
|
|
14
|
+
this.enableCacheImports = false;
|
|
15
|
+
this.enableCachedImportsRead = false;
|
|
16
|
+
this.enableCachedImportsWrite = false;
|
|
14
17
|
this.symbolTable = new SymbolTable_js_2.SymbolTable();
|
|
15
|
-
this.visitImport_simple =
|
|
16
|
-
|
|
18
|
+
this.visitImport_simple = (ctx) => {
|
|
19
|
+
this.importCommon(ctx, types_js_1.ImportFunctionHandling.AllWithNamespace);
|
|
17
20
|
};
|
|
18
|
-
this.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
this.visitImport_specific_or_all = (ctx) => {
|
|
22
|
+
let importType = types_js_1.ImportFunctionHandling.SpecificMergeIntoNamespace;
|
|
23
|
+
if (ctx._all) {
|
|
24
|
+
importType = types_js_1.ImportFunctionHandling.AllMergeIntoNamespace;
|
|
25
|
+
}
|
|
26
|
+
this.importCommon(ctx, importType);
|
|
23
27
|
};
|
|
24
28
|
this.visitAssignment_expr = (ctx) => {
|
|
25
29
|
const ctxDataExpr = ctx.data_expr();
|
|
26
30
|
this.visit(ctxDataExpr);
|
|
27
31
|
const value = this.getResult(ctxDataExpr);
|
|
28
|
-
const atomId = ctx.
|
|
32
|
+
const atomId = ctx.callable_expr().ID();
|
|
29
33
|
const atomText = atomId.getText();
|
|
30
34
|
const executor = this.getExecutor();
|
|
31
35
|
if (!this.symbolTable.exists(executor, atomText)) {
|
|
@@ -37,37 +41,25 @@ class SymbolValidatorVisitor extends BaseVisitor_js_1.BaseVisitor {
|
|
|
37
41
|
}
|
|
38
42
|
return null;
|
|
39
43
|
};
|
|
40
|
-
this.
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
this.visitCallableExpr = (ctx) => {
|
|
45
|
+
const innerCtx = ctx.callable_expr();
|
|
46
|
+
const innerCtxID = innerCtx.ID();
|
|
47
|
+
if (globals_js_1.PinTypesList.indexOf(innerCtxID.getText()) !== -1 && innerCtx.trailer().length === 0) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
const tmpSymbol = this.handleAtomSymbol(innerCtxID);
|
|
52
|
+
innerCtx.trailer().forEach(trailer => {
|
|
53
|
+
if (trailer.LParen() && trailer.RParen()) {
|
|
54
|
+
const params = trailer.parameters();
|
|
50
55
|
if (params) {
|
|
51
56
|
this.visit(params);
|
|
52
57
|
}
|
|
53
58
|
}
|
|
54
59
|
});
|
|
60
|
+
this.setResult(ctx, tmpSymbol);
|
|
55
61
|
}
|
|
56
62
|
};
|
|
57
|
-
this.visitValueAtomExpr = (ctx) => {
|
|
58
|
-
let value = null;
|
|
59
|
-
const ctxValueExpr = ctx.value_expr();
|
|
60
|
-
const cxtAtomExpr = ctx.atom_expr();
|
|
61
|
-
if (ctxValueExpr) {
|
|
62
|
-
this.visit(ctxValueExpr);
|
|
63
|
-
value = this.getResult(ctxValueExpr);
|
|
64
|
-
}
|
|
65
|
-
else if (cxtAtomExpr) {
|
|
66
|
-
this.visit(cxtAtomExpr);
|
|
67
|
-
value = this.getResult(cxtAtomExpr);
|
|
68
|
-
}
|
|
69
|
-
this.setResult(ctx, value);
|
|
70
|
-
};
|
|
71
63
|
this.visitUnaryOperatorExpr = (ctx) => {
|
|
72
64
|
this.visit(ctx.data_expr());
|
|
73
65
|
};
|
|
@@ -83,9 +75,6 @@ class SymbolValidatorVisitor extends BaseVisitor_js_1.BaseVisitor {
|
|
|
83
75
|
this.visit(ctx.data_expr(0));
|
|
84
76
|
this.visit(ctx.data_expr(1));
|
|
85
77
|
};
|
|
86
|
-
this.visitDataExpr = (ctx) => {
|
|
87
|
-
return;
|
|
88
|
-
};
|
|
89
78
|
this.visitFunction_def_expr = (ctx) => {
|
|
90
79
|
const functionName = ctx.ID().getText();
|
|
91
80
|
let funcDefinedParameters = [];
|
|
@@ -111,6 +100,12 @@ class SymbolValidatorVisitor extends BaseVisitor_js_1.BaseVisitor {
|
|
|
111
100
|
this.addSymbolVariable(item.getSymbol(), item.getText(), null);
|
|
112
101
|
});
|
|
113
102
|
};
|
|
103
|
+
this.visitCreate_graphic_expr = (ctx) => {
|
|
104
|
+
const ctxID = ctx.ID();
|
|
105
|
+
if (ctxID) {
|
|
106
|
+
this.addSymbolVariable(ctxID.getSymbol(), ctxID.getText(), null);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
114
109
|
}
|
|
115
110
|
addSymbolVariable(token, name, value, executor = null) {
|
|
116
111
|
const useExecutor = executor === null ? this.getExecutor() : executor;
|
|
@@ -159,16 +154,16 @@ class SymbolValidatorVisitor extends BaseVisitor_js_1.BaseVisitor {
|
|
|
159
154
|
setSymbols(symbolTable) {
|
|
160
155
|
this.symbolTable = symbolTable;
|
|
161
156
|
}
|
|
162
|
-
|
|
157
|
+
importCommon(ctx, handling) {
|
|
163
158
|
const specifiedImports = [];
|
|
164
|
-
if (ctx instanceof CircuitScriptParser_js_1.
|
|
159
|
+
if (ctx instanceof CircuitScriptParser_js_1.Import_specific_or_allContext) {
|
|
165
160
|
const tmpImports = ctx._funcNames.map(item => {
|
|
166
161
|
return item.text;
|
|
167
162
|
});
|
|
168
163
|
specifiedImports.push(...tmpImports);
|
|
169
164
|
}
|
|
170
|
-
const id = ctx._libraryName.text;
|
|
171
|
-
const { pathExists, importedLibrary } =
|
|
165
|
+
const id = ctx._libraryName.text.slice(1, -1);
|
|
166
|
+
const { pathExists, importedLibrary } = this.handleImportFile(id, handling, true, ctx, specifiedImports);
|
|
172
167
|
if (!pathExists) {
|
|
173
168
|
this.symbolTable.addUndefined(this.getCurrentFile(), this.getExecutor(), id, ctx._libraryName);
|
|
174
169
|
}
|