circuitscript 0.1.8 → 0.1.10
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 +7 -6
- package/dist/cjs/antlr/CircuitScriptParser.js +141 -123
- package/dist/cjs/builtinMethods.js +15 -0
- package/dist/cjs/draw_symbols.js +3 -0
- package/dist/cjs/execute.js +90 -2
- package/dist/cjs/helpers.js +1 -0
- package/dist/cjs/layout.js +33 -44
- package/dist/cjs/objects/ClassComponent.js +1 -0
- package/dist/cjs/objects/ExecutionScope.js +5 -4
- package/dist/cjs/utils.js +57 -14
- package/dist/cjs/visitor.js +99 -39
- package/dist/esm/BaseVisitor.js +7 -6
- package/dist/esm/antlr/CircuitScriptParser.js +141 -123
- package/dist/esm/builtinMethods.js +15 -0
- package/dist/esm/draw_symbols.js +4 -1
- package/dist/esm/execute.js +91 -3
- package/dist/esm/helpers.js +2 -1
- package/dist/esm/layout.js +34 -45
- package/dist/esm/objects/ClassComponent.js +1 -0
- package/dist/esm/objects/ExecutionScope.js +5 -4
- package/dist/esm/utils.js +54 -13
- package/dist/esm/visitor.js +100 -40
- package/dist/types/BaseVisitor.d.ts +3 -1
- package/dist/types/antlr/CircuitScriptParser.d.ts +2 -1
- package/dist/types/execute.d.ts +6 -1
- package/dist/types/objects/ClassComponent.d.ts +1 -0
- package/dist/types/objects/ExecutionScope.d.ts +3 -2
- package/dist/types/utils.d.ts +9 -1
- package/dist/types/visitor.d.ts +2 -0
- package/package.json +1 -1
package/dist/types/execute.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BlockTypes, FrameType } from './globals.js';
|
|
2
|
+
import { ExecutionWarning } from "./utils.js";
|
|
2
3
|
import { ClassComponent } from './objects/ClassComponent.js';
|
|
3
4
|
import { ExecutionScope } from './objects/ExecutionScope.js';
|
|
4
5
|
import { Net } from './objects/Net.js';
|
|
@@ -28,7 +29,9 @@ export declare class ExecutionContext {
|
|
|
28
29
|
__functionCache: {};
|
|
29
30
|
parentContext: ExecutionContext;
|
|
30
31
|
componentAngleFollowsWire: boolean;
|
|
31
|
-
|
|
32
|
+
warnings: ExecutionWarning[];
|
|
33
|
+
constructor(name: string, namespace: string, netNamespace: string, executionLevel: number | undefined, indentLevel: number | undefined, silent: boolean | undefined, logger: Logger, warnings: ExecutionWarning[], parent: ExecutionContext);
|
|
34
|
+
logWarning(message: string, context?: ParserRuleContext, fileName?: string): void;
|
|
32
35
|
log(...params: any[]): void;
|
|
33
36
|
private setupRoot;
|
|
34
37
|
getUniqueInstanceName(): string;
|
|
@@ -46,6 +49,8 @@ export declare class ExecutionContext {
|
|
|
46
49
|
angle?: NumericValue;
|
|
47
50
|
followWireOrientation: boolean;
|
|
48
51
|
}, isModule?: boolean): ClassComponent;
|
|
52
|
+
private removeArrangePropDuplicates;
|
|
53
|
+
private getArrangePropPins;
|
|
49
54
|
printPoint(extra?: string): void;
|
|
50
55
|
addComponentExisting(component: ClassComponent, pin: number): ComponentPin;
|
|
51
56
|
toComponent(component: ClassComponent, pinId: number | null, options?: {
|
|
@@ -18,6 +18,7 @@ export declare class ClassComponent {
|
|
|
18
18
|
_copyID?: number;
|
|
19
19
|
_copyFrom?: ClassComponent;
|
|
20
20
|
_pointLinkComponent?: ClassComponent;
|
|
21
|
+
_unplacedPins: number[];
|
|
21
22
|
arrangeProps: Map<string, NumericValue[]> | null;
|
|
22
23
|
displayProp: SymbolDrawingCommands | null;
|
|
23
24
|
widthProp: number | null;
|
|
@@ -5,6 +5,7 @@ import { LayoutDirection } from '../globals.js';
|
|
|
5
5
|
import { Wire, WireSegment } from './Wire.js';
|
|
6
6
|
import { Frame } from './Frame.js';
|
|
7
7
|
import { ParserRuleContext } from 'antlr4ng';
|
|
8
|
+
import { BaseVisitor } from 'src/BaseVisitor.js';
|
|
8
9
|
type OnPropertyHandler = (path: PropertyTreeKey[], value: any, valueContext: ParserRuleContext) => void;
|
|
9
10
|
export type PropertyTreeKey = [ctx: ParserRuleContext, value: any] | ['index', number];
|
|
10
11
|
export declare class ExecutionScope {
|
|
@@ -50,10 +51,10 @@ export declare class ExecutionScope {
|
|
|
50
51
|
setCurrent(component: ClassComponent | null, pin?: number | null): void;
|
|
51
52
|
enterContext(context: ParserRuleContext): void;
|
|
52
53
|
exitContext(): ParserRuleContext;
|
|
53
|
-
findPropertyKeyTree
|
|
54
|
+
private findPropertyKeyTree;
|
|
54
55
|
setOnPropertyHandler(handler: OnPropertyHandler): void;
|
|
55
56
|
popOnPropertyHandler(): OnPropertyHandler;
|
|
56
|
-
triggerPropertyHandler(value: any, valueCtx: ParserRuleContext): void;
|
|
57
|
+
triggerPropertyHandler(visitor: BaseVisitor, value: any, valueCtx: ParserRuleContext): void;
|
|
57
58
|
}
|
|
58
59
|
export declare enum SequenceAction {
|
|
59
60
|
To = "to",
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { ClassComponent } from "./objects/ClassComponent.js";
|
|
|
4
4
|
import { NumericValue } from "./objects/ParamDefinition.js";
|
|
5
5
|
import { SequenceAction, SequenceItem } from './objects/ExecutionScope.js';
|
|
6
6
|
import { BlockTypes } from './globals.js';
|
|
7
|
+
import { ExecutionWarning } from './utils.js';
|
|
7
8
|
export declare class SimpleStopwatch {
|
|
8
9
|
startTime: Date;
|
|
9
10
|
constructor();
|
|
@@ -49,9 +50,10 @@ export declare class BaseError extends Error {
|
|
|
49
50
|
startToken?: Token;
|
|
50
51
|
endToken?: Token;
|
|
51
52
|
filePath?: string;
|
|
52
|
-
constructor(message: string,
|
|
53
|
+
constructor(message: string, startTokenOrCtx?: Token | ParserRuleContext, endToken?: Token, filePath?: string);
|
|
53
54
|
toString(): string;
|
|
54
55
|
}
|
|
56
|
+
export declare function getLinePositionAsString(ctx: ParserRuleContext): string | null;
|
|
55
57
|
export declare class ParseSyntaxError extends BaseError {
|
|
56
58
|
name: string;
|
|
57
59
|
}
|
|
@@ -65,3 +67,9 @@ export declare class RenderError extends Error {
|
|
|
65
67
|
stage?: string;
|
|
66
68
|
constructor(message: string, stage?: string);
|
|
67
69
|
}
|
|
70
|
+
export type ExecutionWarning = {
|
|
71
|
+
message: string;
|
|
72
|
+
fileName?: string;
|
|
73
|
+
ctx?: ParserRuleContext;
|
|
74
|
+
};
|
|
75
|
+
export declare function printWarnings(warnings: ExecutionWarning[]): void;
|
package/dist/types/visitor.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Add_component_exprContext, AdditionExprContext, At_blockContext, At_blo
|
|
|
2
2
|
import { ClassComponent } from './objects/ClassComponent.js';
|
|
3
3
|
import { PinTypes } from './objects/PinTypes.js';
|
|
4
4
|
import { ComponentPin, ComponentPinNet, ComponentPinNetPair } from './objects/types.js';
|
|
5
|
+
import { ExecutionWarning } from "./utils.js";
|
|
5
6
|
import { Net } from './objects/Net.js';
|
|
6
7
|
import { BaseVisitor } from './BaseVisitor.js';
|
|
7
8
|
import { ParserRuleContext } from 'antlr4ng';
|
|
@@ -83,6 +84,7 @@ export declare class ParserVisitor extends BaseVisitor {
|
|
|
83
84
|
};
|
|
84
85
|
private resolveNets;
|
|
85
86
|
private getPropertyExprList;
|
|
87
|
+
getWarnings(): ExecutionWarning[];
|
|
86
88
|
}
|
|
87
89
|
export type NetListItem = {
|
|
88
90
|
instanceName: string;
|