circuitscript 0.0.32 → 0.0.35

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.
Files changed (51) hide show
  1. package/dist/cjs/BaseVisitor.js +187 -39
  2. package/dist/cjs/antlr/CircuitScriptLexer.js +226 -185
  3. package/dist/cjs/antlr/CircuitScriptParser.js +1439 -902
  4. package/dist/cjs/draw_symbols.js +1 -0
  5. package/dist/cjs/execute.js +14 -12
  6. package/dist/cjs/globals.js +14 -2
  7. package/dist/cjs/helpers.js +62 -19
  8. package/dist/cjs/layout.js +88 -36
  9. package/dist/cjs/objects/ClassComponent.js +3 -0
  10. package/dist/cjs/objects/ExecutionScope.js +1 -0
  11. package/dist/cjs/objects/Frame.js +4 -1
  12. package/dist/cjs/objects/ParamDefinition.js +1 -7
  13. package/dist/cjs/objects/types.js +6 -0
  14. package/dist/cjs/regenerate-tests.js +2 -1
  15. package/dist/cjs/render.js +238 -42
  16. package/dist/cjs/visitor.js +162 -27
  17. package/dist/esm/BaseVisitor.mjs +189 -41
  18. package/dist/esm/antlr/CircuitScriptLexer.mjs +226 -185
  19. package/dist/esm/antlr/CircuitScriptParser.mjs +1428 -899
  20. package/dist/esm/antlr/CircuitScriptVisitor.mjs +9 -2
  21. package/dist/esm/draw_symbols.mjs +1 -0
  22. package/dist/esm/execute.mjs +14 -12
  23. package/dist/esm/globals.mjs +13 -1
  24. package/dist/esm/helpers.mjs +61 -20
  25. package/dist/esm/layout.mjs +88 -37
  26. package/dist/esm/objects/ClassComponent.mjs +3 -0
  27. package/dist/esm/objects/ExecutionScope.mjs +1 -0
  28. package/dist/esm/objects/Frame.mjs +5 -1
  29. package/dist/esm/objects/ParamDefinition.mjs +0 -6
  30. package/dist/esm/objects/types.mjs +6 -0
  31. package/dist/esm/regenerate-tests.mjs +2 -1
  32. package/dist/esm/render.mjs +234 -43
  33. package/dist/esm/visitor.mjs +164 -29
  34. package/dist/types/BaseVisitor.d.ts +8 -2
  35. package/dist/types/antlr/CircuitScriptLexer.d.ts +41 -30
  36. package/dist/types/antlr/CircuitScriptParser.d.ts +169 -81
  37. package/dist/types/antlr/CircuitScriptVisitor.d.ts +18 -4
  38. package/dist/types/draw_symbols.d.ts +2 -1
  39. package/dist/types/execute.d.ts +6 -3
  40. package/dist/types/globals.d.ts +11 -0
  41. package/dist/types/helpers.d.ts +12 -0
  42. package/dist/types/layout.d.ts +17 -9
  43. package/dist/types/objects/ClassComponent.d.ts +2 -1
  44. package/dist/types/objects/ExecutionScope.d.ts +2 -0
  45. package/dist/types/objects/Frame.d.ts +6 -2
  46. package/dist/types/objects/ParamDefinition.d.ts +0 -4
  47. package/dist/types/objects/types.d.ts +4 -2
  48. package/dist/types/render.d.ts +6 -14
  49. package/dist/types/visitor.d.ts +10 -2
  50. package/libs/lib.cst +283 -0
  51. package/package.json +1 -1
