-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- let `Word` be algebraic data type
- Loading branch information
Showing
11 changed files
with
171 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,71 @@ | ||
import { Node } from "../graph" | ||
import { Mod } from "../mod" | ||
import { Net } from "../net" | ||
import { Span } from "../span" | ||
|
||
export interface ComposeOptions { | ||
current?: { start: Node; end: Node } | ||
export type Word = Call | LocalSet | PortPush | PortReconnect | ||
|
||
export type Call = { | ||
kind: "Call" | ||
name: string | ||
span: Span | ||
} | ||
|
||
export function Call(name: string, span: Span): Call { | ||
return { | ||
kind: "Call", | ||
name, | ||
span, | ||
} | ||
} | ||
|
||
export type LocalSet = { | ||
kind: "LocalSet" | ||
name: string | ||
span: Span | ||
} | ||
|
||
export function LocalSet(name: string, span: Span): LocalSet { | ||
return { | ||
kind: "LocalSet", | ||
name, | ||
span, | ||
} | ||
} | ||
|
||
export type PortPush = { | ||
kind: "PortPush" | ||
nodeName: string | ||
portName: string | ||
span: Span | ||
} | ||
|
||
export interface Word { | ||
export function PortPush( | ||
nodeName: string, | ||
portName: string, | ||
span: Span, | ||
): PortPush { | ||
return { | ||
kind: "PortPush", | ||
nodeName, | ||
portName, | ||
span, | ||
} | ||
} | ||
|
||
export type PortReconnect = { | ||
kind: "PortReconnect" | ||
nodeName: string | ||
portName: string | ||
span: Span | ||
compose(mod: Mod, net: Net, options?: ComposeOptions): void | ||
} | ||
|
||
export function PortReconnect( | ||
nodeName: string, | ||
portName: string, | ||
span: Span, | ||
): PortReconnect { | ||
return { | ||
kind: "PortReconnect", | ||
nodeName, | ||
portName, | ||
span, | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.