circuitscript 0.0.25 → 0.0.26
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/LICENSE +1 -1
- package/dist/cjs/BaseVisitor.js +9 -11
- package/dist/cjs/SemanticTokenVisitor.js +3 -3
- package/dist/cjs/antlr/CircuitScriptLexer.js +189 -166
- package/dist/cjs/antlr/CircuitScriptParser.js +1139 -622
- package/dist/cjs/draw_symbols.js +6 -0
- package/dist/cjs/execute.js +24 -30
- package/dist/cjs/export.js +91 -5
- package/dist/cjs/globals.js +1 -2
- package/dist/cjs/helpers.js +5 -2
- package/dist/cjs/main.js +21 -9
- package/dist/cjs/objects/ClassComponent.js +1 -0
- package/dist/cjs/render.js +1 -1
- package/dist/cjs/visitor.js +83 -14
- package/dist/esm/BaseVisitor.mjs +9 -11
- package/dist/esm/SemanticTokenVisitor.mjs +3 -3
- package/dist/esm/antlr/CircuitScriptLexer.mjs +189 -166
- package/dist/esm/antlr/CircuitScriptParser.mjs +1132 -619
- package/dist/esm/antlr/CircuitScriptVisitor.mjs +5 -1
- package/dist/esm/draw_symbols.mjs +7 -1
- package/dist/esm/execute.mjs +23 -26
- package/dist/esm/export.mjs +89 -6
- package/dist/esm/globals.mjs +1 -2
- package/dist/esm/helpers.mjs +6 -3
- package/dist/esm/main.mjs +21 -9
- package/dist/esm/objects/ClassComponent.mjs +1 -0
- package/dist/esm/render.mjs +2 -2
- package/dist/esm/visitor.mjs +84 -15
- package/dist/types/BaseVisitor.d.ts +0 -3
- package/dist/types/SemanticTokenVisitor.d.ts +2 -2
- package/dist/types/antlr/CircuitScriptLexer.d.ts +29 -22
- package/dist/types/antlr/CircuitScriptParser.d.ts +97 -29
- package/dist/types/antlr/CircuitScriptVisitor.d.ts +10 -2
- package/dist/types/draw_symbols.d.ts +3 -3
- package/dist/types/execute.d.ts +2 -4
- package/dist/types/export.d.ts +27 -1
- package/dist/types/globals.d.ts +2 -3
- package/dist/types/objects/ClassComponent.d.ts +1 -0
- package/dist/types/visitor.d.ts +5 -2
- package/libs/lib.cst +8 -7
- package/package.json +1 -1
|
@@ -26,30 +26,37 @@ export declare class CircuitScriptParser extends antlr.Parser {
|
|
|
26
26
|
static readonly Define = 22;
|
|
27
27
|
static readonly Import = 23;
|
|
28
28
|
static readonly If = 24;
|
|
29
|
-
static readonly
|
|
30
|
-
static readonly
|
|
31
|
-
static readonly
|
|
32
|
-
static readonly
|
|
33
|
-
static readonly
|
|
34
|
-
static readonly
|
|
35
|
-
static readonly
|
|
36
|
-
static readonly
|
|
37
|
-
static readonly
|
|
38
|
-
static readonly
|
|
39
|
-
static readonly
|
|
40
|
-
static readonly
|
|
41
|
-
static readonly
|
|
42
|
-
static readonly
|
|
43
|
-
static readonly
|
|
44
|
-
static readonly
|
|
45
|
-
static readonly
|
|
46
|
-
static readonly
|
|
47
|
-
static readonly
|
|
48
|
-
static readonly
|
|
49
|
-
static readonly
|
|
50
|
-
static readonly
|
|
51
|
-
static readonly
|
|
52
|
-
static readonly
|
|
29
|
+
static readonly Else = 25;
|
|
30
|
+
static readonly Not = 26;
|
|
31
|
+
static readonly Frame = 27;
|
|
32
|
+
static readonly Equals = 28;
|
|
33
|
+
static readonly NotEquals = 29;
|
|
34
|
+
static readonly GreaterThan = 30;
|
|
35
|
+
static readonly GreatOrEqualThan = 31;
|
|
36
|
+
static readonly LessThan = 32;
|
|
37
|
+
static readonly LessOrEqualThan = 33;
|
|
38
|
+
static readonly LogicalAnd = 34;
|
|
39
|
+
static readonly LogicalOr = 35;
|
|
40
|
+
static readonly Addition = 36;
|
|
41
|
+
static readonly Minus = 37;
|
|
42
|
+
static readonly Divide = 38;
|
|
43
|
+
static readonly Multiply = 39;
|
|
44
|
+
static readonly OPEN_PAREN = 40;
|
|
45
|
+
static readonly CLOSE_PAREN = 41;
|
|
46
|
+
static readonly NOT_CONNECTED = 42;
|
|
47
|
+
static readonly BOOLEAN_VALUE = 43;
|
|
48
|
+
static readonly ID = 44;
|
|
49
|
+
static readonly INTEGER_VALUE = 45;
|
|
50
|
+
static readonly DECIMAL_VALUE = 46;
|
|
51
|
+
static readonly NUMERIC_VALUE = 47;
|
|
52
|
+
static readonly STRING_VALUE = 48;
|
|
53
|
+
static readonly PERCENTAGE_VALUE = 49;
|
|
54
|
+
static readonly ALPHA_NUMERIC = 50;
|
|
55
|
+
static readonly WS = 51;
|
|
56
|
+
static readonly NEWLINE = 52;
|
|
57
|
+
static readonly COMMENT = 53;
|
|
58
|
+
static readonly INDENT = 54;
|
|
59
|
+
static readonly DEDENT = 55;
|
|
53
60
|
static readonly RULE_script = 0;
|
|
54
61
|
static readonly RULE_expression = 1;
|
|
55
62
|
static readonly RULE_path_blocks = 2;
|
|
@@ -92,7 +99,7 @@ export declare class CircuitScriptParser extends antlr.Parser {
|
|
|
92
99
|
static readonly RULE_function_return_expr = 39;
|
|
93
100
|
static readonly RULE_create_component_expr = 40;
|
|
94
101
|
static readonly RULE_create_graphic_expr = 41;
|
|
95
|
-
static readonly
|
|
102
|
+
static readonly RULE_graphic_expr = 42;
|
|
96
103
|
static readonly RULE_property_expr = 43;
|
|
97
104
|
static readonly RULE_property_key_expr = 44;
|
|
98
105
|
static readonly RULE_property_value_expr = 45;
|
|
@@ -102,6 +109,9 @@ export declare class CircuitScriptParser extends antlr.Parser {
|
|
|
102
109
|
static readonly RULE_point_expr = 49;
|
|
103
110
|
static readonly RULE_import_expr = 50;
|
|
104
111
|
static readonly RULE_frame_expr = 51;
|
|
112
|
+
static readonly RULE_if_expr = 52;
|
|
113
|
+
static readonly RULE_if_inner_expr = 53;
|
|
114
|
+
static readonly RULE_else_expr = 54;
|
|
105
115
|
static readonly literalNames: (string | null)[];
|
|
106
116
|
static readonly symbolicNames: (string | null)[];
|
|
107
117
|
static readonly ruleNames: string[];
|
|
@@ -155,7 +165,7 @@ export declare class CircuitScriptParser extends antlr.Parser {
|
|
|
155
165
|
function_return_expr(): Function_return_exprContext;
|
|
156
166
|
create_component_expr(): Create_component_exprContext;
|
|
157
167
|
create_graphic_expr(): Create_graphic_exprContext;
|
|
158
|
-
|
|
168
|
+
graphic_expr(): Graphic_exprContext;
|
|
159
169
|
property_expr(): Property_exprContext;
|
|
160
170
|
property_key_expr(): Property_key_exprContext;
|
|
161
171
|
property_value_expr(): Property_value_exprContext;
|
|
@@ -165,6 +175,9 @@ export declare class CircuitScriptParser extends antlr.Parser {
|
|
|
165
175
|
point_expr(): Point_exprContext;
|
|
166
176
|
import_expr(): Import_exprContext;
|
|
167
177
|
frame_expr(): Frame_exprContext;
|
|
178
|
+
if_expr(): If_exprContext;
|
|
179
|
+
if_inner_expr(): If_inner_exprContext;
|
|
180
|
+
else_expr(): Else_exprContext;
|
|
168
181
|
sempred(localContext: antlr.ParserRuleContext | null, ruleIndex: number, predIndex: number): boolean;
|
|
169
182
|
private data_expr_sempred;
|
|
170
183
|
static readonly _serializedATN: number[];
|
|
@@ -203,6 +216,7 @@ export declare class ExpressionContext extends antlr.ParserRuleContext {
|
|
|
203
216
|
at_block(): At_blockContext | null;
|
|
204
217
|
path_blocks(): Path_blocksContext | null;
|
|
205
218
|
point_expr(): Point_exprContext | null;
|
|
219
|
+
if_expr(): If_exprContext | null;
|
|
206
220
|
get ruleIndex(): number;
|
|
207
221
|
accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
|
|
208
222
|
}
|
|
@@ -456,6 +470,14 @@ export declare class MultiplyExprContext extends Data_exprContext {
|
|
|
456
470
|
Divide(): antlr.TerminalNode | null;
|
|
457
471
|
accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
|
|
458
472
|
}
|
|
473
|
+
export declare class LogicalOperatorExprContext extends Data_exprContext {
|
|
474
|
+
constructor(ctx: Data_exprContext);
|
|
475
|
+
data_expr(): Data_exprContext[];
|
|
476
|
+
data_expr(i: number): Data_exprContext | null;
|
|
477
|
+
LogicalAnd(): antlr.TerminalNode | null;
|
|
478
|
+
LogicalOr(): antlr.TerminalNode | null;
|
|
479
|
+
accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
|
|
480
|
+
}
|
|
459
481
|
export declare class DataExprContext extends Data_exprContext {
|
|
460
482
|
constructor(ctx: Data_exprContext);
|
|
461
483
|
create_component_expr(): Create_component_exprContext | null;
|
|
@@ -492,6 +514,10 @@ export declare class Binary_operatorContext extends antlr.ParserRuleContext {
|
|
|
492
514
|
constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
|
|
493
515
|
Equals(): antlr.TerminalNode | null;
|
|
494
516
|
NotEquals(): antlr.TerminalNode | null;
|
|
517
|
+
GreaterThan(): antlr.TerminalNode | null;
|
|
518
|
+
GreatOrEqualThan(): antlr.TerminalNode | null;
|
|
519
|
+
LessThan(): antlr.TerminalNode | null;
|
|
520
|
+
LessOrEqualThan(): antlr.TerminalNode | null;
|
|
495
521
|
get ruleIndex(): number;
|
|
496
522
|
accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
|
|
497
523
|
}
|
|
@@ -608,12 +634,12 @@ export declare class Create_graphic_exprContext extends antlr.ParserRuleContext
|
|
|
608
634
|
NEWLINE(i: number): antlr.TerminalNode | null;
|
|
609
635
|
INDENT(): antlr.TerminalNode;
|
|
610
636
|
DEDENT(): antlr.TerminalNode;
|
|
611
|
-
|
|
612
|
-
|
|
637
|
+
graphic_expr(): Graphic_exprContext[];
|
|
638
|
+
graphic_expr(i: number): Graphic_exprContext | null;
|
|
613
639
|
get ruleIndex(): number;
|
|
614
640
|
accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
|
|
615
641
|
}
|
|
616
|
-
export declare class
|
|
642
|
+
export declare class Graphic_exprContext extends antlr.ParserRuleContext {
|
|
617
643
|
_command?: Token | null;
|
|
618
644
|
constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
|
|
619
645
|
ID(): antlr.TerminalNode | null;
|
|
@@ -717,3 +743,45 @@ export declare class Frame_exprContext extends antlr.ParserRuleContext {
|
|
|
717
743
|
get ruleIndex(): number;
|
|
718
744
|
accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
|
|
719
745
|
}
|
|
746
|
+
export declare class If_exprContext extends antlr.ParserRuleContext {
|
|
747
|
+
constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
|
|
748
|
+
If(): antlr.TerminalNode;
|
|
749
|
+
data_expr(): Data_exprContext;
|
|
750
|
+
NEWLINE(): antlr.TerminalNode[];
|
|
751
|
+
NEWLINE(i: number): antlr.TerminalNode | null;
|
|
752
|
+
INDENT(): antlr.TerminalNode;
|
|
753
|
+
DEDENT(): antlr.TerminalNode;
|
|
754
|
+
expression(): ExpressionContext[];
|
|
755
|
+
expression(i: number): ExpressionContext | null;
|
|
756
|
+
if_inner_expr(): If_inner_exprContext[];
|
|
757
|
+
if_inner_expr(i: number): If_inner_exprContext | null;
|
|
758
|
+
else_expr(): Else_exprContext | null;
|
|
759
|
+
get ruleIndex(): number;
|
|
760
|
+
accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
|
|
761
|
+
}
|
|
762
|
+
export declare class If_inner_exprContext extends antlr.ParserRuleContext {
|
|
763
|
+
constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
|
|
764
|
+
Else(): antlr.TerminalNode;
|
|
765
|
+
If(): antlr.TerminalNode;
|
|
766
|
+
data_expr(): Data_exprContext;
|
|
767
|
+
NEWLINE(): antlr.TerminalNode[];
|
|
768
|
+
NEWLINE(i: number): antlr.TerminalNode | null;
|
|
769
|
+
INDENT(): antlr.TerminalNode;
|
|
770
|
+
DEDENT(): antlr.TerminalNode;
|
|
771
|
+
expression(): ExpressionContext[];
|
|
772
|
+
expression(i: number): ExpressionContext | null;
|
|
773
|
+
get ruleIndex(): number;
|
|
774
|
+
accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
|
|
775
|
+
}
|
|
776
|
+
export declare class Else_exprContext extends antlr.ParserRuleContext {
|
|
777
|
+
constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
|
|
778
|
+
Else(): antlr.TerminalNode;
|
|
779
|
+
NEWLINE(): antlr.TerminalNode[];
|
|
780
|
+
NEWLINE(i: number): antlr.TerminalNode | null;
|
|
781
|
+
INDENT(): antlr.TerminalNode;
|
|
782
|
+
DEDENT(): antlr.TerminalNode;
|
|
783
|
+
expression(): ExpressionContext[];
|
|
784
|
+
expression(i: number): ExpressionContext | null;
|
|
785
|
+
get ruleIndex(): number;
|
|
786
|
+
accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
|
|
787
|
+
}
|
|
@@ -30,6 +30,7 @@ import { Double_dot_property_set_exprContext } from "./CircuitScriptParser.js";
|
|
|
30
30
|
import { FunctionCallExprContext } from "./CircuitScriptParser.js";
|
|
31
31
|
import { AdditionExprContext } from "./CircuitScriptParser.js";
|
|
32
32
|
import { MultiplyExprContext } from "./CircuitScriptParser.js";
|
|
33
|
+
import { LogicalOperatorExprContext } from "./CircuitScriptParser.js";
|
|
33
34
|
import { DataExprContext } from "./CircuitScriptParser.js";
|
|
34
35
|
import { UnaryOperatorExprContext } from "./CircuitScriptParser.js";
|
|
35
36
|
import { ValueAtomExprContext } from "./CircuitScriptParser.js";
|
|
@@ -48,7 +49,7 @@ import { Net_namespace_exprContext } from "./CircuitScriptParser.js";
|
|
|
48
49
|
import { Function_return_exprContext } from "./CircuitScriptParser.js";
|
|
49
50
|
import { Create_component_exprContext } from "./CircuitScriptParser.js";
|
|
50
51
|
import { Create_graphic_exprContext } from "./CircuitScriptParser.js";
|
|
51
|
-
import {
|
|
52
|
+
import { Graphic_exprContext } from "./CircuitScriptParser.js";
|
|
52
53
|
import { Property_exprContext } from "./CircuitScriptParser.js";
|
|
53
54
|
import { Property_key_exprContext } from "./CircuitScriptParser.js";
|
|
54
55
|
import { Nested_propertiesContext } from "./CircuitScriptParser.js";
|
|
@@ -60,6 +61,9 @@ import { Wire_exprContext } from "./CircuitScriptParser.js";
|
|
|
60
61
|
import { Point_exprContext } from "./CircuitScriptParser.js";
|
|
61
62
|
import { Import_exprContext } from "./CircuitScriptParser.js";
|
|
62
63
|
import { Frame_exprContext } from "./CircuitScriptParser.js";
|
|
64
|
+
import { If_exprContext } from "./CircuitScriptParser.js";
|
|
65
|
+
import { If_inner_exprContext } from "./CircuitScriptParser.js";
|
|
66
|
+
import { Else_exprContext } from "./CircuitScriptParser.js";
|
|
63
67
|
export declare class CircuitScriptVisitor<Result> extends AbstractParseTreeVisitor<Result> {
|
|
64
68
|
visitScript?: (ctx: ScriptContext) => Result;
|
|
65
69
|
visitExpression?: (ctx: ExpressionContext) => Result;
|
|
@@ -92,6 +96,7 @@ export declare class CircuitScriptVisitor<Result> extends AbstractParseTreeVisit
|
|
|
92
96
|
visitFunctionCallExpr?: (ctx: FunctionCallExprContext) => Result;
|
|
93
97
|
visitAdditionExpr?: (ctx: AdditionExprContext) => Result;
|
|
94
98
|
visitMultiplyExpr?: (ctx: MultiplyExprContext) => Result;
|
|
99
|
+
visitLogicalOperatorExpr?: (ctx: LogicalOperatorExprContext) => Result;
|
|
95
100
|
visitDataExpr?: (ctx: DataExprContext) => Result;
|
|
96
101
|
visitUnaryOperatorExpr?: (ctx: UnaryOperatorExprContext) => Result;
|
|
97
102
|
visitValueAtomExpr?: (ctx: ValueAtomExprContext) => Result;
|
|
@@ -110,7 +115,7 @@ export declare class CircuitScriptVisitor<Result> extends AbstractParseTreeVisit
|
|
|
110
115
|
visitFunction_return_expr?: (ctx: Function_return_exprContext) => Result;
|
|
111
116
|
visitCreate_component_expr?: (ctx: Create_component_exprContext) => Result;
|
|
112
117
|
visitCreate_graphic_expr?: (ctx: Create_graphic_exprContext) => Result;
|
|
113
|
-
|
|
118
|
+
visitGraphic_expr?: (ctx: Graphic_exprContext) => Result;
|
|
114
119
|
visitProperty_expr?: (ctx: Property_exprContext) => Result;
|
|
115
120
|
visitProperty_key_expr?: (ctx: Property_key_exprContext) => Result;
|
|
116
121
|
visitNested_properties?: (ctx: Nested_propertiesContext) => Result;
|
|
@@ -122,4 +127,7 @@ export declare class CircuitScriptVisitor<Result> extends AbstractParseTreeVisit
|
|
|
122
127
|
visitPoint_expr?: (ctx: Point_exprContext) => Result;
|
|
123
128
|
visitImport_expr?: (ctx: Import_exprContext) => Result;
|
|
124
129
|
visitFrame_expr?: (ctx: Frame_exprContext) => Result;
|
|
130
|
+
visitIf_expr?: (ctx: If_exprContext) => Result;
|
|
131
|
+
visitIf_inner_expr?: (ctx: If_inner_exprContext) => Result;
|
|
132
|
+
visitElse_expr?: (ctx: Else_exprContext) => Result;
|
|
125
133
|
}
|
|
@@ -136,7 +136,7 @@ export declare class SymbolDrawing {
|
|
|
136
136
|
angle: number;
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
|
-
export type
|
|
139
|
+
export type GraphicExprCommand = [
|
|
140
140
|
commandName: string,
|
|
141
141
|
positionParams: any[],
|
|
142
142
|
keywordParams: Map<string, any>
|
|
@@ -144,8 +144,8 @@ export type SubExpressionCommand = [
|
|
|
144
144
|
export declare class SymbolDrawingCommands extends SymbolDrawing {
|
|
145
145
|
id: string;
|
|
146
146
|
private commands;
|
|
147
|
-
constructor(commands:
|
|
148
|
-
getCommands():
|
|
147
|
+
constructor(commands: GraphicExprCommand[]);
|
|
148
|
+
getCommands(): GraphicExprCommand[];
|
|
149
149
|
clone(): SymbolDrawingCommands;
|
|
150
150
|
}
|
|
151
151
|
type SimplePoint = [x: number, y: number];
|
package/dist/types/execute.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ export declare class ExecutionContext {
|
|
|
36
36
|
display?: string;
|
|
37
37
|
type?: string;
|
|
38
38
|
width?: number;
|
|
39
|
+
copy: boolean;
|
|
39
40
|
}): ClassComponent;
|
|
40
41
|
printPoint(extra?: string): void;
|
|
41
42
|
addComponentExisting(component: ClassComponent, pin: number): ComponentPin;
|
|
@@ -45,7 +46,7 @@ export declare class ExecutionContext {
|
|
|
45
46
|
atComponent(component: ClassComponent, pinId: number | null, options?: {
|
|
46
47
|
addSequence?: boolean;
|
|
47
48
|
}): ComponentPin;
|
|
48
|
-
|
|
49
|
+
copyComponent(component: ClassComponent): ClassComponent;
|
|
49
50
|
enterBlocks(blockType: BlockTypes): void;
|
|
50
51
|
exitBlocks(): void;
|
|
51
52
|
enterBlock(blockIndex: number): void;
|
|
@@ -69,9 +70,6 @@ export declare class ExecutionContext {
|
|
|
69
70
|
enterFrame(): number;
|
|
70
71
|
exitFrame(frameId: number): void;
|
|
71
72
|
}
|
|
72
|
-
export declare function isNetComponent(component: ClassComponent): boolean;
|
|
73
|
-
export declare function isLabelComponent(component: ClassComponent): boolean;
|
|
74
|
-
export declare function isNetOnlyComponent(component: ClassComponent): boolean;
|
|
75
73
|
export declare function getPortSide(pins: Map<number, PinDefinition>, arrangeProps: null | Map<string, number[]>): PortSideItem[];
|
|
76
74
|
type PortSideItem = {
|
|
77
75
|
pinId: number;
|
package/dist/types/export.d.ts
CHANGED
|
@@ -1,2 +1,28 @@
|
|
|
1
1
|
import { NetListItem } from "./visitor.js";
|
|
2
|
-
export declare function generateKiCADNetList(netlist: NetListItem[]):
|
|
2
|
+
export declare function generateKiCADNetList(netlist: NetListItem[]): {
|
|
3
|
+
tree: SExp;
|
|
4
|
+
missingFootprints: {
|
|
5
|
+
refdes: string;
|
|
6
|
+
instanceName: string;
|
|
7
|
+
}[];
|
|
8
|
+
};
|
|
9
|
+
export declare function printTree(tree: (IdObject | string)[] | string, level?: number): string;
|
|
10
|
+
export declare class IdObject {
|
|
11
|
+
keyName: string;
|
|
12
|
+
constructor(keyName: string);
|
|
13
|
+
}
|
|
14
|
+
export declare function _id(key: string): IdObject;
|
|
15
|
+
export declare class SExpObject {
|
|
16
|
+
object: SExp;
|
|
17
|
+
constructor(object: SExp);
|
|
18
|
+
getKey(object?: SExp | null): IdObject;
|
|
19
|
+
getValue(object?: SExp | null): any;
|
|
20
|
+
getJSON(object?: SExp | null): {
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
};
|
|
23
|
+
getWithId(id: string, object?: SExp | null): SExp | null;
|
|
24
|
+
print(): void;
|
|
25
|
+
}
|
|
26
|
+
export type SExpString = [id: IdObject, string];
|
|
27
|
+
export type SExpNested = [id: IdObject, SExp];
|
|
28
|
+
export type SExp = [id: IdObject, ...(SExpString | SExpNested)[]];
|
package/dist/types/globals.d.ts
CHANGED
|
@@ -8,8 +8,6 @@ export declare enum GlobalNames {
|
|
|
8
8
|
}
|
|
9
9
|
export declare const NoNetText = "NO_NET";
|
|
10
10
|
export declare enum ParamKeys {
|
|
11
|
-
__is_net = "__is_net",
|
|
12
|
-
__is_label = "__is_label",
|
|
13
11
|
priority = "priority",
|
|
14
12
|
net_name = "net_name"
|
|
15
13
|
}
|
|
@@ -40,7 +38,8 @@ export declare enum ReferenceTypes {
|
|
|
40
38
|
function = "function",
|
|
41
39
|
value = "value",
|
|
42
40
|
variable = "variable",
|
|
43
|
-
instance = "instance"
|
|
41
|
+
instance = "instance",
|
|
42
|
+
pinType = "pinType"
|
|
44
43
|
}
|
|
45
44
|
export declare enum BlockTypes {
|
|
46
45
|
Branch = 1,
|
package/dist/types/visitor.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Add_component_exprContext, AdditionExprContext, At_blockContext, At_block_pin_exprContext, At_block_pin_expression_complexContext, At_block_pin_expression_simpleContext, At_component_exprContext, BinaryOperatorExprContext, Path_blocksContext, Component_select_exprContext, Create_component_exprContext, Create_graphic_exprContext, DataExprContext, Data_expr_with_assignmentContext, Double_dot_property_set_exprContext, Frame_exprContext, Function_def_exprContext, Keyword_assignment_exprContext, MultiplyExprContext, Nested_propertiesContext, Net_namespace_exprContext, Pin_select_expr2Context, Pin_select_exprContext, Point_exprContext, Property_exprContext, Property_key_exprContext, Property_set_exprContext, Single_line_propertyContext,
|
|
1
|
+
import { Add_component_exprContext, AdditionExprContext, At_blockContext, At_block_pin_exprContext, At_block_pin_expression_complexContext, At_block_pin_expression_simpleContext, At_component_exprContext, BinaryOperatorExprContext, Path_blocksContext, Component_select_exprContext, Create_component_exprContext, Create_graphic_exprContext, DataExprContext, Data_expr_with_assignmentContext, Double_dot_property_set_exprContext, Frame_exprContext, Function_def_exprContext, Keyword_assignment_exprContext, MultiplyExprContext, Nested_propertiesContext, Net_namespace_exprContext, Pin_select_expr2Context, Pin_select_exprContext, Point_exprContext, Property_exprContext, Property_key_exprContext, Property_set_exprContext, Single_line_propertyContext, To_component_exprContext, Wire_exprContext, UnaryOperatorExprContext, Wire_expr_direction_onlyContext, Wire_expr_direction_valueContext, Graphic_exprContext, If_exprContext, If_inner_exprContext, LogicalOperatorExprContext } from './antlr/CircuitScriptParser.js';
|
|
2
2
|
import { ClassComponent } from './objects/ClassComponent.js';
|
|
3
3
|
import { PinTypes } from './objects/PinTypes.js';
|
|
4
4
|
import { ComponentPin, ComponentPinNet } from './objects/types.js';
|
|
@@ -15,7 +15,7 @@ export declare class ParserVisitor extends BaseVisitor {
|
|
|
15
15
|
visitPath_blocks: (ctx: Path_blocksContext) => ComponentPin;
|
|
16
16
|
visitCreate_component_expr: (ctx: Create_component_exprContext) => void;
|
|
17
17
|
visitCreate_graphic_expr: (ctx: Create_graphic_exprContext) => void;
|
|
18
|
-
|
|
18
|
+
visitGraphic_expr: (ctx: Graphic_exprContext) => void;
|
|
19
19
|
visitProperty_expr: (ctx: Property_exprContext) => void;
|
|
20
20
|
visitSingle_line_property: (ctx: Single_line_propertyContext) => void;
|
|
21
21
|
visitNested_properties: (ctx: Nested_propertiesContext) => void;
|
|
@@ -24,6 +24,7 @@ export declare class ParserVisitor extends BaseVisitor {
|
|
|
24
24
|
visitUnaryOperatorExpr: (ctx: UnaryOperatorExprContext) => void;
|
|
25
25
|
visitDataExpr: (ctx: DataExprContext) => void;
|
|
26
26
|
visitBinaryOperatorExpr: (ctx: BinaryOperatorExprContext) => void;
|
|
27
|
+
visitLogicalOperatorExpr: (ctx: LogicalOperatorExprContext) => void;
|
|
27
28
|
visitMultiplyExpr: (ctx: MultiplyExprContext) => void;
|
|
28
29
|
visitAdditionExpr: (ctx: AdditionExprContext) => void;
|
|
29
30
|
visitFunction_def_expr: (ctx: Function_def_exprContext) => void;
|
|
@@ -40,6 +41,8 @@ export declare class ParserVisitor extends BaseVisitor {
|
|
|
40
41
|
visitDouble_dot_property_set_expr: (ctx: Double_dot_property_set_exprContext) => void;
|
|
41
42
|
visitFrame_expr: (ctx: Frame_exprContext) => void;
|
|
42
43
|
visitNet_namespace_expr: (ctx: Net_namespace_exprContext) => void;
|
|
44
|
+
visitIf_expr: (ctx: If_exprContext) => void;
|
|
45
|
+
visitIf_inner_expr: (ctx: If_inner_exprContext) => void;
|
|
43
46
|
pinTypes: PinTypes[];
|
|
44
47
|
private parseCreateComponentPins;
|
|
45
48
|
private parseCreateComponentParams;
|
package/libs/lib.cst
CHANGED
|
@@ -1,38 +1,40 @@
|
|
|
1
|
+
# Circuitscript default lib
|
|
2
|
+
|
|
1
3
|
def net(net_name):
|
|
2
4
|
return create component:
|
|
3
5
|
pins: 1
|
|
6
|
+
copy: true
|
|
4
7
|
display: create graphic:
|
|
5
8
|
hline: -15, 0, 30
|
|
6
9
|
vpin: 1, 0, 10, -10, display_pin_id=0
|
|
7
10
|
label: "net_name", 0, -5, net_name, fontSize=10, anchor="middle"
|
|
8
11
|
type: "net"
|
|
9
12
|
params:
|
|
10
|
-
__is_net: 1
|
|
11
13
|
net_name: net_name
|
|
12
14
|
priority: 10
|
|
13
15
|
|
|
14
16
|
def supply(net_name):
|
|
15
17
|
return create component:
|
|
16
18
|
pins: 1
|
|
19
|
+
copy: true
|
|
17
20
|
display: create graphic:
|
|
18
21
|
hline: -15, 0, 30
|
|
19
22
|
vpin: 1, 0, 10, -10, display_pin_id=0
|
|
20
23
|
label: "net_name", 0, -5, net_name, fontSize=10, anchor="middle"
|
|
21
24
|
type: "net"
|
|
22
25
|
params:
|
|
23
|
-
__is_net: 1
|
|
24
26
|
net_name: net_name
|
|
25
27
|
priority: 20
|
|
26
28
|
|
|
27
29
|
def label(value):
|
|
28
30
|
return create component:
|
|
29
31
|
pins: 1
|
|
32
|
+
copy: true
|
|
30
33
|
display: create graphic:
|
|
31
34
|
label: "value", 0, -2, "?", fontSize=10, anchor="left"
|
|
32
35
|
pin: 1, 0, 0, 0, 0, display_pin_id=0
|
|
33
36
|
type: "label"
|
|
34
37
|
params:
|
|
35
|
-
__is_net: 1
|
|
36
38
|
net_name: value
|
|
37
39
|
value: value
|
|
38
40
|
priority: 5
|
|
@@ -136,6 +138,7 @@ def cgnd():
|
|
|
136
138
|
net_name = "gnd"
|
|
137
139
|
return create component:
|
|
138
140
|
pins: 1
|
|
141
|
+
copy: true
|
|
139
142
|
display: create graphic:
|
|
140
143
|
hline: -15, 0, 30
|
|
141
144
|
hline: -10, 5, 20
|
|
@@ -144,24 +147,22 @@ def cgnd():
|
|
|
144
147
|
label: "net_name", 0, 22, net_name, fontSize=10, anchor="middle"
|
|
145
148
|
type: "net"
|
|
146
149
|
params:
|
|
147
|
-
__is_net: 1
|
|
148
150
|
net_name: net_name
|
|
149
151
|
priority: 100
|
|
150
152
|
|
|
151
|
-
def dgnd():
|
|
153
|
+
def dgnd(net_name="GND"):
|
|
152
154
|
height = 10
|
|
153
155
|
width = 20
|
|
154
156
|
|
|
155
|
-
net_name = "GND"
|
|
156
157
|
return create component:
|
|
157
158
|
pins: 1
|
|
159
|
+
copy: true
|
|
158
160
|
display: create graphic:
|
|
159
161
|
triangle: 0, 0, 0, height, width
|
|
160
162
|
vpin: 1, 0, -10, 10, display_pin_id=0
|
|
161
163
|
label: "net_name", 0, height + 10, net_name, fontSize=10, anchor="middle"
|
|
162
164
|
type: "net"
|
|
163
165
|
params:
|
|
164
|
-
__is_net: 1
|
|
165
166
|
net_name: net_name
|
|
166
167
|
priority: 100
|
|
167
168
|
|