circuitscript 0.5.1 → 0.5.3
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 +117 -154
- package/dist/cjs/antlr/CircuitScriptParser.js +547 -523
- package/dist/cjs/builtinMethods.js +8 -0
- package/dist/cjs/execute.js +13 -71
- package/dist/cjs/objects/Frame.js +2 -0
- package/dist/cjs/pipeline.js +3 -2
- package/dist/cjs/render/render.js +17 -8
- package/dist/cjs/semantic-tokens/SemanticTokenVisitor.js +2 -0
- package/dist/cjs/validate/SymbolValidatorVisitor.js +2 -0
- package/dist/cjs/visitor.js +13 -2
- package/dist/esm/BaseVisitor.js +114 -151
- package/dist/esm/antlr/CircuitScriptParser.js +547 -523
- package/dist/esm/builtinMethods.js +8 -0
- package/dist/esm/execute.js +14 -72
- package/dist/esm/objects/Frame.js +2 -0
- package/dist/esm/pipeline.js +4 -3
- package/dist/esm/render/render.js +17 -8
- package/dist/esm/semantic-tokens/SemanticTokenVisitor.js +2 -0
- package/dist/esm/validate/SymbolValidatorVisitor.js +2 -0
- package/dist/esm/visitor.js +14 -3
- package/dist/types/BaseVisitor.d.ts +3 -3
- package/dist/types/antlr/CircuitScriptParser.d.ts +2 -0
- package/dist/types/execute.d.ts +0 -1
- package/dist/types/objects/ClassComponent.d.ts +1 -1
- package/dist/types/objects/Frame.d.ts +2 -0
- package/dist/types/objects/types.d.ts +5 -0
- package/dist/types/render/render.d.ts +2 -1
- package/dist/types/semantic-tokens/SemanticTokenVisitor.d.ts +2 -1
- package/dist/types/validate/SymbolValidatorVisitor.d.ts +2 -1
- package/package.json +1 -1
|
@@ -3,6 +3,8 @@ import { NumericValue, numeric, resolveToNumericValue } from "./objects/NumericV
|
|
|
3
3
|
import { CFunctionEntry, ImportedLibrary } from "./objects/types.js";
|
|
4
4
|
import { unwrapValue, RuntimeExecutionError } from "./utils.js";
|
|
5
5
|
import { BaseNamespace } from "./globals.js";
|
|
6
|
+
import { ClassComponent } from "./objects/ClassComponent.js";
|
|
7
|
+
import { Net } from "./objects/Net.js";
|
|
6
8
|
const builtInMethods = [
|
|
7
9
|
['enumerate', enumerate],
|
|
8
10
|
['toMils', toMils],
|
|
@@ -152,6 +154,12 @@ function toString(obj) {
|
|
|
152
154
|
else if (obj instanceof ImportedLibrary) {
|
|
153
155
|
return `[library: ${obj.libraryName}]`;
|
|
154
156
|
}
|
|
157
|
+
else if (obj instanceof ClassComponent) {
|
|
158
|
+
return `[component: ${obj.instanceName}]`;
|
|
159
|
+
}
|
|
160
|
+
else if (obj instanceof Net) {
|
|
161
|
+
return `[net: ${obj.toString()}]`;
|
|
162
|
+
}
|
|
155
163
|
else {
|
|
156
164
|
if (obj === undefined) {
|
|
157
165
|
return 'undefined';
|
package/dist/esm/execute.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Net } from './objects/Net.js';
|
|
|
6
6
|
import { NumericValue } from './objects/NumericValue.js';
|
|
7
7
|
import { numeric } from "./objects/NumericValue.js";
|
|
8
8
|
import { PinId, PortSide } from './objects/PinDefinition.js';
|
|
9
|
-
import { AnyReference, CFunctionEntry, DeclaredReference, Direction, ImportFunctionHandling, NetTypes } from './objects/types.js';
|
|
9
|
+
import { AnyReference, CFunctionEntry, DeclaredReference, Direction, ImportFunctionHandling, ImportedLibrary, NetTypes } from './objects/types.js';
|
|
10
10
|
import { Wire } from './objects/Wire.js';
|
|
11
11
|
import { Frame } from './objects/Frame.js';
|
|
12
12
|
import { CalculatePinPositions } from './render/layout.js';
|
|
@@ -165,6 +165,7 @@ export class ExecutionContext {
|
|
|
165
165
|
const defaultPin = new PinId(1);
|
|
166
166
|
this.scope.setNet(component, defaultPin, tmpNet);
|
|
167
167
|
this.log('set net', netName, 'component', component, defaultPin);
|
|
168
|
+
component.setParam('net', tmpNet);
|
|
168
169
|
}
|
|
169
170
|
this.scope.instances.set(instanceName, component);
|
|
170
171
|
const pinsOutput = pins.map((pin) => {
|
|
@@ -734,31 +735,16 @@ export class ExecutionContext {
|
|
|
734
735
|
let rootValue;
|
|
735
736
|
let useValue = item;
|
|
736
737
|
if (trailers.length > 0) {
|
|
737
|
-
rootValue =
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
useValue =
|
|
742
|
-
trailers.forEach(trailerPath => {
|
|
743
|
-
useValue = useValue[trailerPath];
|
|
744
|
-
});
|
|
745
|
-
break;
|
|
746
|
-
case ReferenceTypes.instance: {
|
|
747
|
-
const tmpComponent = rootValue;
|
|
748
|
-
if (tmpComponent.typeProp === ComponentTypes.net) {
|
|
749
|
-
const usedNet = this.scope.getNet(tmpComponent, new PinId(1));
|
|
750
|
-
if (usedNet) {
|
|
751
|
-
const trailerValue = trailers.join(".");
|
|
752
|
-
useValue = usedNet.params.get(trailerValue) ?? null;
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
else {
|
|
756
|
-
useValue = rootValue
|
|
757
|
-
.parameters.get(trailersPath);
|
|
758
|
-
}
|
|
759
|
-
break;
|
|
738
|
+
rootValue = item;
|
|
739
|
+
useValue = item;
|
|
740
|
+
for (let i = 0; i < trailers.length; i++) {
|
|
741
|
+
if (useValue instanceof ClassComponent) {
|
|
742
|
+
useValue = useValue.parameters.get(trailers[i]);
|
|
760
743
|
}
|
|
761
|
-
|
|
744
|
+
else if (useValue instanceof Net) {
|
|
745
|
+
useValue = useValue.params.get(trailers[i]);
|
|
746
|
+
}
|
|
747
|
+
else if (useValue instanceof ImportedLibrary) {
|
|
762
748
|
const funcName = trailers[0];
|
|
763
749
|
const library = rootValue;
|
|
764
750
|
const functionPath = `${library.libraryNamespace}${funcName}`;
|
|
@@ -773,7 +759,9 @@ export class ExecutionContext {
|
|
|
773
759
|
value: foundFunc,
|
|
774
760
|
});
|
|
775
761
|
}
|
|
776
|
-
|
|
762
|
+
}
|
|
763
|
+
else {
|
|
764
|
+
useValue = useValue[trailers[i]];
|
|
777
765
|
}
|
|
778
766
|
}
|
|
779
767
|
}
|
|
@@ -1021,52 +1009,6 @@ export class ExecutionContext {
|
|
|
1021
1009
|
return commands;
|
|
1022
1010
|
});
|
|
1023
1011
|
}
|
|
1024
|
-
setProperty(nameWithProp, value) {
|
|
1025
|
-
this.log('set property', nameWithProp, 'value', value);
|
|
1026
|
-
let idName;
|
|
1027
|
-
let paramName;
|
|
1028
|
-
let useActive = false;
|
|
1029
|
-
if (nameWithProp.startsWith('..')) {
|
|
1030
|
-
useActive = true;
|
|
1031
|
-
paramName = nameWithProp.substring(2);
|
|
1032
|
-
}
|
|
1033
|
-
else {
|
|
1034
|
-
const parts = nameWithProp.split(".");
|
|
1035
|
-
idName = parts[0];
|
|
1036
|
-
paramName = parts[1];
|
|
1037
|
-
}
|
|
1038
|
-
if (useActive && this.scope.currentFrameId !== -1) {
|
|
1039
|
-
this.scope.frames[this.scope.currentFrameId - 1]
|
|
1040
|
-
.parameters.set(paramName, value);
|
|
1041
|
-
}
|
|
1042
|
-
else {
|
|
1043
|
-
idName = this.scope.currentComponent.instanceName;
|
|
1044
|
-
if (this.scope.instances.has(idName)) {
|
|
1045
|
-
const component = this.scope.instances.get(idName);
|
|
1046
|
-
component.setParam(paramName, value);
|
|
1047
|
-
const unitModifiers = [
|
|
1048
|
-
ParamKeys.angle,
|
|
1049
|
-
ParamKeys.flip,
|
|
1050
|
-
ParamKeys.flipX,
|
|
1051
|
-
ParamKeys.flipY,
|
|
1052
|
-
];
|
|
1053
|
-
if (unitModifiers.indexOf(paramName) !== -1) {
|
|
1054
|
-
if (paramName === ParamKeys.flipX || paramName == ParamKeys.flipY) {
|
|
1055
|
-
if (typeof value === "boolean") {
|
|
1056
|
-
value = value ? numeric(1) : numeric(0);
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
component.getUnit().setParam(paramName, value);
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
else if (this.scope.variables.has(idName)) {
|
|
1063
|
-
throw "Not implemented yet!";
|
|
1064
|
-
}
|
|
1065
|
-
else {
|
|
1066
|
-
throw "Unknown identifier: " + idName;
|
|
1067
|
-
}
|
|
1068
|
-
}
|
|
1069
|
-
}
|
|
1070
1012
|
applyComponentAngleFromWire(component, pin, opposite = false) {
|
|
1071
1013
|
const targetUnit = component.getUnitForPin(pin);
|
|
1072
1014
|
if (this.componentAngleFollowsWire
|
|
@@ -23,6 +23,8 @@ export var FrameParamKeys;
|
|
|
23
23
|
FrameParamKeys["Height"] = "height";
|
|
24
24
|
FrameParamKeys["PaperSize"] = "paper_size";
|
|
25
25
|
FrameParamKeys["SheetType"] = "sheet_type";
|
|
26
|
+
FrameParamKeys["GridStyle"] = "grid_style";
|
|
27
|
+
FrameParamKeys["GridColor"] = "grid_color";
|
|
26
28
|
FrameParamKeys["TitleAlign"] = "title_align";
|
|
27
29
|
FrameParamKeys["HorizontalAlign"] = "align";
|
|
28
30
|
FrameParamKeys["VerticalAlign"] = "valign";
|
package/dist/esm/pipeline.js
CHANGED
|
@@ -3,7 +3,7 @@ import PDFDocument from "pdfkit";
|
|
|
3
3
|
import { RecognitionException } from "antlr4ng";
|
|
4
4
|
import { DefaultPostAnnotationCallback } from "./annotate/DefaultPostAnnotationCallback.js";
|
|
5
5
|
import { generateBom, generateBomCSV, saveBomOutputCsv } from "./BomGeneration.js";
|
|
6
|
-
import { defaultZoomScale } from "./globals.js";
|
|
6
|
+
import { defaultZoomScale, GlobalDocumentName } from "./globals.js";
|
|
7
7
|
import { NetGraph } from "./render/graph.js";
|
|
8
8
|
import { LayoutEngine } from "./render/layout.js";
|
|
9
9
|
import { Logger } from "./logger.js";
|
|
@@ -154,8 +154,9 @@ export async function renderScriptCustom(scriptData, outputPath, options, parseH
|
|
|
154
154
|
if (errors.length === 0 && throwError === undefined) {
|
|
155
155
|
const { frameComponent } = visitor.applySheetFrameComponent();
|
|
156
156
|
const { sequence, nets } = visitor.getGraph();
|
|
157
|
+
const documentVariable = visitor.getScope()
|
|
158
|
+
.variables.get(GlobalDocumentName);
|
|
157
159
|
if (enableBom && bomOutputPath) {
|
|
158
|
-
const documentVariable = visitor.getScope().variables.get('document');
|
|
159
160
|
const bomConfig = documentVariable.bom;
|
|
160
161
|
const bomData = generateBom(bomConfig, visitor.getScope().getInstances());
|
|
161
162
|
const bomCsvOutput = generateBomCSV(bomData);
|
|
@@ -213,7 +214,7 @@ export async function renderScriptCustom(scriptData, outputPath, options, parseH
|
|
|
213
214
|
const renderLogger = new Logger();
|
|
214
215
|
let svgCanvas;
|
|
215
216
|
try {
|
|
216
|
-
svgCanvas = renderSheetsToSVG(sheetFrames, renderLogger);
|
|
217
|
+
svgCanvas = renderSheetsToSVG(sheetFrames, renderLogger, documentVariable);
|
|
217
218
|
}
|
|
218
219
|
catch (err) {
|
|
219
220
|
throw new RenderError(`Error during SVG generation: ${err}`, 'svg_generation');
|
|
@@ -19,7 +19,7 @@ function createSvgCanvas() {
|
|
|
19
19
|
applyFontsToSVG(canvas);
|
|
20
20
|
return canvas;
|
|
21
21
|
}
|
|
22
|
-
export function renderSheetsToSVG(sheetFrames, logger) {
|
|
22
|
+
export function renderSheetsToSVG(sheetFrames, logger, documentVariable) {
|
|
23
23
|
const canvas = createSvgCanvas();
|
|
24
24
|
sheetFrames.forEach((sheet, index) => {
|
|
25
25
|
const sheetGroup = canvas.group();
|
|
@@ -76,7 +76,13 @@ export function renderSheetsToSVG(sheetFrames, logger) {
|
|
|
76
76
|
logger.add('sheet contents offset: ' + xOffset + ' ' + yOffset);
|
|
77
77
|
logger.add('generating svg children in sheet');
|
|
78
78
|
const sheetElements = sheetGroup.group().addClass('sheet-elements');
|
|
79
|
-
|
|
79
|
+
const gridProperties = {
|
|
80
|
+
gridBounds,
|
|
81
|
+
extendGrid,
|
|
82
|
+
style: documentVariable[FrameParamKeys.GridStyle],
|
|
83
|
+
color: documentVariable[FrameParamKeys.GridColor],
|
|
84
|
+
};
|
|
85
|
+
generateSVGChild(sheetElements, components, wires, junctions, mergedWires, allFrames, textObjects, gridProperties, logger);
|
|
80
86
|
sheetElements.translate(xOffset, yOffset);
|
|
81
87
|
sheetGroup.translate(0, sheetYOffset.toNumber());
|
|
82
88
|
});
|
|
@@ -120,14 +126,15 @@ export function generatePdfOutput(doc, canvas, sheetSize, sheetSizeDefined, zoom
|
|
|
120
126
|
}
|
|
121
127
|
});
|
|
122
128
|
}
|
|
123
|
-
function generateSVGChild(canvas, components, wires, junctions, mergedWires, frameObjects, textObjects,
|
|
129
|
+
function generateSVGChild(canvas, components, wires, junctions, mergedWires, frameObjects, textObjects, gridProperties, logger) {
|
|
124
130
|
const displayWireId = false;
|
|
125
|
-
if (gridBounds === null) {
|
|
131
|
+
if (gridProperties.gridBounds === null) {
|
|
126
132
|
logger.add('get grid bounds');
|
|
127
|
-
gridBounds = getBounds(components, wires, junctions, frameObjects);
|
|
133
|
+
gridProperties.gridBounds = getBounds(components, wires, junctions, frameObjects);
|
|
128
134
|
}
|
|
135
|
+
const { gridBounds } = gridProperties;
|
|
129
136
|
logger.add('grid bounds', gridBounds.xmin, gridBounds.ymin, gridBounds.xmax, gridBounds.ymax);
|
|
130
|
-
drawGrid(canvas.group().translate(0, 0),
|
|
137
|
+
drawGrid(canvas.group().translate(0, 0), gridProperties, logger);
|
|
131
138
|
components.forEach(item => {
|
|
132
139
|
const { x, y, width, height } = item;
|
|
133
140
|
const symbolGroup = canvas.group();
|
|
@@ -285,7 +292,8 @@ function generateSVGChild(canvas, components, wires, junctions, mergedWires, fra
|
|
|
285
292
|
.translate(-originSize / 2, -originSize / 2)
|
|
286
293
|
.stroke('none').fill('red');
|
|
287
294
|
}
|
|
288
|
-
function drawGrid(group,
|
|
295
|
+
function drawGrid(group, gridProperties, logger) {
|
|
296
|
+
const { gridBounds: canvasSize, extendGrid, style: gridStyle = "dots", color: gridColor = "#000" } = gridProperties;
|
|
289
297
|
const gridSize = defaultGridSizeUnits;
|
|
290
298
|
const { xmin, ymin, xmax, ymax } = canvasSize;
|
|
291
299
|
const extraValue = extendGrid ? 1 : 0;
|
|
@@ -303,6 +311,7 @@ function drawGrid(group, canvasSize, extendGrid, logger) {
|
|
|
303
311
|
RenderFlags.ShowGridOrigin && group.circle(originSize)
|
|
304
312
|
.translate(-originSize / 2, -originSize / 2)
|
|
305
313
|
.stroke('none').fill('blue');
|
|
314
|
+
const useGridColor = gridStyle !== "none" ? gridColor : "rgba(0,0,0,0)";
|
|
306
315
|
const lines = [];
|
|
307
316
|
const smallOffset = milsToMM(3);
|
|
308
317
|
const startY = gridStartY.sub(smallOffset.half());
|
|
@@ -320,7 +329,7 @@ function drawGrid(group, canvasSize, extendGrid, logger) {
|
|
|
320
329
|
})
|
|
321
330
|
.stroke({
|
|
322
331
|
width: strokeSize.toNumber(),
|
|
323
|
-
color:
|
|
332
|
+
color: useGridColor
|
|
324
333
|
});
|
|
325
334
|
}
|
|
326
335
|
function drawSheetFrameBorder(frameGroup, frame) {
|
|
@@ -127,6 +127,8 @@ export class SemanticTokensVisitor extends BaseVisitor {
|
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
};
|
|
130
|
+
visitTrailer = (ctx) => {
|
|
131
|
+
};
|
|
130
132
|
addSemanticToken(node, modifiers, tokenType = null) {
|
|
131
133
|
const parsedToken = this.parseToken(node, modifiers, tokenType);
|
|
132
134
|
this.semanticTokens.set(`${parsedToken.line}_${parsedToken.column}_${parsedToken.length}`, parsedToken);
|
package/dist/esm/visitor.js
CHANGED
|
@@ -4,7 +4,7 @@ import { ParamDefinition } from "./objects/ParamDefinition.js";
|
|
|
4
4
|
import { numeric } from "./objects/NumericValue.js";
|
|
5
5
|
import { PinDefinition, PinId, PinIdType } from './objects/PinDefinition.js';
|
|
6
6
|
import { PinTypes } from './objects/PinTypes.js';
|
|
7
|
-
import { DeclaredReference, UndeclaredReference } from './objects/types.js';
|
|
7
|
+
import { AnyReference, DeclaredReference, UndeclaredReference } from './objects/types.js';
|
|
8
8
|
import { ComponentTypes, Delimiter1, FrameType, GlobalDocumentName, ModuleContainsKeyword, NoNetText, ParamKeys, RefdesFileSuffix, ReferenceTypes, SymbolPinSide, ValidPinSides, WireAutoDirection } from './globals.js';
|
|
9
9
|
import { BlockTypes } from "./objects/BlockTypes.js";
|
|
10
10
|
import { unwrapValue } from "./utils.js";
|
|
@@ -1048,8 +1048,19 @@ export class ParserVisitor extends BaseVisitor {
|
|
|
1048
1048
|
};
|
|
1049
1049
|
visitDouble_dot_property_set_expr = (ctx) => {
|
|
1050
1050
|
const result = this.visitResult(ctx.data_expr());
|
|
1051
|
-
const
|
|
1052
|
-
|
|
1051
|
+
const scope = this.getScope();
|
|
1052
|
+
const useObject = scope.currentFrameId !== -1 ?
|
|
1053
|
+
scope.frames[scope.currentFrameId - 1] : scope.currentComponent;
|
|
1054
|
+
const lastReference = new AnyReference({
|
|
1055
|
+
found: true,
|
|
1056
|
+
value: useObject,
|
|
1057
|
+
type: ReferenceTypes.instance,
|
|
1058
|
+
trailerIndex: 0,
|
|
1059
|
+
});
|
|
1060
|
+
const firstId = ctx.ID().getText();
|
|
1061
|
+
const referenceWithFirstID = this.getExecutor().resolveTrailers(null, lastReference.value, [firstId]);
|
|
1062
|
+
const useReference = this.resolveTrailersForReference(referenceWithFirstID, null, ctx);
|
|
1063
|
+
this.assignValueToReference([], useReference, ctx, result);
|
|
1053
1064
|
};
|
|
1054
1065
|
visitExpressions_block = (ctx) => {
|
|
1055
1066
|
this.runExpressions(this.getExecutor(), ctx.expression());
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrayExprContext, Assignment_exprContext, Callable_exprContext, CallableExprContext, ExpressionContext, Flow_expressionsContext, Function_args_exprContext, Function_exprContext, Function_return_exprContext, Import_exprContext, Import_simpleContext, Import_specific_or_allContext, Keyword_assignment_exprContext, ParametersContext, RoundedBracketsExprContext, ScriptContext, TrailerContext, Value_exprContext, ValueExprContext } from "./antlr/CircuitScriptParser.js";
|
|
1
|
+
import { ArrayExprContext, Assignment_exprContext, Callable_exprContext, CallableExprContext, Double_dot_property_set_exprContext, ExpressionContext, Flow_expressionsContext, Function_args_exprContext, Function_exprContext, Function_return_exprContext, Import_exprContext, Import_simpleContext, Import_specific_or_allContext, Keyword_assignment_exprContext, ParametersContext, RoundedBracketsExprContext, ScriptContext, TrailerContext, Value_exprContext, ValueExprContext } from "./antlr/CircuitScriptParser.js";
|
|
2
2
|
import { CircuitScriptParserVisitor } from "./antlr/CircuitScriptParserVisitor.js";
|
|
3
3
|
import { ExecutionContext } from "./execute.js";
|
|
4
4
|
import { Logger } from "./logger.js";
|
|
@@ -52,11 +52,11 @@ export declare class BaseVisitor extends CircuitScriptParserVisitor<ComplexType
|
|
|
52
52
|
visitImport_specific_or_all: (ctx: Import_specific_or_allContext) => void;
|
|
53
53
|
visitCallableExpr: (ctx: CallableExprContext) => void;
|
|
54
54
|
visitCallable_expr: (ctx: Callable_exprContext) => void;
|
|
55
|
+
protected resolveTrailersForReference(reference: AnyReference, passedNetNamespace: string | null, ctx: Callable_exprContext | Double_dot_property_set_exprContext): AnyReference;
|
|
55
56
|
visitTrailer: (ctx: TrailerContext) => void;
|
|
56
57
|
visitAssignment_expr: (ctx: Assignment_exprContext) => void;
|
|
58
|
+
protected assignValueToReference(sequenceParts: (string | any)[], leftSideReference: AnyReference, lhsCtx: ParserRuleContext, rhsValue: any): void;
|
|
57
59
|
private getReference;
|
|
58
|
-
visitTrailer_expr2: (ctx: Trailer_expr2Context) => void;
|
|
59
|
-
visitAtom_expr: (ctx: Atom_exprContext) => void;
|
|
60
60
|
private handleFunctionCall;
|
|
61
61
|
protected handleEnterContext(executor: ExecutionContext, executionStack: ExecutionContext[], contextName: string, ctx: ParserRuleContext, options: NewContextOptions, funcDefinedParameters: FunctionDefinedParameter[], passedInParameters: CallableParameter[], isBreakContext?: boolean): ExecutionContext;
|
|
62
62
|
protected handlePopContext(executor: ExecutionContext, executionStack: ExecutionContext[], namespaceExtension: string, isBreakContext?: boolean): ExecutionContext;
|
|
@@ -407,6 +407,8 @@ export declare class Double_dot_property_set_exprContext extends antlr.ParserRul
|
|
|
407
407
|
ID(): antlr.TerminalNode;
|
|
408
408
|
Assign(): antlr.TerminalNode;
|
|
409
409
|
data_expr(): Data_exprContext;
|
|
410
|
+
trailer(): TrailerContext[];
|
|
411
|
+
trailer(i: number): TrailerContext | null;
|
|
410
412
|
get ruleIndex(): number;
|
|
411
413
|
accept<Result>(visitor: CircuitScriptParserVisitor<Result>): Result | null;
|
|
412
414
|
}
|
package/dist/types/execute.d.ts
CHANGED
|
@@ -95,7 +95,6 @@ export declare class ExecutionContext {
|
|
|
95
95
|
addWire(segments: [string, (number | UnitDimension)?][]): Wire;
|
|
96
96
|
addPoint(pointId: string, userDefined?: boolean): ComponentPin;
|
|
97
97
|
private getPointSymbol;
|
|
98
|
-
setProperty(nameWithProp: string, value: any): void;
|
|
99
98
|
applyComponentAngleFromWire(component: ClassComponent, pin: number, opposite?: boolean): void;
|
|
100
99
|
enterFrame(frameType: FrameType): number;
|
|
101
100
|
exitFrame(frameId: number): void;
|
|
@@ -61,7 +61,7 @@ export declare class ClassComponent {
|
|
|
61
61
|
hasPin(pinId: PinId): boolean;
|
|
62
62
|
getPin(pinId: PinId): PinId;
|
|
63
63
|
getNextPinAfter(pinIndex: PinId): PinId;
|
|
64
|
-
setParam(key: string, value: number | string | NumericValue): void;
|
|
64
|
+
setParam(key: string, value: number | string | NumericValue | Net): void;
|
|
65
65
|
hasParam(key: string): boolean;
|
|
66
66
|
private refreshParamCache;
|
|
67
67
|
private refreshPinsCache;
|
|
@@ -18,6 +18,8 @@ export declare enum FrameParamKeys {
|
|
|
18
18
|
Height = "height",
|
|
19
19
|
PaperSize = "paper_size",
|
|
20
20
|
SheetType = "sheet_type",
|
|
21
|
+
GridStyle = "grid_style",
|
|
22
|
+
GridColor = "grid_color",
|
|
21
23
|
TitleAlign = "title_align",
|
|
22
24
|
HorizontalAlign = "align",
|
|
23
25
|
VerticalAlign = "valign",
|
|
@@ -10,6 +10,8 @@ import { ScriptContext } from 'src/antlr/CircuitScriptParser.js';
|
|
|
10
10
|
import { SymbolDrawingCommands } from 'src/render/draw_symbols.js';
|
|
11
11
|
import { RefdesModification } from 'src/annotate/utils.js';
|
|
12
12
|
import { SerializedExpression } from 'src/cache/types.js';
|
|
13
|
+
import { BomConfig } from 'src/BomGeneration.js';
|
|
14
|
+
import { FrameParamKeys } from './Frame.js';
|
|
13
15
|
export type CFunction = (args: CallableParameter[], options?: CFunctionOptions) => CFunctionResult;
|
|
14
16
|
export declare class CFunctionEntry {
|
|
15
17
|
name: string;
|
|
@@ -155,3 +157,6 @@ export type ComponentUnitDefinition = {
|
|
|
155
157
|
arrange: any | null;
|
|
156
158
|
suffix: string | null;
|
|
157
159
|
};
|
|
160
|
+
export type DocumentVariable = {
|
|
161
|
+
bom: BomConfig;
|
|
162
|
+
} & Partial<Record<FrameParamKeys, ValueType | ClassComponent>>;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { Svg } from '@svgdotjs/svg.js';
|
|
3
3
|
import { SheetFrame } from "./layout.js";
|
|
4
4
|
import { Logger } from '../logger.js';
|
|
5
|
-
|
|
5
|
+
import { DocumentVariable } from 'src/objects/types.js';
|
|
6
|
+
export declare function renderSheetsToSVG(sheetFrames: SheetFrame[], logger: Logger, documentVariable: DocumentVariable): Svg;
|
|
6
7
|
export declare function generateSvgOutput(canvas: Svg, zoomScale?: number): string;
|
|
7
8
|
export declare function generatePdfOutput(doc: PDFKit.PDFDocument, canvas: Svg, sheetSize: string, sheetSizeDefined: boolean, zoomScale?: number): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TerminalNode, Token } from "antlr4ng";
|
|
2
2
|
import { CircuitScriptLexer } from "../antlr/CircuitScriptLexer.js";
|
|
3
|
-
import { Function_def_exprContext, Create_component_exprContext, Create_graphic_exprContext, Callable_exprContext, Property_key_exprContext, Assignment_exprContext, Function_args_exprContext, GraphicCommandExprContext, For_exprContext, Annotation_comment_exprContext, ScriptContext, CreateExprContext, Import_simpleContext, Import_specific_or_allContext } from "../antlr/CircuitScriptParser.js";
|
|
3
|
+
import { Function_def_exprContext, Create_component_exprContext, Create_graphic_exprContext, Callable_exprContext, Property_key_exprContext, Assignment_exprContext, Function_args_exprContext, GraphicCommandExprContext, For_exprContext, Annotation_comment_exprContext, ScriptContext, CreateExprContext, Import_simpleContext, Import_specific_or_allContext, TrailerContext } from "../antlr/CircuitScriptParser.js";
|
|
4
4
|
import { BaseVisitor, OnErrorHandler } from "../BaseVisitor.js";
|
|
5
5
|
import { NodeScriptEnvironment } from "../environment/environment.js";
|
|
6
6
|
export declare class SemanticTokensVisitor extends BaseVisitor {
|
|
@@ -23,6 +23,7 @@ export declare class SemanticTokensVisitor extends BaseVisitor {
|
|
|
23
23
|
visitImport_specific_or_all: (ctx: Import_specific_or_allContext) => void;
|
|
24
24
|
visitFor_expr: (ctx: For_exprContext) => void;
|
|
25
25
|
visitAnnotation_comment_expr: (ctx: Annotation_comment_exprContext) => void;
|
|
26
|
+
visitTrailer: (ctx: TrailerContext) => void;
|
|
26
27
|
addSemanticToken(node: TerminalNode, modifiers: string[], tokenType?: string | null): void;
|
|
27
28
|
parseToken(node: TerminalNode, modifiers: string[], tokenType?: string | null): IParsedToken;
|
|
28
29
|
dumpTokens(): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TerminalNode, Token } from "antlr4ng";
|
|
2
|
-
import { Assignment_exprContext, CallableExprContext, UnaryOperatorExprContext, MultiplyExprContext, AdditionExprContext, BinaryOperatorExprContext, Function_def_exprContext, For_exprContext, Import_simpleContext, Import_specific_or_allContext, Create_graphic_exprContext } from "../antlr/CircuitScriptParser.js";
|
|
2
|
+
import { Assignment_exprContext, CallableExprContext, UnaryOperatorExprContext, MultiplyExprContext, AdditionExprContext, BinaryOperatorExprContext, Function_def_exprContext, For_exprContext, Import_simpleContext, Import_specific_or_allContext, Create_graphic_exprContext, TrailerContext } from "../antlr/CircuitScriptParser.js";
|
|
3
3
|
import { ExecutionContext } from "../execute.js";
|
|
4
4
|
import { ComplexType, FunctionDefinedParameter } from "../objects/types.js";
|
|
5
5
|
import { SymbolTableItem } from "./SymbolTable.js";
|
|
@@ -28,6 +28,7 @@ export declare class SymbolValidatorVisitor extends BaseVisitor {
|
|
|
28
28
|
visitFunction_def_expr: (ctx: Function_def_exprContext) => void;
|
|
29
29
|
visitFor_expr: (ctx: For_exprContext) => void;
|
|
30
30
|
visitCreate_graphic_expr: (ctx: Create_graphic_exprContext) => void;
|
|
31
|
+
visitTrailer: (ctx: TrailerContext) => void;
|
|
31
32
|
getSymbols(): SymbolTable;
|
|
32
33
|
dumpSymbols(): void;
|
|
33
34
|
}
|