circuitscript 0.1.31 → 0.1.33
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 +37 -3
- package/dist/cjs/RefdesAnnotationVisitor.js +27 -10
- package/dist/cjs/antlr/CircuitScriptParser.js +990 -831
- package/dist/cjs/draw_symbols.js +38 -34
- package/dist/cjs/environment.js +24 -4
- package/dist/cjs/execute.js +107 -68
- package/dist/cjs/globals.js +4 -2
- package/dist/cjs/graph.js +14 -12
- package/dist/cjs/helpers.js +85 -16
- package/dist/cjs/layout.js +50 -25
- package/dist/cjs/main.js +16 -18
- package/dist/cjs/objects/ClassComponent.js +199 -30
- package/dist/cjs/objects/types.js +5 -1
- package/dist/cjs/regenerate-tests.js +3 -3
- package/dist/cjs/render.js +5 -3
- package/dist/cjs/rules-check/no-connect-on-connected-pin.js +9 -8
- package/dist/cjs/rules-check/rules.js +7 -2
- package/dist/cjs/rules-check/unconnected-pins.js +10 -8
- package/dist/cjs/utils.js +2 -1
- package/dist/cjs/validate/SymbolValidatorVisitor.js +0 -10
- package/dist/cjs/visitor.js +284 -191
- package/dist/esm/BaseVisitor.js +37 -3
- package/dist/esm/RefdesAnnotationVisitor.js +27 -10
- package/dist/esm/antlr/CircuitScriptParser.js +989 -830
- package/dist/esm/antlr/CircuitScriptVisitor.js +1 -0
- package/dist/esm/draw_symbols.js +38 -34
- package/dist/esm/environment.js +21 -1
- package/dist/esm/execute.js +108 -69
- package/dist/esm/globals.js +2 -0
- package/dist/esm/graph.js +14 -12
- package/dist/esm/helpers.js +86 -17
- package/dist/esm/layout.js +51 -26
- package/dist/esm/main.js +16 -18
- package/dist/esm/objects/ClassComponent.js +201 -30
- package/dist/esm/objects/types.js +7 -1
- package/dist/esm/regenerate-tests.js +3 -3
- package/dist/esm/render.js +5 -3
- package/dist/esm/rules-check/no-connect-on-connected-pin.js +9 -8
- package/dist/esm/rules-check/rules.js +7 -2
- package/dist/esm/rules-check/unconnected-pins.js +10 -8
- package/dist/esm/utils.js +2 -1
- package/dist/esm/validate/SymbolValidatorVisitor.js +0 -10
- package/dist/esm/visitor.js +185 -92
- package/dist/types/BaseVisitor.d.ts +15 -5
- package/dist/types/RefdesAnnotationVisitor.d.ts +2 -0
- package/dist/types/antlr/CircuitScriptParser.d.ts +32 -14
- package/dist/types/antlr/CircuitScriptVisitor.d.ts +2 -0
- package/dist/types/environment.d.ts +7 -1
- package/dist/types/execute.d.ts +4 -1
- package/dist/types/globals.d.ts +2 -0
- package/dist/types/graph.d.ts +2 -2
- package/dist/types/helpers.d.ts +2 -1
- package/dist/types/layout.d.ts +5 -4
- package/dist/types/objects/ClassComponent.d.ts +34 -9
- package/dist/types/objects/types.d.ts +19 -3
- package/dist/types/validate/SymbolValidatorVisitor.d.ts +0 -4
- package/dist/types/visitor.d.ts +7 -1
- package/package.json +1 -1
|
@@ -27,9 +27,11 @@ export declare class RefdesAnnotationVisitor extends BaseVisitor {
|
|
|
27
27
|
private generateRefdesAnnotationComment;
|
|
28
28
|
private addRefdesAnnotationComment;
|
|
29
29
|
getOutput(): string;
|
|
30
|
+
getOutputForExternalRefdesFile(): string[];
|
|
30
31
|
private generateModifiedText;
|
|
31
32
|
private buildContextTokenRanges;
|
|
32
33
|
private findContextForToken;
|
|
33
34
|
private markTokensAsProcessed;
|
|
34
35
|
private log;
|
|
36
|
+
private generateReplacementText;
|
|
35
37
|
}
|
|
@@ -132,20 +132,21 @@ export declare class CircuitScriptParser extends antlr.Parser {
|
|
|
132
132
|
static readonly RULE_array_expr = 57;
|
|
133
133
|
static readonly RULE_point_expr = 58;
|
|
134
134
|
static readonly RULE_import_expr = 59;
|
|
135
|
-
static readonly
|
|
136
|
-
static readonly
|
|
137
|
-
static readonly
|
|
138
|
-
static readonly
|
|
139
|
-
static readonly
|
|
140
|
-
static readonly
|
|
141
|
-
static readonly
|
|
142
|
-
static readonly
|
|
143
|
-
static readonly
|
|
144
|
-
static readonly
|
|
145
|
-
static readonly
|
|
146
|
-
static readonly
|
|
147
|
-
static readonly
|
|
148
|
-
static readonly
|
|
135
|
+
static readonly RULE_import_annotation_expr = 60;
|
|
136
|
+
static readonly RULE_frame_expr = 61;
|
|
137
|
+
static readonly RULE_if_expr = 62;
|
|
138
|
+
static readonly RULE_if_inner_expr = 63;
|
|
139
|
+
static readonly RULE_else_expr = 64;
|
|
140
|
+
static readonly RULE_while_expr = 65;
|
|
141
|
+
static readonly RULE_for_expr = 66;
|
|
142
|
+
static readonly RULE_part_set_expr = 67;
|
|
143
|
+
static readonly RULE_part_set_key = 68;
|
|
144
|
+
static readonly RULE_part_match_block = 69;
|
|
145
|
+
static readonly RULE_part_sub_expr = 70;
|
|
146
|
+
static readonly RULE_part_condition_expr = 71;
|
|
147
|
+
static readonly RULE_part_condition_key_only_expr = 72;
|
|
148
|
+
static readonly RULE_part_value_expr = 73;
|
|
149
|
+
static readonly RULE_annotation_comment_expr = 74;
|
|
149
150
|
static readonly literalNames: (string | null)[];
|
|
150
151
|
static readonly symbolicNames: (string | null)[];
|
|
151
152
|
static readonly ruleNames: string[];
|
|
@@ -217,6 +218,7 @@ export declare class CircuitScriptParser extends antlr.Parser {
|
|
|
217
218
|
array_expr(): Array_exprContext;
|
|
218
219
|
point_expr(): Point_exprContext;
|
|
219
220
|
import_expr(): Import_exprContext;
|
|
221
|
+
import_annotation_expr(): Import_annotation_exprContext;
|
|
220
222
|
frame_expr(): Frame_exprContext;
|
|
221
223
|
if_expr(): If_exprContext;
|
|
222
224
|
if_inner_expr(): If_inner_exprContext;
|
|
@@ -814,9 +816,12 @@ export declare class GraphicForExprContext extends Graphic_exprContext {
|
|
|
814
816
|
accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
|
|
815
817
|
}
|
|
816
818
|
export declare class Property_exprContext extends antlr.ParserRuleContext {
|
|
819
|
+
_extra?: Token | null;
|
|
817
820
|
constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
|
|
818
821
|
property_key_expr(): Property_key_exprContext;
|
|
819
822
|
property_value_expr(): Property_value_exprContext;
|
|
823
|
+
STRING_VALUE(): antlr.TerminalNode[];
|
|
824
|
+
STRING_VALUE(i: number): antlr.TerminalNode | null;
|
|
820
825
|
get ruleIndex(): number;
|
|
821
826
|
accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
|
|
822
827
|
}
|
|
@@ -898,6 +903,7 @@ export declare class Import_specificContext extends Import_exprContext {
|
|
|
898
903
|
Import(): antlr.TerminalNode;
|
|
899
904
|
ID(): antlr.TerminalNode[];
|
|
900
905
|
ID(i: number): antlr.TerminalNode | null;
|
|
906
|
+
import_annotation_expr(): Import_annotation_exprContext | null;
|
|
901
907
|
accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
|
|
902
908
|
}
|
|
903
909
|
export declare class Import_all_simpleContext extends Import_exprContext {
|
|
@@ -907,6 +913,7 @@ export declare class Import_all_simpleContext extends Import_exprContext {
|
|
|
907
913
|
Import(): antlr.TerminalNode;
|
|
908
914
|
Multiply(): antlr.TerminalNode;
|
|
909
915
|
ID(): antlr.TerminalNode;
|
|
916
|
+
import_annotation_expr(): Import_annotation_exprContext | null;
|
|
910
917
|
accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
|
|
911
918
|
}
|
|
912
919
|
export declare class Import_simpleContext extends Import_exprContext {
|
|
@@ -914,6 +921,17 @@ export declare class Import_simpleContext extends Import_exprContext {
|
|
|
914
921
|
constructor(ctx: Import_exprContext);
|
|
915
922
|
Import(): antlr.TerminalNode;
|
|
916
923
|
ID(): antlr.TerminalNode;
|
|
924
|
+
import_annotation_expr(): Import_annotation_exprContext | null;
|
|
925
|
+
accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
|
|
926
|
+
}
|
|
927
|
+
export declare class Import_annotation_exprContext extends antlr.ParserRuleContext {
|
|
928
|
+
constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
|
|
929
|
+
ANNOTATION_START(): antlr.TerminalNode;
|
|
930
|
+
ID(): antlr.TerminalNode[];
|
|
931
|
+
ID(i: number): antlr.TerminalNode | null;
|
|
932
|
+
Minus(): antlr.TerminalNode[];
|
|
933
|
+
Minus(i: number): antlr.TerminalNode | null;
|
|
934
|
+
get ruleIndex(): number;
|
|
917
935
|
accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
|
|
918
936
|
}
|
|
919
937
|
export declare class Frame_exprContext extends antlr.ParserRuleContext {
|
|
@@ -74,6 +74,7 @@ import { Point_exprContext } from "./CircuitScriptParser.js";
|
|
|
74
74
|
import { Import_simpleContext } from "./CircuitScriptParser.js";
|
|
75
75
|
import { Import_all_simpleContext } from "./CircuitScriptParser.js";
|
|
76
76
|
import { Import_specificContext } from "./CircuitScriptParser.js";
|
|
77
|
+
import { Import_annotation_exprContext } from "./CircuitScriptParser.js";
|
|
77
78
|
import { Frame_exprContext } from "./CircuitScriptParser.js";
|
|
78
79
|
import { If_exprContext } from "./CircuitScriptParser.js";
|
|
79
80
|
import { If_inner_exprContext } from "./CircuitScriptParser.js";
|
|
@@ -164,6 +165,7 @@ export declare class CircuitScriptVisitor<Result> extends AbstractParseTreeVisit
|
|
|
164
165
|
visitImport_simple?: (ctx: Import_simpleContext) => Result;
|
|
165
166
|
visitImport_all_simple?: (ctx: Import_all_simpleContext) => Result;
|
|
166
167
|
visitImport_specific?: (ctx: Import_specificContext) => Result;
|
|
168
|
+
visitImport_annotation_expr?: (ctx: Import_annotation_exprContext) => Result;
|
|
167
169
|
visitFrame_expr?: (ctx: Frame_exprContext) => Result;
|
|
168
170
|
visitIf_expr?: (ctx: If_exprContext) => Result;
|
|
169
171
|
visitIf_inner_expr?: (ctx: If_inner_exprContext) => Result;
|
|
@@ -28,7 +28,8 @@ export declare class NodeScriptEnvironment {
|
|
|
28
28
|
textMeasurementCanvas: Dom | undefined;
|
|
29
29
|
getCanvasWindow(): Dom;
|
|
30
30
|
prepareSVGEnvironment(): Promise<void>;
|
|
31
|
-
readFile(path: PathOrFileDescriptor, options
|
|
31
|
+
readFile(path: PathOrFileDescriptor, options?: any): Promise<string>;
|
|
32
|
+
writeFileSync(path: PathOrFileDescriptor, data: string): void;
|
|
32
33
|
getAbsolutePath(filePath: string): string;
|
|
33
34
|
getDirPath(filePath: string): string;
|
|
34
35
|
setCurrentFile(filePath: string): string;
|
|
@@ -36,4 +37,9 @@ export declare class NodeScriptEnvironment {
|
|
|
36
37
|
getRelativeToCurrentFolder(filePath: string): string;
|
|
37
38
|
exists(path: PathLike): Promise<boolean>;
|
|
38
39
|
hashStringSHA256(value: string): string;
|
|
40
|
+
dirname(filePath: string): string;
|
|
41
|
+
extname(filePath: string): string;
|
|
42
|
+
basename(filePath: string, ext: string): string;
|
|
43
|
+
join(...paths: string[]): string;
|
|
44
|
+
relative(from: string, to: string): string;
|
|
39
45
|
}
|
package/dist/types/execute.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { ExecutionScope } from './objects/ExecutionScope.js';
|
|
|
5
5
|
import { Net } from './objects/Net.js';
|
|
6
6
|
import { NumericValue, ParamDefinition } from './objects/ParamDefinition.js';
|
|
7
7
|
import { PinDefinition, PinId } from './objects/PinDefinition.js';
|
|
8
|
-
import { AnyReference, CFunction, CFunctionEntry, CFunctionResult, CallableParameter, ComponentPin } from './objects/types.js';
|
|
8
|
+
import { AnyReference, CFunction, CFunctionEntry, CFunctionResult, CallableParameter, ComponentPin, ComponentUnitDefinition } from './objects/types.js';
|
|
9
9
|
import { Wire } from './objects/Wire.js';
|
|
10
10
|
import { Logger } from './logger.js';
|
|
11
11
|
import { UnitDimension } from './helpers.js';
|
|
@@ -53,7 +53,10 @@ export declare class ExecutionContext {
|
|
|
53
53
|
copy: boolean;
|
|
54
54
|
angle?: NumericValue;
|
|
55
55
|
followWireOrientation: boolean;
|
|
56
|
+
units: [string, ComponentUnitDefinition][];
|
|
56
57
|
}, isModule?: boolean): ClassComponent;
|
|
58
|
+
private extractPinsFromUnits;
|
|
59
|
+
private generateComponentUnits;
|
|
57
60
|
private removeArrangePropDuplicates;
|
|
58
61
|
private getArrangePropPins;
|
|
59
62
|
printPoint(extra?: string): void;
|
package/dist/types/globals.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export declare const TOOL_VERSION = "0.1.5";
|
|
|
2
2
|
export declare const Delimiter1 = "-";
|
|
3
3
|
export declare const DoubleDelimiter1 = "--";
|
|
4
4
|
export declare const BaseNamespace = "--.";
|
|
5
|
+
export declare const RefdesFileSuffix = ".refdes.json";
|
|
5
6
|
export declare enum GlobalNames {
|
|
6
7
|
__root = "--root",
|
|
7
8
|
symbol = "symbol"
|
|
@@ -114,3 +115,4 @@ export declare const RenderFlags: {
|
|
|
114
115
|
};
|
|
115
116
|
export declare const SymbolValidatorContext = "_sym";
|
|
116
117
|
export declare const TrailerArrayIndex = "index";
|
|
118
|
+
export declare const DefaultComponentUnit = "__default";
|
package/dist/types/graph.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Graph } from "@dagrejs/graphlib";
|
|
2
2
|
import { SymbolPinDefintion } from "./draw_symbols.js";
|
|
3
3
|
import { RenderFrame, RenderComponent, RenderWire } from "./layout.js";
|
|
4
|
-
import { ClassComponent } from "./objects/ClassComponent.js";
|
|
4
|
+
import { ClassComponent, ComponentUnit } from "./objects/ClassComponent.js";
|
|
5
5
|
import { SequenceItem } from "./objects/ExecutionScope.js";
|
|
6
6
|
import { Net } from "./objects/Net.js";
|
|
7
7
|
import { Logger } from "./logger.js";
|
|
@@ -22,7 +22,7 @@ export declare class NetGraph {
|
|
|
22
22
|
private getComponentName;
|
|
23
23
|
}
|
|
24
24
|
export declare function getWireName(wireId: number): string;
|
|
25
|
-
export declare function generateLayoutPinDefinition(
|
|
25
|
+
export declare function generateLayoutPinDefinition(componentUnit: ComponentUnit): SymbolPinDefintion[];
|
|
26
26
|
export declare enum RenderItemType {
|
|
27
27
|
Wire = "wire",
|
|
28
28
|
Component = "component"
|
package/dist/types/helpers.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export type SVGWindow = any;
|
|
|
11
11
|
import { NumericValue } from "./objects/ParamDefinition.js";
|
|
12
12
|
import { NodeScriptEnvironment } from "./environment.js";
|
|
13
13
|
import { ClassComponent } from "./objects/ClassComponent.js";
|
|
14
|
+
import { ImportedModule } from "./objects/types.js";
|
|
14
15
|
export declare enum JSModuleType {
|
|
15
16
|
CommonJs = "cjs",
|
|
16
17
|
ESM = "mjs"
|
|
@@ -46,7 +47,7 @@ type RenderScriptReturn = {
|
|
|
46
47
|
errors: BaseError[];
|
|
47
48
|
};
|
|
48
49
|
export declare function renderScript(scriptData: string, outputPath: string | null, options: ScriptOptions): Promise<RenderScriptReturn>;
|
|
49
|
-
export declare function renderScriptCustom(scriptData: string, outputPath: string | null, options: ScriptOptions, parseHandlers: ParseOutputHandler[], postAnnotationCallbacks: ((options: ScriptOptions, scriptData: string, tree: ScriptContext, tokens: CommonTokenStream, componentLinks: Map<ParserRuleContext, ClassComponent
|
|
50
|
+
export declare function renderScriptCustom(scriptData: string, outputPath: string | null, options: ScriptOptions, parseHandlers: ParseOutputHandler[], postAnnotationCallbacks: ((options: ScriptOptions, scriptData: string, tree: ScriptContext, tokens: CommonTokenStream, componentLinks: Map<ParserRuleContext, ClassComponent>, importedModule: ImportedModule[], environment: NodeScriptEnvironment) => void)[]): Promise<RenderScriptReturn>;
|
|
50
51
|
export declare abstract class ParseOutputHandler {
|
|
51
52
|
beforeRender: boolean;
|
|
52
53
|
afterRender: boolean;
|
package/dist/types/layout.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Graph } from '@dagrejs/graphlib';
|
|
2
2
|
import { SymbolGraphic, SymbolText, SymbolDrawingCommands, SimplePoint } from "./draw_symbols.js";
|
|
3
|
-
import { ClassComponent } from "./objects/ClassComponent.js";
|
|
3
|
+
import { ClassComponent, ComponentUnit } from "./objects/ClassComponent.js";
|
|
4
4
|
import { WireAutoDirection } from './globals.js';
|
|
5
5
|
import { Wire, WireSegment } from './objects/Wire.js';
|
|
6
6
|
import { Net } from './objects/Net.js';
|
|
@@ -41,7 +41,7 @@ export declare class LayoutEngine {
|
|
|
41
41
|
printWarnings(): void;
|
|
42
42
|
}
|
|
43
43
|
type RenderItem = RenderComponent | RenderWire | RenderText;
|
|
44
|
-
export declare function applyComponentParamsToSymbol(
|
|
44
|
+
export declare function applyComponentParamsToSymbol(componentUnit: ComponentUnit, symbol: SymbolGraphic): void;
|
|
45
45
|
export declare function getBounds(components: (RenderComponent | RenderText)[], wires: RenderWire[], junctions: RenderJunction[], frames: RenderFrame[]): BoundBox;
|
|
46
46
|
export declare class RenderObject {
|
|
47
47
|
x: NumericValue;
|
|
@@ -89,11 +89,12 @@ export type MergedWire = {
|
|
|
89
89
|
};
|
|
90
90
|
export declare class RenderComponent extends RenderObject {
|
|
91
91
|
component: ClassComponent;
|
|
92
|
+
unitId: string;
|
|
92
93
|
symbol: SymbolGraphic;
|
|
93
94
|
width: number;
|
|
94
95
|
height: number;
|
|
95
96
|
displaySymbol: string | null;
|
|
96
|
-
constructor(component: ClassComponent, width: number, height: number);
|
|
97
|
+
constructor(component: ClassComponent, unitId: string, width: number, height: number);
|
|
97
98
|
doesOverlap(other: RenderComponent): boolean;
|
|
98
99
|
toString(): string;
|
|
99
100
|
}
|
|
@@ -146,7 +147,7 @@ export type SheetFrame = {
|
|
|
146
147
|
junctions: RenderJunction[];
|
|
147
148
|
mergedWires: MergedWire[];
|
|
148
149
|
};
|
|
149
|
-
export declare function CalculatePinPositions(
|
|
150
|
+
export declare function CalculatePinPositions(unit: ComponentUnit): Map<number, {
|
|
150
151
|
x: NumericValue;
|
|
151
152
|
y: NumericValue;
|
|
152
153
|
angle: NumericValue;
|
|
@@ -6,6 +6,32 @@ import { PinDefinition, PinId } from './PinDefinition.js';
|
|
|
6
6
|
import { WireSegment } from './Wire.js';
|
|
7
7
|
import { ExecutionContext } from '../execute.js';
|
|
8
8
|
import { NumericValue } from './ParamDefinition.js';
|
|
9
|
+
export declare class ComponentUnit {
|
|
10
|
+
parent: ClassComponent;
|
|
11
|
+
unitId: string;
|
|
12
|
+
refdesSuffix: string;
|
|
13
|
+
suffix: string | null;
|
|
14
|
+
get instanceName(): string;
|
|
15
|
+
parameters: Map<string, number | string | NumericValue>;
|
|
16
|
+
numPins: number;
|
|
17
|
+
pins: Map<PinId, PinDefinition>;
|
|
18
|
+
pinsFlat: PinDefinition[];
|
|
19
|
+
pinsMaxPositions: Map<string, number>;
|
|
20
|
+
arrangeProps: Map<string, PinId[]> | null;
|
|
21
|
+
displayProp: SymbolDrawingCommands | null;
|
|
22
|
+
widthProp: number | null;
|
|
23
|
+
heightProp: number | null;
|
|
24
|
+
angleProp: number;
|
|
25
|
+
followWireOrientationProp: boolean;
|
|
26
|
+
wireOrientationAngle: number;
|
|
27
|
+
useWireOrientationAngle: boolean;
|
|
28
|
+
didSetWireOrientationAngle: boolean;
|
|
29
|
+
_unplacedPins: PinId[];
|
|
30
|
+
constructor(unitId: string, parent: ClassComponent);
|
|
31
|
+
clone(): ComponentUnit;
|
|
32
|
+
setParam(key: string, value: number | string | NumericValue): void;
|
|
33
|
+
isEqual(other: ComponentUnit): boolean;
|
|
34
|
+
}
|
|
9
35
|
export declare class ClassComponent {
|
|
10
36
|
instanceName: string;
|
|
11
37
|
numPins: number;
|
|
@@ -14,27 +40,21 @@ export declare class ClassComponent {
|
|
|
14
40
|
pinNets: Map<PinId, Net>;
|
|
15
41
|
pinWires: Map<number, WireSegment[]>;
|
|
16
42
|
pinsMaxPositions: Map<string, number>;
|
|
43
|
+
units: ComponentUnit[];
|
|
17
44
|
_cachedPins: string;
|
|
18
45
|
_cachedParams: string;
|
|
19
46
|
_copyID?: number;
|
|
20
47
|
_copyFrom?: ClassComponent;
|
|
21
48
|
_pointLinkComponent?: ClassComponent;
|
|
22
49
|
_unplacedPins: PinId[];
|
|
23
|
-
arrangeProps: Map<string, PinId[]> | null;
|
|
24
|
-
displayProp: SymbolDrawingCommands | null;
|
|
25
|
-
widthProp: number | null;
|
|
26
|
-
heightProp: number | null;
|
|
27
50
|
typeProp: string | null;
|
|
28
51
|
copyProp: boolean;
|
|
29
|
-
angleProp: number;
|
|
30
|
-
followWireOrientationProp: boolean;
|
|
31
|
-
wireOrientationAngle: number;
|
|
32
|
-
useWireOrientationAngle: boolean;
|
|
33
|
-
didSetWireOrientationAngle: boolean;
|
|
34
52
|
assignedRefDes: string | null;
|
|
35
53
|
placeHolderRefDes: string | null;
|
|
54
|
+
forceSaveRefdesAnnotation: boolean;
|
|
36
55
|
ctxReferences: CtxReference[];
|
|
37
56
|
_creationIndex: number;
|
|
57
|
+
pinUnitMap: Map<PinId, ComponentUnit>;
|
|
38
58
|
constructor(instanceName: string, numPins: number);
|
|
39
59
|
setupPins(): void;
|
|
40
60
|
getDefaultPin(): PinId;
|
|
@@ -51,6 +71,10 @@ export declare class ClassComponent {
|
|
|
51
71
|
static simple(instanceName: string, numPins: number): ClassComponent;
|
|
52
72
|
isEqual(other: ClassComponent): boolean;
|
|
53
73
|
clone(): ClassComponent;
|
|
74
|
+
getUnit(unitId?: string | null): ComponentUnit;
|
|
75
|
+
addDefaultUnit(displayProp: SymbolDrawingCommands): void;
|
|
76
|
+
refreshPinUnitMap(): void;
|
|
77
|
+
getUnitForPin(pinId: PinId): ComponentUnit;
|
|
54
78
|
}
|
|
55
79
|
export declare class ModuleComponent extends ClassComponent {
|
|
56
80
|
moduleContainsExpressions?: Expressions_blockContext;
|
|
@@ -63,4 +87,5 @@ export type CtxReference = {
|
|
|
63
87
|
ctx: ParserRuleContext;
|
|
64
88
|
indexedStack: [ParserRuleContext, number][];
|
|
65
89
|
creationFlag: boolean;
|
|
90
|
+
filePath: string;
|
|
66
91
|
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { ParserRuleContext, Token } from 'antlr4ng';
|
|
1
|
+
import { CommonTokenStream, ParserRuleContext, Token } from 'antlr4ng';
|
|
2
2
|
import { ExecutionContext } from '../execute.js';
|
|
3
3
|
import { ClassComponent } from './ClassComponent.js';
|
|
4
4
|
import { Net } from './Net.js';
|
|
5
5
|
import { NumericValue, PercentageValue } from './ParamDefinition.js';
|
|
6
6
|
import { ReferenceTypes } from '../globals.js';
|
|
7
|
-
import { PinId } from './PinDefinition.js';
|
|
7
|
+
import { PinDefinition, PinId } from './PinDefinition.js';
|
|
8
|
+
import { ScriptContext } from 'src/antlr/CircuitScriptParser.js';
|
|
9
|
+
import { SymbolDrawingCommands } from 'src/draw_symbols.js';
|
|
8
10
|
export type CFunction = (args: CallableParameter[], options?: CFunctionOptions) => CFunctionResult;
|
|
9
11
|
export declare class CFunctionEntry {
|
|
10
12
|
name: string;
|
|
@@ -127,10 +129,24 @@ export declare class ImportedModule {
|
|
|
127
129
|
specifiedImports: string[];
|
|
128
130
|
moduleNamespace: string;
|
|
129
131
|
moduleFilePath: string;
|
|
130
|
-
|
|
132
|
+
enableRefdesAnnotation: boolean;
|
|
133
|
+
enableRefdesAnnotationFile: boolean;
|
|
134
|
+
tree: ScriptContext;
|
|
135
|
+
tokens: CommonTokenStream;
|
|
136
|
+
constructor(moduleName: string, moduleNamespace: string, moduleFilePath: string, tree: ScriptContext, tokens: CommonTokenStream, context: ExecutionContext, flag: ImportFunctionHandling, specifiedImports: string[]);
|
|
131
137
|
}
|
|
132
138
|
export declare enum ImportFunctionHandling {
|
|
133
139
|
AllWithNamespace = "all-with-namespace",
|
|
134
140
|
AllMergeIntoNamespace = "all-merge-into-namespace",
|
|
135
141
|
SpecificMergeIntoNamespace = "specific-merge-into-namespace"
|
|
136
142
|
}
|
|
143
|
+
export type ComponentUnitDefinition = {
|
|
144
|
+
width: NumericValue | null;
|
|
145
|
+
height: NumericValue | null;
|
|
146
|
+
angle: NumericValue | null;
|
|
147
|
+
followWireOrientation: boolean | null;
|
|
148
|
+
pins: PinDefinition[];
|
|
149
|
+
display: SymbolDrawingCommands | null;
|
|
150
|
+
arrange: any | null;
|
|
151
|
+
suffix: string | null;
|
|
152
|
+
};
|
|
@@ -7,10 +7,6 @@ import { SymbolTable } from "./SymbolTable.js";
|
|
|
7
7
|
import { BaseVisitor } from "../BaseVisitor.js";
|
|
8
8
|
export declare class SymbolValidatorVisitor extends BaseVisitor {
|
|
9
9
|
symbolTable: SymbolTable;
|
|
10
|
-
filePathStack: string[];
|
|
11
|
-
enterFile(filePath: string): void;
|
|
12
|
-
exitFile(): void;
|
|
13
|
-
getCurrentFile(): string;
|
|
14
10
|
protected addSymbolVariable(token: Token, name: string, value: ComplexType, executor?: ExecutionContext | null): void;
|
|
15
11
|
protected addSymbolFunction(token: Token, functionName: string, funcDefinedParameters: FunctionDefinedParameter[]): void;
|
|
16
12
|
protected handleAtomSymbol(atom: TerminalNode): SymbolTableItem;
|
package/dist/types/visitor.d.ts
CHANGED
|
@@ -22,6 +22,9 @@ export declare class ParserVisitor extends BaseVisitor {
|
|
|
22
22
|
visitPath_block: (ctx: Path_blockContext) => void;
|
|
23
23
|
visitGraph_expressions: (ctx: Graph_expressionsContext) => void;
|
|
24
24
|
visitCreate_component_expr: (ctx: Create_component_exprContext) => void;
|
|
25
|
+
private extractComponentUnitDefinition;
|
|
26
|
+
private extractComponentUnitProperties;
|
|
27
|
+
private createComponentPropertyValidator;
|
|
25
28
|
visitCreate_graphic_expr: (ctx: Create_graphic_exprContext) => void;
|
|
26
29
|
visitGraphic_expressions_block: (ctx: Graphic_expressions_blockContext) => void;
|
|
27
30
|
visitGraphicCommandExpr: (ctx: GraphicCommandExprContext) => void;
|
|
@@ -63,6 +66,7 @@ export declare class ParserVisitor extends BaseVisitor {
|
|
|
63
66
|
visitIf_inner_expr: (ctx: If_inner_exprContext) => void;
|
|
64
67
|
visitWhile_expr: (ctx: While_exprContext) => void;
|
|
65
68
|
visitFor_expr: (ctx: For_exprContext) => void;
|
|
69
|
+
private setCurrentComponentRefdes;
|
|
66
70
|
visitAnnotation_comment_expr: (ctx: Annotation_comment_exprContext) => void;
|
|
67
71
|
visitPart_set_expr: (ctx: Part_set_exprContext) => void;
|
|
68
72
|
visitPart_match_block: (ctx: Part_match_blockContext) => void;
|
|
@@ -71,10 +75,11 @@ export declare class ParserVisitor extends BaseVisitor {
|
|
|
71
75
|
visitPart_value_expr: (ctx: Part_value_exprContext) => void;
|
|
72
76
|
visitPart_condition_expr: (ctx: Part_condition_exprContext) => void;
|
|
73
77
|
visitPart_condition_key_only_expr: (ctx: Part_condition_key_only_exprContext) => void;
|
|
78
|
+
checkModuleHasRefdesFile(filePath: string): Promise<void>;
|
|
74
79
|
private resolveDataExpr;
|
|
75
80
|
private resolveDataValue;
|
|
76
81
|
pinTypes: PinTypes[];
|
|
77
|
-
private
|
|
82
|
+
private extractPinDefintion;
|
|
78
83
|
private parseCreateModulePorts;
|
|
79
84
|
private getArrangePropFromModulePorts;
|
|
80
85
|
private getPortItems;
|
|
@@ -95,6 +100,7 @@ export declare class ParserVisitor extends BaseVisitor {
|
|
|
95
100
|
nets: ComponentPinNetPair[];
|
|
96
101
|
};
|
|
97
102
|
annotateComponents(): void;
|
|
103
|
+
private setComponentUnitRefdesSuffix;
|
|
98
104
|
private renameNetsWithRefdes;
|
|
99
105
|
applySheetFrameComponent(): {
|
|
100
106
|
frameComponent: ClassComponent | null;
|