circuitscript 0.0.24 → 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 +485 -0
- package/dist/cjs/SemanticTokenVisitor.js +218 -0
- package/dist/cjs/SymbolValidatorVisitor.js +233 -0
- package/dist/cjs/antlr/CircuitScriptLexer.js +256 -219
- package/dist/cjs/antlr/CircuitScriptParser.js +2891 -2151
- package/dist/cjs/antlr/CircuitScriptVisitor.js +4 -3
- package/dist/cjs/draw_symbols.js +73 -22
- package/dist/cjs/execute.js +70 -78
- package/dist/cjs/export.js +91 -5
- package/dist/cjs/geometry.js +28 -8
- package/dist/cjs/globals.js +1 -2
- package/dist/cjs/helpers.js +180 -7
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/layout.js +8 -0
- package/dist/cjs/lexer.js +19 -22
- package/dist/cjs/main.js +27 -20
- package/dist/cjs/objects/ClassComponent.js +4 -0
- package/dist/cjs/objects/ExecutionScope.js +1 -0
- package/dist/cjs/objects/types.js +7 -1
- package/dist/cjs/parser.js +29 -258
- package/dist/cjs/render.js +1 -1
- package/dist/cjs/validate.js +81 -0
- package/dist/cjs/visitor.js +601 -823
- package/dist/esm/BaseVisitor.mjs +486 -0
- package/dist/esm/SemanticTokenVisitor.mjs +215 -0
- package/dist/esm/SymbolValidatorVisitor.mjs +222 -0
- package/dist/esm/antlr/CircuitScriptLexer.mjs +231 -218
- package/dist/esm/antlr/CircuitScriptParser.mjs +2852 -2144
- package/dist/esm/antlr/CircuitScriptVisitor.mjs +13 -4
- package/dist/esm/draw_symbols.mjs +74 -23
- package/dist/esm/execute.mjs +70 -75
- package/dist/esm/export.mjs +89 -6
- package/dist/esm/geometry.mjs +28 -8
- package/dist/esm/globals.mjs +1 -2
- package/dist/esm/helpers.mjs +171 -9
- package/dist/esm/index.mjs +2 -0
- package/dist/esm/layout.mjs +8 -0
- package/dist/esm/lexer.mjs +10 -10
- package/dist/esm/main.mjs +28 -21
- package/dist/esm/objects/ClassComponent.mjs +4 -0
- package/dist/esm/objects/ExecutionScope.mjs +1 -0
- package/dist/esm/objects/types.mjs +6 -0
- package/dist/esm/parser.mjs +25 -230
- package/dist/esm/render.mjs +2 -2
- package/dist/esm/validate.mjs +74 -0
- package/dist/esm/visitor.mjs +415 -643
- package/dist/types/BaseVisitor.d.ts +66 -0
- package/dist/types/SemanticTokenVisitor.d.ts +36 -0
- package/dist/types/SymbolValidatorVisitor.d.ts +61 -0
- package/dist/types/antlr/CircuitScriptLexer.d.ts +37 -29
- package/dist/types/antlr/CircuitScriptParser.d.ts +606 -494
- package/dist/types/antlr/CircuitScriptVisitor.d.ts +78 -60
- package/dist/types/draw_symbols.d.ts +12 -3
- package/dist/types/execute.d.ts +5 -10
- package/dist/types/export.d.ts +27 -1
- package/dist/types/geometry.d.ts +4 -0
- package/dist/types/globals.d.ts +2 -3
- package/dist/types/helpers.d.ts +32 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/lexer.d.ts +2 -2
- package/dist/types/objects/ClassComponent.d.ts +1 -0
- package/dist/types/objects/ExecutionScope.d.ts +4 -1
- package/dist/types/objects/types.d.ts +5 -0
- package/dist/types/parser.d.ts +15 -28
- package/dist/types/validate.d.ts +2 -0
- package/dist/types/visitor.d.ts +43 -95
- package/fonts/Inter-Bold.ttf +0 -0
- package/fonts/Inter-Regular.ttf +0 -0
- package/fonts/OpenSans-Regular.ttf +0 -0
- package/fonts/Roboto-Regular.ttf +0 -0
- package/libs/lib.cst +184 -0
- package/package.json +11 -6
package/dist/types/visitor.d.ts
CHANGED
|
@@ -1,101 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Add_component_exprContext, AdditionExprContext, Assignment_exprContext, At_blockContext, At_block_pin_exprContext, At_block_pin_expression_complexContext, At_block_pin_expression_simpleContext, At_component_exprContext, Atom_exprContext, BinaryOperatorExprContext, Blank_exprContext, Path_blocksContext, Component_select_exprContext, Create_component_exprContext, Create_graphic_exprContext, DataExprContext, Data_expr_with_assignmentContext, Double_dot_property_set_exprContext, Frame_exprContext, Function_args_exprContext, Function_def_exprContext, Function_return_exprContext, Import_exprContext, Keyword_assignment_exprContext, MultiplyExprContext, Nested_propertiesContext, Net_namespace_exprContext, ParametersContext, Pin_select_expr2Context, Pin_select_exprContext, Point_exprContext, Property_exprContext, Property_key_exprContext, Property_set_exprContext, RoundedBracketsExprContext, ScriptContext, Single_line_propertyContext, Sub_exprContext, To_component_exprContext, Value_exprContext, Wire_exprContext, ValueAtomExprContext, UnaryOperatorExprContext } from './antlr/CircuitScriptParser.js';
|
|
3
|
-
import { ExecutionContext } from './execute.js';
|
|
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';
|
|
4
2
|
import { ClassComponent } from './objects/ClassComponent.js';
|
|
5
|
-
import { PinBlankValue } from './objects/ParamDefinition.js';
|
|
6
3
|
import { PinTypes } from './objects/PinTypes.js';
|
|
7
|
-
import {
|
|
8
|
-
import { Logger } from './logger.js';
|
|
4
|
+
import { ComponentPin, ComponentPinNet } from './objects/types.js';
|
|
9
5
|
import { Net } from './objects/Net.js';
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
parameters: CallableParameter[]
|
|
51
|
-
];
|
|
52
|
-
visitProperty_expr(ctx: Property_exprContext): Map<string, any>;
|
|
53
|
-
visitSingle_line_property(ctx: Single_line_propertyContext): any | any[];
|
|
54
|
-
visitNested_properties(ctx: Nested_propertiesContext): Map<string, any>;
|
|
55
|
-
visitProperty_key_expr(ctx: Property_key_exprContext): string | number;
|
|
56
|
-
visitData_expr_with_assignment(ctx: Data_expr_with_assignmentContext): [
|
|
57
|
-
component: ComplexType,
|
|
58
|
-
pin: string | number | null
|
|
59
|
-
];
|
|
60
|
-
visitValueAtomExpr(ctx: ValueAtomExprContext): ComplexType;
|
|
61
|
-
visitUnaryOperatorExpr(ctx: UnaryOperatorExprContext): ComplexType;
|
|
62
|
-
visitDataExpr(ctx: DataExprContext): ComplexType;
|
|
63
|
-
visitBinaryOperatorExpr(ctx: BinaryOperatorExprContext): boolean | number;
|
|
64
|
-
visitMultiplyExpr(ctx: MultiplyExprContext): number;
|
|
65
|
-
visitAdditionExpr(ctx: AdditionExprContext): number;
|
|
66
|
-
visitFunction_args_expr(ctx: Function_args_exprContext): FunctionDefinedParameter[];
|
|
67
|
-
createNetResolver(executionStack: ExecutionContext[]): (netName: string, netNamespace: string) => {
|
|
68
|
-
found: boolean;
|
|
69
|
-
net?: Net;
|
|
70
|
-
};
|
|
71
|
-
visitFunction_def_expr(ctx: Function_def_exprContext): void;
|
|
72
|
-
private setupDefinedParameters;
|
|
73
|
-
visitFunction_return_expr(ctx: Function_return_exprContext): ComplexType;
|
|
74
|
-
visitAtom_expr(ctx: Atom_exprContext): ReferenceType;
|
|
75
|
-
visitPin_select_expr2(ctx: Pin_select_expr2Context): string | number;
|
|
76
|
-
visitAt_block_pin_expr(ctx: At_block_pin_exprContext): ComponentPin;
|
|
77
|
-
visitAt_block(ctx: At_blockContext): ComponentPin;
|
|
78
|
-
visitAt_block_pin_expression_simple(ctx: At_block_pin_expression_simpleContext): void;
|
|
79
|
-
visitAt_block_pin_expression_complex(ctx: At_block_pin_expression_complexContext): ComponentPin;
|
|
80
|
-
visitWire_expr(ctx: Wire_exprContext): void;
|
|
81
|
-
visitPoint_expr(ctx: Point_exprContext): ComponentPin;
|
|
82
|
-
visitImport_expr(ctx: Import_exprContext): void;
|
|
83
|
-
visitProperty_set_expr(ctx: Property_set_exprContext): void;
|
|
84
|
-
visitDouble_dot_property_set_expr(ctx: Double_dot_property_set_exprContext): void;
|
|
85
|
-
visitRoundedBracketsExpr(ctx: RoundedBracketsExprContext): any;
|
|
86
|
-
visitFrame_expr(ctx: Frame_exprContext): void;
|
|
87
|
-
visitNet_namespace_expr(ctx: Net_namespace_exprContext): string;
|
|
6
|
+
import { BaseVisitor } from './BaseVisitor.js';
|
|
7
|
+
import { ParserRuleContext } from 'antlr4ng';
|
|
8
|
+
export declare class ParserVisitor extends BaseVisitor {
|
|
9
|
+
visitKeyword_assignment_expr: (ctx: Keyword_assignment_exprContext) => void;
|
|
10
|
+
visitPin_select_expr: (ctx: Pin_select_exprContext) => void;
|
|
11
|
+
visitAdd_component_expr: (ctx: Add_component_exprContext) => ComponentPin;
|
|
12
|
+
visitAt_component_expr: (ctx: At_component_exprContext) => ComponentPin;
|
|
13
|
+
visitTo_component_expr: (ctx: To_component_exprContext) => ComponentPin;
|
|
14
|
+
visitComponent_select_expr: (ctx: Component_select_exprContext) => void;
|
|
15
|
+
visitPath_blocks: (ctx: Path_blocksContext) => ComponentPin;
|
|
16
|
+
visitCreate_component_expr: (ctx: Create_component_exprContext) => void;
|
|
17
|
+
visitCreate_graphic_expr: (ctx: Create_graphic_exprContext) => void;
|
|
18
|
+
visitGraphic_expr: (ctx: Graphic_exprContext) => void;
|
|
19
|
+
visitProperty_expr: (ctx: Property_exprContext) => void;
|
|
20
|
+
visitSingle_line_property: (ctx: Single_line_propertyContext) => void;
|
|
21
|
+
visitNested_properties: (ctx: Nested_propertiesContext) => void;
|
|
22
|
+
visitProperty_key_expr: (ctx: Property_key_exprContext) => void;
|
|
23
|
+
visitData_expr_with_assignment: (ctx: Data_expr_with_assignmentContext) => void;
|
|
24
|
+
visitUnaryOperatorExpr: (ctx: UnaryOperatorExprContext) => void;
|
|
25
|
+
visitDataExpr: (ctx: DataExprContext) => void;
|
|
26
|
+
visitBinaryOperatorExpr: (ctx: BinaryOperatorExprContext) => void;
|
|
27
|
+
visitLogicalOperatorExpr: (ctx: LogicalOperatorExprContext) => void;
|
|
28
|
+
visitMultiplyExpr: (ctx: MultiplyExprContext) => void;
|
|
29
|
+
visitAdditionExpr: (ctx: AdditionExprContext) => void;
|
|
30
|
+
visitFunction_def_expr: (ctx: Function_def_exprContext) => void;
|
|
31
|
+
visitPin_select_expr2: (ctx: Pin_select_expr2Context) => void;
|
|
32
|
+
visitAt_block_pin_expr: (ctx: At_block_pin_exprContext) => void;
|
|
33
|
+
visitAt_block: (ctx: At_blockContext) => void;
|
|
34
|
+
visitAt_block_pin_expression_simple: (ctx: At_block_pin_expression_simpleContext) => void;
|
|
35
|
+
visitAt_block_pin_expression_complex: (ctx: At_block_pin_expression_complexContext) => void;
|
|
36
|
+
visitWire_expr_direction_only: (ctx: Wire_expr_direction_onlyContext) => void;
|
|
37
|
+
visitWire_expr_direction_value: (ctx: Wire_expr_direction_valueContext) => void;
|
|
38
|
+
visitWire_expr: (ctx: Wire_exprContext) => void;
|
|
39
|
+
visitPoint_expr: (ctx: Point_exprContext) => ComponentPin;
|
|
40
|
+
visitProperty_set_expr: (ctx: Property_set_exprContext) => void;
|
|
41
|
+
visitDouble_dot_property_set_expr: (ctx: Double_dot_property_set_exprContext) => void;
|
|
42
|
+
visitFrame_expr: (ctx: Frame_exprContext) => void;
|
|
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;
|
|
88
46
|
pinTypes: PinTypes[];
|
|
89
|
-
createImportFileHandler(directory: string, defaultLibsPath: string): ((visitor: MainVisitor, importPath: string) => {
|
|
90
|
-
hasError: boolean;
|
|
91
|
-
hasParseError: boolean;
|
|
92
|
-
pathExists: boolean;
|
|
93
|
-
});
|
|
94
|
-
private importLib;
|
|
95
47
|
private parseCreateComponentPins;
|
|
96
48
|
private parseCreateComponentParams;
|
|
97
|
-
private prepareStringValue;
|
|
98
|
-
print(...params: any[]): void;
|
|
99
49
|
printNets(): void;
|
|
100
50
|
dumpNets(): ComponentPinNet[];
|
|
101
51
|
dumpUniqueNets(): Net[];
|
|
@@ -115,10 +65,8 @@ export declare class MainVisitor extends ParseTreeVisitor<any> {
|
|
|
115
65
|
annotateComponents(): void;
|
|
116
66
|
private resolveNets;
|
|
117
67
|
private setComponentOrientation;
|
|
68
|
+
private setComponentFlip;
|
|
118
69
|
private getPropertyExprList;
|
|
119
|
-
private runExpressions;
|
|
120
|
-
private setupPrintFunction;
|
|
121
|
-
private getNetNamespace;
|
|
122
70
|
}
|
|
123
71
|
export type NetListItem = {
|
|
124
72
|
instanceName: string;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/libs/lib.cst
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# Circuitscript default lib
|
|
2
|
+
|
|
3
|
+
def net(net_name):
|
|
4
|
+
return create component:
|
|
5
|
+
pins: 1
|
|
6
|
+
copy: true
|
|
7
|
+
display: create graphic:
|
|
8
|
+
hline: -15, 0, 30
|
|
9
|
+
vpin: 1, 0, 10, -10, display_pin_id=0
|
|
10
|
+
label: "net_name", 0, -5, net_name, fontSize=10, anchor="middle"
|
|
11
|
+
type: "net"
|
|
12
|
+
params:
|
|
13
|
+
net_name: net_name
|
|
14
|
+
priority: 10
|
|
15
|
+
|
|
16
|
+
def supply(net_name):
|
|
17
|
+
return create component:
|
|
18
|
+
pins: 1
|
|
19
|
+
copy: true
|
|
20
|
+
display: create graphic:
|
|
21
|
+
hline: -15, 0, 30
|
|
22
|
+
vpin: 1, 0, 10, -10, display_pin_id=0
|
|
23
|
+
label: "net_name", 0, -5, net_name, fontSize=10, anchor="middle"
|
|
24
|
+
type: "net"
|
|
25
|
+
params:
|
|
26
|
+
net_name: net_name
|
|
27
|
+
priority: 20
|
|
28
|
+
|
|
29
|
+
def label(value):
|
|
30
|
+
return create component:
|
|
31
|
+
pins: 1
|
|
32
|
+
copy: true
|
|
33
|
+
display: create graphic:
|
|
34
|
+
label: "value", 0, -2, "?", fontSize=10, anchor="left"
|
|
35
|
+
pin: 1, 0, 0, 0, 0, display_pin_id=0
|
|
36
|
+
type: "label"
|
|
37
|
+
params:
|
|
38
|
+
net_name: value
|
|
39
|
+
value: value
|
|
40
|
+
priority: 5
|
|
41
|
+
|
|
42
|
+
def res(value):
|
|
43
|
+
width = 40
|
|
44
|
+
height = 20
|
|
45
|
+
|
|
46
|
+
return create component:
|
|
47
|
+
pins: 2
|
|
48
|
+
display: create graphic:
|
|
49
|
+
rect: 0, 0, width, height
|
|
50
|
+
hpin: 1, -width/2 - 20, 0, 20
|
|
51
|
+
hpin: 2, width/2 + 20, 0, -20
|
|
52
|
+
label: ("value", 0, 1, value, fontSize=10, anchor="middle", vanchor="middle")
|
|
53
|
+
label: ("refdes", -width/2, -height/2 -5 , "?", fontSize=10, anchor="left")
|
|
54
|
+
type: "res"
|
|
55
|
+
params:
|
|
56
|
+
value: value
|
|
57
|
+
size: "0402"
|
|
58
|
+
footprint: "Resistor_SMD:R_0402_1005Metric"
|
|
59
|
+
|
|
60
|
+
def cap(value):
|
|
61
|
+
width = 20
|
|
62
|
+
height = 40
|
|
63
|
+
|
|
64
|
+
return create component:
|
|
65
|
+
pins: 2
|
|
66
|
+
display: create graphic:
|
|
67
|
+
hline: -width/2, -3, width
|
|
68
|
+
hline: -width/2, 3, width
|
|
69
|
+
vpin: 1, 0, -height/2, 20-3
|
|
70
|
+
vpin: 2, 0, height/2, -20+3
|
|
71
|
+
label: "refdes", width/2+2, 0, "?", fontSize = 10, anchor="left"
|
|
72
|
+
label: "value", width/2+2, 5, value, fontSize = 10, anchor = "left", vanchor="top"
|
|
73
|
+
type: "cap"
|
|
74
|
+
params:
|
|
75
|
+
value: value
|
|
76
|
+
size: "0402"
|
|
77
|
+
footprint: "Capacitor_SMD:C_0402_1005Metric"
|
|
78
|
+
|
|
79
|
+
def ind(value):
|
|
80
|
+
width = 40
|
|
81
|
+
height = 20
|
|
82
|
+
|
|
83
|
+
return create component:
|
|
84
|
+
pins: 2
|
|
85
|
+
type: "ind"
|
|
86
|
+
display: create graphic:
|
|
87
|
+
arc: -15, 0, 5, 180, 360
|
|
88
|
+
arc: -5, 0, 5, 180, 360
|
|
89
|
+
arc: 5, 0, 5, 180, 360
|
|
90
|
+
arc: 15, 0, 5, 180, 360
|
|
91
|
+
hpin: 1, -width/2 - 20, 0, 20
|
|
92
|
+
hpin: 2, width/2 + 20, 0, -20
|
|
93
|
+
label: ("value", 0, 10, value, fontSize=10, anchor="middle", vanchor="middle")
|
|
94
|
+
label: ("refdes", -width/2, -height/2 -5 , "?", fontSize=10, anchor="left")
|
|
95
|
+
params:
|
|
96
|
+
value: value
|
|
97
|
+
|
|
98
|
+
def diode():
|
|
99
|
+
width = 20
|
|
100
|
+
height = 20
|
|
101
|
+
|
|
102
|
+
# Diode is drawn horizontally
|
|
103
|
+
# -|>|-
|
|
104
|
+
return create component:
|
|
105
|
+
pins: 2
|
|
106
|
+
type: "diode"
|
|
107
|
+
display: create graphic:
|
|
108
|
+
triangle: -width/2, 0, width/2, 0, height
|
|
109
|
+
vline: width/2, -height/2, height
|
|
110
|
+
hpin: 1, -width/2-20, 0, 20 # anode
|
|
111
|
+
hpin: 2, width/2 + 20, 0, -20 # cathode
|
|
112
|
+
label: "refdes", width/2 + 5, 5, "?", fontSize=10, anchor="left", vanchor="top"
|
|
113
|
+
|
|
114
|
+
def led(color):
|
|
115
|
+
width = 20
|
|
116
|
+
height = 20
|
|
117
|
+
|
|
118
|
+
return create component:
|
|
119
|
+
pins:
|
|
120
|
+
1: "cathode"
|
|
121
|
+
2: "anode"
|
|
122
|
+
type: "diode"
|
|
123
|
+
display: create graphic:
|
|
124
|
+
triangle: -width/2, 0, width/2, 0, height
|
|
125
|
+
vline: width/2, -height/2, height
|
|
126
|
+
path: ("M", 0, 8, "L", 5, 18,
|
|
127
|
+
"M", 3, 8, "L", 8, 18)
|
|
128
|
+
hpin: 1, -width/2-20, 0, 20 # anode
|
|
129
|
+
hpin: 2, width/2 + 20, 0, -20 # cathode
|
|
130
|
+
label: "refdes", width/2 + 5, 5, "?", fontSize=10, anchor="left", vanchor="top"
|
|
131
|
+
label: "color", width/2 + 5, 25, color
|
|
132
|
+
params:
|
|
133
|
+
size: "0603"
|
|
134
|
+
footprint: "LED_SMD:LED_0603_1608Metric_Pad1.05x0.95mm_HandSolder"
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def cgnd():
|
|
138
|
+
net_name = "gnd"
|
|
139
|
+
return create component:
|
|
140
|
+
pins: 1
|
|
141
|
+
copy: true
|
|
142
|
+
display: create graphic:
|
|
143
|
+
hline: -15, 0, 30
|
|
144
|
+
hline: -10, 5, 20
|
|
145
|
+
hline: -5, 10, 10
|
|
146
|
+
vpin: 1, 0, -10, 10, display_pin_id=0
|
|
147
|
+
label: "net_name", 0, 22, net_name, fontSize=10, anchor="middle"
|
|
148
|
+
type: "net"
|
|
149
|
+
params:
|
|
150
|
+
net_name: net_name
|
|
151
|
+
priority: 100
|
|
152
|
+
|
|
153
|
+
def dgnd(net_name="GND"):
|
|
154
|
+
height = 10
|
|
155
|
+
width = 20
|
|
156
|
+
|
|
157
|
+
return create component:
|
|
158
|
+
pins: 1
|
|
159
|
+
copy: true
|
|
160
|
+
display: create graphic:
|
|
161
|
+
triangle: 0, 0, 0, height, width
|
|
162
|
+
vpin: 1, 0, -10, 10, display_pin_id=0
|
|
163
|
+
label: "net_name", 0, height + 10, net_name, fontSize=10, anchor="middle"
|
|
164
|
+
type: "net"
|
|
165
|
+
params:
|
|
166
|
+
net_name: net_name
|
|
167
|
+
priority: 100
|
|
168
|
+
|
|
169
|
+
def marker_point():
|
|
170
|
+
return create component:
|
|
171
|
+
pins: 1
|
|
172
|
+
display: create graphic:
|
|
173
|
+
hline: -5, 0, 10
|
|
174
|
+
vline: 0, -5, 10
|
|
175
|
+
pin: 1, 0, 0, 0, 0, display_pin_id=0
|
|
176
|
+
type: "net"
|
|
177
|
+
|
|
178
|
+
def arrow_point():
|
|
179
|
+
return create component:
|
|
180
|
+
pins: 1
|
|
181
|
+
display: create graphic:
|
|
182
|
+
path: ("M", 15, -5, "L", 20, 0, "L", 15, 5)
|
|
183
|
+
hpin: 1, 0, 0, 20
|
|
184
|
+
type: "net"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "circuitscript",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"description": "Interpreter for the circuitscript language",
|
|
5
5
|
"homepage": "https://circuitscript.net",
|
|
6
6
|
"engines": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"module": "./dist/esm/index.mjs",
|
|
11
11
|
"types": "./dist/types/index.d.ts",
|
|
12
12
|
"bin": {
|
|
13
|
-
"circuitscript": "./dist/
|
|
13
|
+
"circuitscript": "./dist/cjs/main.js"
|
|
14
14
|
},
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|
|
@@ -19,7 +19,9 @@
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
|
-
"dist"
|
|
22
|
+
"dist",
|
|
23
|
+
"fonts",
|
|
24
|
+
"libs"
|
|
23
25
|
],
|
|
24
26
|
"devDependencies": {
|
|
25
27
|
"@types/figlet": "^1.5.8",
|
|
@@ -28,6 +30,7 @@
|
|
|
28
30
|
"@types/svgdom": "^0.1.2",
|
|
29
31
|
"@typescript-eslint/eslint-plugin": "~5.59",
|
|
30
32
|
"@typescript-eslint/parser": "~5.59",
|
|
33
|
+
"antlr4ng-cli": "^2.0.0",
|
|
31
34
|
"eslint": "~8.38",
|
|
32
35
|
"eslint-config-prettier": "~8.8",
|
|
33
36
|
"eslint-plugin-jest": "~27.2",
|
|
@@ -59,9 +62,11 @@
|
|
|
59
62
|
"prettier": "prettier --config .prettierrc --write .",
|
|
60
63
|
"test:watch": "jest --watch",
|
|
61
64
|
"antlr": "antlr4 -Dlanguage=TypeScript ./src/antlr/CircuitScript.g4 -no-listener -visitor",
|
|
65
|
+
"antlr4ng": "npx antlr4ng -Dlanguage=TypeScript -o src/antlr -visitor -no-listener -Xexact-output-dir src/antlr/CircuitScript.g4",
|
|
62
66
|
"profile": "node --prof build/src/main.js examples/example_garden_pump.cst",
|
|
63
67
|
"profile-flame": "node --prof-process --preprocess -j isolate*.log | flamebearer",
|
|
64
|
-
"server": "node server.js"
|
|
68
|
+
"server": "node server.js",
|
|
69
|
+
"pack-local": "npm pack; rm circuitscript-install.tgz; mv `ls | grep circuitscript` circuitscript-install.tgz; cp circuitscript-install.tgz ../circuitscript-vscode/client; cp circuitscript-install.tgz ../circuitscript-vscode/server"
|
|
65
70
|
},
|
|
66
71
|
"boilerplate_author": "Jakub Synowiec <jsynowiec@users.noreply.github.com>",
|
|
67
72
|
"license": "MIT",
|
|
@@ -69,12 +74,12 @@
|
|
|
69
74
|
"@dagrejs/graphlib": "2.1.13",
|
|
70
75
|
"@flatten-js/core": "1.5.5",
|
|
71
76
|
"@svgdotjs/svg.js": "3.2.0",
|
|
72
|
-
"
|
|
77
|
+
"antlr4ng": "^3.0.4",
|
|
73
78
|
"commander": "^11.1.0",
|
|
74
79
|
"express": "^4.18.2",
|
|
75
80
|
"figlet": "^1.7.0",
|
|
76
81
|
"lodash": "^4.17.21",
|
|
77
|
-
"svgdom": "
|
|
82
|
+
"svgdom": "0.1.14",
|
|
78
83
|
"this-file": "^2.0.3",
|
|
79
84
|
"tslib": "~2.5",
|
|
80
85
|
"ws": "^8.14.2"
|