ast_generator/ast.out.ts

67 lines
2.0 KiB
TypeScript

// Generated file by ast_generator
export type Statement_Enum = {
kind: "Enum",
[0]: Enum,
};
export const Statement_Enum = (v0: Enum): Statement_Enum => ({ kind: "Enum", [0]: v0 });
export type Statement_Node = {
kind: "Node",
[0]: Node,
};
export const Statement_Node = (v0: Node): Statement_Node => ({ kind: "Node", [0]: v0 });
export type Statement = Statement_Enum | Statement_Node;
export const Statement = { Enum: Statement_Enum, Node: Statement_Node } as const;
export type Enum = {
name: Name;
nodes: Node[];
};
export const Enum = (name: Name, nodes: Node[]): Enum => ({ name, nodes });
export type Node = {
name: Name;
params: Param[];
};
export const Node = (name: Name, params: Param[]): Node => ({ name, params });
export type Param_Named = {
kind: "Named",
name: Name,
type_: Type,
};
export const Param_Named = (name: Name, type_: Type): Param_Named => ({ kind: "Named", name, type_ });
export type Param_Unnamed = {
kind: "Unnamed",
[0]: Type,
};
export const Param_Unnamed = (v0: Type): Param_Unnamed => ({ kind: "Unnamed", [0]: v0 });
export type Param = Param_Named | Param_Unnamed;
export const Param = { Named: Param_Named, Unnamed: Param_Unnamed } as const;
export type Type_Name = {
kind: "Name",
[0]: Name,
};
export const Type_Name = (v0: Name): Type_Name => ({ kind: "Name", [0]: v0 });
export type Type_Optional = {
kind: "Optional",
[0]: Type,
};
export const Type_Optional = (v0: Type): Type_Optional => ({ kind: "Optional", [0]: v0 });
export type Type_Multiple = {
kind: "Multiple",
[0]: Type,
};
export const Type_Multiple = (v0: Type): Type_Multiple => ({ kind: "Multiple", [0]: v0 });
export type Type = Type_Name | Type_Optional | Type_Multiple;
export const Type = { Name: Type_Name, Optional: Type_Optional, Multiple: Type_Multiple } as const;
export type Name = {
[0]: string;
line: number;
col: number;
};
export const Name = (v0: string, line: number, col: number): Name => ({ [0]: v0, line, col });