ast_generator/ast.out.ts

89 lines
2.8 KiB
TypeScript
Raw Normal View History

2024-07-21 20:56:42 +01:00
// Generated file by ast_generator
2024-07-29 01:54:28 +01:00
export type Statement_CodeBlock = {
type: "Statement",
kind: "CodeBlock",
[0]: CodeBlock,
};
export const Statement_CodeBlock = (v0: CodeBlock): Statement_CodeBlock => ({ type: "Statement", kind: "CodeBlock", [0]: v0 });
2024-07-24 11:31:06 +01:00
export type Statement_Enum = {
2024-07-29 01:54:28 +01:00
type: "Statement",
2024-07-24 11:31:06 +01:00
kind: "Enum",
[0]: Enum,
2024-07-21 20:56:42 +01:00
};
2024-07-29 01:54:28 +01:00
export const Statement_Enum = (v0: Enum): Statement_Enum => ({ type: "Statement", kind: "Enum", [0]: v0 });
2024-07-24 11:31:06 +01:00
export type Statement_Node = {
2024-07-29 01:54:28 +01:00
type: "Statement",
2024-07-24 11:31:06 +01:00
kind: "Node",
[0]: Node,
2024-07-21 20:56:42 +01:00
};
2024-07-29 01:54:28 +01:00
export const Statement_Node = (v0: Node): Statement_Node => ({ type: "Statement", kind: "Node", [0]: v0 });
export type Statement = Statement_CodeBlock | Statement_Enum | Statement_Node;
export const Statement = { CodeBlock: Statement_CodeBlock, Enum: Statement_Enum, Node: Statement_Node } as const;
export type CodeBlock = {
type: "CodeBlock";
[0]: string;
};
export const CodeBlock = (v0: string): CodeBlock => ({ type: "CodeBlock", [0]: v0 });
2024-07-24 11:31:06 +01:00
2024-07-21 20:56:42 +01:00
export type Enum = {
2024-07-29 01:54:28 +01:00
type: "Enum";
2024-07-21 20:56:42 +01:00
name: Name;
nodes: Node[];
};
2024-07-29 01:54:28 +01:00
export const Enum = (name: Name, nodes: Node[]): Enum => ({ type: "Enum", name, nodes });
2024-07-24 11:31:06 +01:00
2024-07-21 20:56:42 +01:00
export type Node = {
2024-07-29 01:54:28 +01:00
type: "Node";
2024-07-21 20:56:42 +01:00
name: Name;
params: Param[];
};
2024-07-29 01:54:28 +01:00
export const Node = (name: Name, params: Param[]): Node => ({ type: "Node", name, params });
2024-07-24 11:31:06 +01:00
export type Param_Named = {
2024-07-29 01:54:28 +01:00
type: "Param",
2024-07-24 11:31:06 +01:00
kind: "Named",
name: Name,
type_: Type,
};
2024-07-29 01:54:28 +01:00
export const Param_Named = (name: Name, type_: Type): Param_Named => ({ type: "Param", kind: "Named", name, type_ });
2024-07-24 11:31:06 +01:00
export type Param_Unnamed = {
2024-07-29 01:54:28 +01:00
type: "Param",
2024-07-24 11:31:06 +01:00
kind: "Unnamed",
[0]: Type,
};
2024-07-29 01:54:28 +01:00
export const Param_Unnamed = (v0: Type): Param_Unnamed => ({ type: "Param", kind: "Unnamed", [0]: v0 });
2024-07-24 11:31:06 +01:00
export type Param = Param_Named | Param_Unnamed;
export const Param = { Named: Param_Named, Unnamed: Param_Unnamed } as const;
export type Type_Name = {
2024-07-29 01:54:28 +01:00
type: "Type",
2024-07-24 11:31:06 +01:00
kind: "Name",
[0]: Name,
};
2024-07-29 01:54:28 +01:00
export const Type_Name = (v0: Name): Type_Name => ({ type: "Type", kind: "Name", [0]: v0 });
2024-07-24 11:31:06 +01:00
export type Type_Optional = {
2024-07-29 01:54:28 +01:00
type: "Type",
2024-07-24 11:31:06 +01:00
kind: "Optional",
[0]: Type,
};
2024-07-29 01:54:28 +01:00
export const Type_Optional = (v0: Type): Type_Optional => ({ type: "Type", kind: "Optional", [0]: v0 });
2024-07-24 11:31:06 +01:00
export type Type_Multiple = {
2024-07-29 01:54:28 +01:00
type: "Type",
2024-07-24 11:31:06 +01:00
kind: "Multiple",
[0]: Type,
};
2024-07-29 01:54:28 +01:00
export const Type_Multiple = (v0: Type): Type_Multiple => ({ type: "Type", kind: "Multiple", [0]: v0 });
2024-07-24 11:31:06 +01:00
export type Type = Type_Name | Type_Optional | Type_Multiple;
export const Type = { Name: Type_Name, Optional: Type_Optional, Multiple: Type_Multiple } as const;
2024-07-21 20:56:42 +01:00
export type Name = {
2024-07-29 01:54:28 +01:00
type: "Name";
2024-07-21 22:35:34 +01:00
[0]: string;
line: number;
col: number;
2024-07-21 20:56:42 +01:00
};
2024-07-29 01:54:28 +01:00
export const Name = (v0: string, line: number, col: number): Name => ({ type: "Name", [0]: v0, line, col });
2024-07-21 20:56:42 +01:00
2024-07-24 11:31:06 +01:00