@@ -24,11 +24,14 @@ export class CircuitScriptVisitor extends AbstractParseTreeVisitor {
24
24
  visitAt_block_pin_expression_simple;
25
25
  visitAt_block_pin_expression_complex;
26
26
  visitBreak_keyword;
27
+ visitContinue_keyword;
27
28
  visitAssignment_expr;
29
+ visitOperator_assignment_expr;
28
30
  visitKeyword_assignment_expr;
29
31
  visitParameters;
30
32
  visitProperty_set_expr;
31
33
  visitDouble_dot_property_set_expr;
34
+ visitArrayExpr;
32
35
  visitFunctionCallExpr;
33
36
  visitAdditionExpr;
34
37
  visitMultiplyExpr;
@@ -51,22 +54,26 @@ export class CircuitScriptVisitor extends AbstractParseTreeVisitor {
51
54
  visitFunction_return_expr;
52
55
  visitProperty_block_expr;
53
56
  visitCreate_component_expr;
57
+ visitGraphic_expressions_block;
54
58
  visitCreate_graphic_expr;
55
59
  visitCreate_module_expr;
56
60
  visitNested_properties_inner;
57
- visitGraphic_expr;
61
+ visitGraphicCommandExpr;
62
+ visitGraphicForExpr;
58
63
  visitProperty_expr;
59
64
  visitProperty_key_expr;
60
65
  visitNested_properties;
61
66
  visitSingle_line_property;
62
- visitBlank_expr;
63
67
  visitWire_expr_direction_value;
64
68
  visitWire_expr_direction_only;
65
69
  visitWire_expr;
70
+ visitArray_expr;
66
71
  visitPoint_expr;
67
72
  visitImport_expr;
68
73
  visitFrame_expr;
69
74
  visitIf_expr;
70
75
  visitIf_inner_expr;
71
76
  visitElse_expr;
77
+ visitWhile_expr;
78
+ visitFor_expr;
72
79
  }
@@ -599,6 +599,7 @@ export var PlaceHolderCommands;
599
599
  PlaceHolderCommands["textColor"] = "textColor";
600
600
  PlaceHolderCommands["text"] = "text";
601
601
  PlaceHolderCommands["units"] = "units";
602
+ PlaceHolderCommands["for"] = "for";
602
603
  })(PlaceHolderCommands || (PlaceHolderCommands = {}));
603
604
  export class SymbolCustom extends SymbolGraphic {
604
605
  pinDefinition = [];
@@ -443,12 +443,16 @@ export class ExecutionContext {
443
443
  this.log('did not find block point');
444
444
  return null;
445
445
  }
446
- breakBranch() {
447
- this.log('break branch');
448
- const branchesInfo = this.scope.blockStack.get(this.scope.indentLevel - 1);
449
- const branchIndex = branchesInfo['block_index'];
450
- const branchIndexRef = branchesInfo['inner_blocks'].get(branchIndex);
451
- branchIndexRef['ignore_last_net'] = true;
446
+ addBreakContext(ctx) {
447
+ this.log('add break context');
448
+ this.scope.breakStack.push(ctx);
449
+ }
450
+ popBreakContext() {
451
+ this.log('pop break context');
452
+ return this.scope.breakStack.pop();
453
+ }
454
+ getBreakContext() {
455
+ return this.scope.breakStack[this.scope.breakStack.length - 1];
452
456
  }
453
457
  createFunction(functionName, __runFunc) {
454
458
  this.scope.functions.set(functionName, __runFunc);
@@ -780,9 +784,9 @@ export class ExecutionContext {
780
784
  }
781
785
  }
782
786
  }
783
- enterFrame() {
787
+ enterFrame(frameType) {
784
788
  const frameId = this.scope.frames.length + 1;
785
- const frameObject = new Frame(frameId);
789
+ const frameObject = new Frame(frameId, frameType);
786
790
  this.log('Enter frame', frameId);
787
791
  this.scope.frames.push(frameObject);
788
792
  this.scope.sequence.push([SequenceAction.Frame,
@@ -846,10 +850,8 @@ export function getPortSide(pins, arrangeProps) {
846
850
  }
847
851
  let position = 0;
848
852
  useItems.forEach(item => {
849
- if (typeof item === 'object') {
850
- if (item.blank) {
851
- position += item.blank;
852
- }
853
+ if (typeof item === 'object' && Array.isArray(item)) {
854
+ position += item[0];
853
855
  }
854
856
  if (existingPinIds.indexOf(item) !== -1) {
855
857
  result.push({
@@ -47,6 +47,8 @@ export const defaultSymbolLineWidth = MilsToMM * 6;
47
47
  export const defaultWireLineWidth = MilsToMM * 6;
48
48
  export const defaultPinNameTextSize = 40;
49
49
  export const defaultPinIdTextSize = 30;
50
+ export const defaultPageMarginMM = 10;
51
+ export const defaultPageSpacingMM = 10;
50
52
  export const CustomSymbolPinTextSize = defaultPinNameTextSize;
51
53
  export const CustomSymbolPinIdSize = defaultPinIdTextSize;
52
54
  export const CustomSymbolRefDesSize = 50;
@@ -62,7 +64,7 @@ export const PortPaddingHorizontal = MilsToMM * 10;
62
64
  export const PortPaddingVertical = MilsToMM * 10;
63
65
  export const ColorScheme = {
64
66
  BodyColor: 'rgb(255, 255, 194)',
65
- JunctionColor: 'rgba(0, 132, 0)',
67
+ JunctionColor: 'rgb(0, 132, 0)',
66
68
  WireColor: 'rgb(0, 132, 0)',
67
69
  PinLineColor: '#333',
68
70
  PinNameColor: '#333',
@@ -89,3 +91,13 @@ export var BlockTypes;
89
91
  BlockTypes[BlockTypes["Parallel"] = 3] = "Parallel";
90
92
  BlockTypes[BlockTypes["Point"] = 4] = "Point";
91
93
  })(BlockTypes || (BlockTypes = {}));
94
+ export var FrameType;
95
+ (function (FrameType) {
96
+ FrameType[FrameType["Frame"] = 1] = "Frame";
97
+ FrameType[FrameType["Sheet"] = 2] = "Sheet";
98
+ })(FrameType || (FrameType = {}));
99
+ export const GlobalDocumentName = 'document';
100
+ export const RenderFlags = {
101
+ ShowElementFrames: false,
102
+ ShowOrigin: false,
103
+ };
@@ -1,11 +1,11 @@
1
1
  import { readFileSync, writeFileSync, createWriteStream } from "fs";
2
+ import path from "path";
2
3
  import PDFDocument from "pdfkit";
3
- import SVGtoPDF from "svg-to-pdfkit";
4
4
  import { generateKiCADNetList, printTree } from "./export.mjs";
5
5
  import { LayoutEngine } from "./layout.mjs";
6
6
  import { SequenceAction } from "./objects/ExecutionScope.mjs";
7
7
  import { parseFileWithVisitor } from "./parser.mjs";
8
- import { generateSVG2 } from "./render.mjs";
8
+ import { generatePdfOutput, generateSvgOutput, renderSheetsToSVG } from "./render.mjs";
9
9
  import { SimpleStopwatch } from "./utils.mjs";
10
10
  import { ParserVisitor, VisitorExecutionException } from "./visitor.mjs";
11
11
  import { createContext } from "this-file";
@@ -14,8 +14,8 @@ import { BaseErrorListener, CharStream, CommonTokenStream, DefaultErrorStrategy
14
14
  import { MainLexer } from "./lexer.mjs";
15
15
  import { CircuitScriptParser } from "./antlr/CircuitScriptParser.mjs";
16
16
  import { prepareTokens, SemanticTokensVisitor } from "./SemanticTokenVisitor.mjs";
17
- import path from "path";
18
- import { LengthUnit, MilsToMM, MMToPt, PxToMM } from "./globals.mjs";
17
+ import { defaultPageMarginMM, defaultZoomScale, LengthUnit, MilsToMM, PxToMM } from "./globals.mjs";
18
+ import { FrameParamKeys } from "./objects/Frame.mjs";
19
19
  export var JSModuleType;
20
20
  (function (JSModuleType) {
21
21
  JSModuleType["CommonJs"] = "cjs";
@@ -176,6 +176,7 @@ export function renderScript(scriptData, outputPath, options) {
176
176
  console.log('Error while parsing');
177
177
  return null;
178
178
  }
179
+ const { frameComponent } = visitor.applySheetFrameComponent();
179
180
  try {
180
181
  visitor.annotateComponents();
181
182
  }
@@ -208,43 +209,43 @@ export function renderScript(scriptData, outputPath, options) {
208
209
  return tmp.join(" | ");
209
210
  });
210
211
  dumpData && writeFileSync('dump/raw-sequence.txt', tmpSequence.join('\n'));
211
- let svgOutput = null;
212
+ let svgOutput = "";
212
213
  try {
213
214
  let fileExtension = null;
214
- let showBaseFrame = false;
215
+ let outputDefaultZoom = defaultZoomScale;
215
216
  if (outputPath) {
216
217
  fileExtension = path.extname(outputPath).substring(1);
217
- if (fileExtension === 'pdf') {
218
- showBaseFrame = true;
218
+ if (fileExtension === "pdf") {
219
+ outputDefaultZoom = 1;
219
220
  }
220
221
  }
221
- const layoutEngine = new LayoutEngine({
222
- showBaseFrame,
223
- });
222
+ const layoutEngine = new LayoutEngine();
224
223
  const layoutTimer = new SimpleStopwatch();
225
- const graph = layoutEngine.runLayout(sequence, nets);
224
+ const sheetFrames = layoutEngine.runLayout(sequence, nets);
226
225
  layoutEngine.printWarnings();
227
226
  showStats && console.log('Layout took:', layoutTimer.lap());
228
227
  dumpData && writeFileSync('dump/raw-layout.txt', layoutEngine.logger.dump());
229
228
  const generateSvgTimer = new SimpleStopwatch();
230
- const { svg: generatedSvg, width: svgWidth, height: svgHeight } = generateSVG2(graph);
231
- svgOutput = generatedSvg;
229
+ const svgCanvas = renderSheetsToSVG(sheetFrames);
232
230
  showStats && console.log('Render took:', generateSvgTimer.lap());
231
+ svgOutput = generateSvgOutput(svgCanvas, outputDefaultZoom);
233
232
  if (outputPath) {
234
233
  if (fileExtension === 'svg') {
235
234
  writeFileSync(outputPath, svgOutput);
236
235
  }
237
236
  else if (fileExtension === 'pdf') {
237
+ let sheetSize = "A4";
238
+ let sheetSizeDefined = false;
239
+ if (frameComponent) {
240
+ sheetSize = frameComponent.getParam(FrameParamKeys.PaperSize);
241
+ sheetSizeDefined = true;
242
+ }
238
243
  const doc = new PDFDocument({
239
244
  layout: 'landscape',
240
- size: 'A4',
245
+ size: sheetSize
241
246
  });
242
247
  const outputStream = createWriteStream(outputPath);
243
- const paperWidthMM = 297;
244
- const paperHeightMM = 210;
245
- const xOffset = (paperWidthMM - svgWidth) / 2;
246
- const yOffset = (paperHeightMM - svgHeight) / 2;
247
- SVGtoPDF(doc, svgOutput, xOffset * MMToPt, yOffset * MMToPt);
248
+ generatePdfOutput(doc, svgCanvas, sheetSize, sheetSizeDefined, outputDefaultZoom);
248
249
  doc.pipe(outputStream);
249
250
  doc.end();
250
251
  }
@@ -323,3 +324,43 @@ export function milsToMM(value) {
323
324
  export function pxToMM(value) {
324
325
  return value * PxToMM;
325
326
  }
327
+ const PaperSizes = {
328
+ 'A0': [1189, 841],
329
+ 'A1': [841, 594],
330
+ 'A2': [594, 420],
331
+ 'A3': [420, 297],
332
+ 'A4': [297, 210],
333
+ 'A5': [210, 148],
334
+ 'A6': [148, 105],
335
+ };
336
+ export const PaperGridReferences = {
337
+ 'A0': [16, 24],
338
+ 'A1': [12, 16],
339
+ 'A2': [8, 12],
340
+ 'A3': [6, 8],
341
+ 'A4': [4, 6],
342
+ };
343
+ export function isSupportedPaperSize(type) {
344
+ if (PaperSizes[type]) {
345
+ return true;
346
+ }
347
+ return false;
348
+ }
349
+ export function getPaperSize(type, margin = defaultPageMarginMM) {
350
+ if (PaperSizes[type]) {
351
+ const [width, height] = PaperSizes[type];
352
+ const useWidth = width - margin * 2;
353
+ const useHeight = height - margin * 2;
354
+ return {
355
+ width: Math.floor(useWidth * (1 / MilsToMM)),
356
+ height: Math.floor(useHeight * (1 / MilsToMM)),
357
+ widthMM: useWidth,
358
+ heightMM: useHeight,
359
+ originalWidthMM: width,
360
+ originalHeightMM: height,
361
+ };
362
+ }
363
+ else {
364
+ return getPaperSize('A4');
365
+ }
366
+ }
@@ -1,7 +1,7 @@
1
1
  import { Graph, alg } from '@dagrejs/graphlib';
2
- import { SymbolCustom, SymbolDrawing, SymbolFactory, SymbolCustomModule, SymbolPlaceholder, SymbolText } from "./draw_symbols.mjs";
2
+ import { SymbolCustom, SymbolDrawing, SymbolFactory, SymbolCustomModule, SymbolPlaceholder, SymbolText, PlaceHolderCommands } from "./draw_symbols.mjs";
3
3
  import { FrameAction, SequenceAction } from "./objects/ExecutionScope.mjs";
4
- import { defaultFrameTitleTextSize, defaultGridSizeUnits, GlobalNames, ParamKeys, WireAutoDirection } from './globals.mjs';
4
+ import { defaultFrameTitleTextSize, defaultGridSizeUnits, FrameType, GlobalNames, ParamKeys, WireAutoDirection } from './globals.mjs';
5
5
  import { NumericValue } from './objects/ParamDefinition.mjs';
6
6
  import { Geometry } from './geometry.mjs';
7
7
  import { Logger } from './logger.mjs';
@@ -61,38 +61,51 @@ export class LayoutEngine {
61
61
  this.print('-- items:', item.components);
62
62
  });
63
63
  }
64
- const { textObjects, elementFrames } = this.placeFrames(graph, subgraphInfo, containerFrames);
64
+ const { elementFrames } = this.placeFrames(graph, subgraphInfo, containerFrames);
65
65
  const frameObjects = [...elementFrames, ...containerFrames];
66
- const placedComponents = [];
67
- const placedWires = [];
68
- const tmpNodes = graph.nodes();
69
- tmpNodes.forEach(item => {
70
- const nodeValue = graph.node(item);
71
- const [nodeType, nodeItem] = nodeValue;
72
- if (nodeType === RenderItemType.Component) {
73
- placedComponents.push(nodeItem);
74
- }
75
- else if (nodeType === RenderItemType.Wire) {
76
- placedWires.push(nodeItem);
77
- }
66
+ const sheetFrames = frameObjects.filter(item => {
67
+ return item.frame.frameType === FrameType.Sheet;
68
+ });
69
+ if (sheetFrames.length === 0) {
70
+ sheetFrames.push(containerFrames[0]);
71
+ }
72
+ const sheetFrameObjects = sheetFrames.map(sheet => {
73
+ const items = this.flattenFrameItems(sheet);
74
+ const components = items.filter(item => item instanceof RenderComponent);
75
+ const wires = items.filter(item => item instanceof RenderWire);
76
+ const textObjects = items.filter(item => item instanceof RenderText);
77
+ const frames = items.filter(item => item instanceof RenderFrame);
78
+ const wireGroups = new Map();
79
+ wires.forEach(wire => {
80
+ const { netName } = wire;
81
+ if (!wireGroups.has(netName)) {
82
+ wireGroups.set(netName, []);
83
+ }
84
+ wireGroups.get(netName).push(wire);
85
+ });
86
+ const { junctions, mergedWires } = this.findJunctions(wireGroups);
87
+ return {
88
+ frame: sheet,
89
+ frames,
90
+ components,
91
+ wires,
92
+ textObjects,
93
+ junctions,
94
+ mergedWires,
95
+ };
78
96
  });
79
- const wireGroups = new Map();
80
- placedWires.forEach(wire => {
81
- const { netName } = wire;
82
- if (!wireGroups.has(netName)) {
83
- wireGroups.set(netName, []);
97
+ return sheetFrameObjects;
98
+ }
99
+ flattenFrameItems(frame) {
100
+ const items = [];
101
+ frame.innerItems.forEach(item => {
102
+ items.push(item);
103
+ if (item instanceof RenderFrame) {
104
+ const inner = this.flattenFrameItems(item);
105
+ items.push(...inner);
84
106
  }
85
- wireGroups.get(netName).push(wire);
86
107
  });
87
- const { junctions, mergedWires } = this.findJunctions(wireGroups);
88
- return {
89
- components: placedComponents,
90
- wires: placedWires,
91
- mergedWires,
92
- junctions,
93
- frameObjects,
94
- textObjects,
95
- };
108
+ return items;
96
109
  }
97
110
  findJunctions(wireGroups) {
98
111
  const junctions = [];
@@ -176,8 +189,14 @@ export class LayoutEngine {
176
189
  this.print(level, "".padStart(level * 4), 'frame', frame.x, frame.y);
177
190
  const innerItems = frame.innerItems;
178
191
  innerItems.forEach(innerFrame => {
179
- innerFrame.x += frame.x;
180
- innerFrame.y += frame.y;
192
+ if (innerFrame.frame.frameType === FrameType.Sheet) {
193
+ innerFrame.x = 0;
194
+ innerFrame.y = 0;
195
+ }
196
+ else {
197
+ innerFrame.x += frame.x;
198
+ innerFrame.y += frame.y;
199
+ }
181
200
  if (innerFrame.type === RenderFrameType.Elements) {
182
201
  this.print(level, "".padStart(level * 4), 'element frame', innerFrame.x, innerFrame.y);
183
202
  innerFrame.innerItems.forEach(item2 => {
@@ -265,12 +284,33 @@ export class LayoutEngine {
265
284
  }
266
285
  boundPoints.push([innerFrame.x, innerFrame.y], [innerFrame.x + frameWidth, innerFrame.y + frameHeight]);
267
286
  });
268
- frame.bounds = resizeBounds(getBoundsFromPoints(boundPoints), frame.padding);
269
- if (frame.width !== null) {
270
- frame.bounds.xmax = milsToMM(frame.bounds.xmin + frame.width);
287
+ const contentsBounds = resizeBounds(getBoundsFromPoints(boundPoints), frame.padding);
288
+ if (frame.frame.parameters.has(FrameParamKeys.SheetFrame)) {
289
+ const frameComponent = frame.frame.parameters.get(FrameParamKeys.SheetFrame);
290
+ const rects = ExtractDrawingRects(frameComponent.displayProp);
291
+ let frameWidth = 0;
292
+ let frameHeight = 0;
293
+ if (rects[1]) {
294
+ frameWidth = milsToMM(rects[1].width);
295
+ frameHeight = milsToMM(rects[1].height);
296
+ }
297
+ const contentsWidth = contentsBounds.xmax - contentsBounds.xmin;
298
+ const contentsHeight = contentsBounds.ymax - contentsBounds.ymin;
299
+ const frameOffsetX = toNearestGrid((frameWidth - contentsWidth) / 2, gridSize);
300
+ const frameOffsetY = toNearestGrid((frameHeight - contentsHeight) / 2, gridSize);
301
+ innerFrames.forEach(innerFrame => {
302
+ innerFrame.x += frameOffsetX;
303
+ innerFrame.y += frameOffsetY;
304
+ });
305
+ frame.bounds = {
306
+ xmin: 0,
307
+ ymin: 0,
308
+ xmax: frameWidth,
309
+ ymax: frameHeight
310
+ };
271
311
  }
272
- if (frame.height !== null) {
273
- frame.bounds.ymax = milsToMM(frame.bounds.ymin + frame.height);
312
+ else {
313
+ frame.bounds = contentsBounds;
274
314
  }
275
315
  }
276
316
  dumpFrame(frame, level = 0) {
@@ -1257,6 +1297,7 @@ export class RenderFrame extends RenderObject {
1257
1297
  borderWidth = 5;
1258
1298
  width = null;
1259
1299
  height = null;
1300
+ size = null;
1260
1301
  subgraphId = "";
1261
1302
  type;
1262
1303
  containsTitle = false;
@@ -1307,6 +1348,16 @@ export function CalculatePinPositions(component) {
1307
1348
  });
1308
1349
  return pinPositionMapping;
1309
1350
  }
1351
+ export function ExtractDrawingRects(drawing) {
1352
+ return drawing.getCommands().filter(item => {
1353
+ return (item[0] === PlaceHolderCommands.rect);
1354
+ }).map(item => {
1355
+ return {
1356
+ width: item[1][2],
1357
+ height: item[1][3],
1358
+ };
1359
+ });
1360
+ }
1310
1361
  function isPointOverlap(x, y, other) {
1311
1362
  return (x >= other.x && y >= other.y && x <= (other.x + other.width) && y <= (other.y + other.height));
1312
1363
  }
@@ -85,6 +85,9 @@ export class ClassComponent {
85
85
  this.parameters.set(key, value);
86
86
  this.refreshParamCache();
87
87
  }
88
+ hasParam(key) {
89
+ return this.parameters.has(key);
90
+ }
88
91
  refreshParamCache() {
89
92
  this._cachedParams =
90
93
  JSON.stringify(Object.fromEntries(this.parameters));
@@ -6,6 +6,7 @@ export class ExecutionScope {
6
6
  variables = new Map();
7
7
  symbols = new Map();
8
8
  blockStack = new Map();
9
+ breakStack = [];
9
10
  wires = [];
10
11
  frames = [];
11
12
  indentLevel = 0;
@@ -1,8 +1,10 @@
1
1
  export class Frame {
2
2
  parameters = new Map();
3
3
  frameId;
4
- constructor(frameId) {
4
+ frameType;
5
+ constructor(frameId, frameType) {
5
6
  this.frameId = frameId;
7
+ this.frameType = frameType;
6
8
  }
7
9
  }
8
10
  export var FrameParamKeys;
@@ -13,6 +15,8 @@ export var FrameParamKeys;
13
15
  FrameParamKeys["Border"] = "border";
14
16
  FrameParamKeys["Width"] = "width";
15
17
  FrameParamKeys["Height"] = "height";
18
+ FrameParamKeys["PaperSize"] = "paper_size";
19
+ FrameParamKeys["SheetFrame"] = "sheet_frame";
16
20
  })(FrameParamKeys || (FrameParamKeys = {}));
17
21
  export var FramePlotDirection;
18
22
  (function (FramePlotDirection) {
@@ -32,9 +32,3 @@ export class PercentageValue {
32
32
  return this.value.toString();
33
33
  }
34
34
  }
35
- export class PinBlankValue {
36
- blank;
37
- constructor(value) {
38
- this.blank = value;
39
- }
40
- }
@@ -3,6 +3,9 @@ export class UndeclaredReference {
3
3
  constructor(reference) {
4
4
  this.reference = reference;
5
5
  }
6
+ throwMessage() {
7
+ return `Unknown symbol: ${this.reference.name}`;
8
+ }
6
9
  }
7
10
  export class DeclaredReference {
8
11
  found;
@@ -17,6 +20,9 @@ export class DeclaredReference {
17
20
  this.type = refType.type;
18
21
  this.value = refType.value;
19
22
  }
23
+ toString() {
24
+ return `[DeclaredReference name: ${this.name} trailers:${this.trailers} found: ${this.found}]`;
25
+ }
20
26
  }
21
27
  export var ParseSymbolType;
22
28
  (function (ParseSymbolType) {
@@ -26,7 +26,8 @@ async function regenerateTests(extra = "") {
26
26
  return cstFiles;
27
27
  }
28
28
  (async () => {
29
- const generateDiff = false;
29
+ const generateDiff = (process.argv.indexOf('-diff') !== -1);
30
+ console.log('diff flag: ', generateDiff);
30
31
  const nextExtra = generateDiff ? '.next' : '';
31
32
  const cstFiles = await regenerateTests(nextExtra);
32
33
  const allFiles = [];