ast_generator/ast.out.ts

58 lines
1.7 KiB
TypeScript
Raw Normal View History

2024-07-21 20:56:42 +01:00
// Generated file by ast_generator
export type EnumStatement = {
kind: "Enum";
2024-07-21 22:35:34 +01:00
[0]: Enum;
2024-07-21 20:56:42 +01:00
};
2024-07-21 22:35:34 +01:00
export const EnumStatement = (v0: Enum): EnumStatement => ({ kind: "Enum", [0]: v0 });
2024-07-21 20:56:42 +01:00
export type NodeStatement = {
kind: "Node";
2024-07-21 22:35:34 +01:00
[0]: Node;
2024-07-21 20:56:42 +01:00
};
2024-07-21 22:35:34 +01:00
export const NodeStatement = (v0: Node): NodeStatement => ({ kind: "Node", [0]: v0 });
2024-07-21 20:56:42 +01:00
export type Statement = EnumStatement | NodeStatement;
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 });
2024-07-21 22:35:34 +01:00
export type NamedParam = {
kind: "Named";
2024-07-21 20:56:42 +01:00
name: Name;
type_: Type;
};
2024-07-21 22:35:34 +01:00
export const NamedParam = (name: Name, type_: Type): NamedParam => ({ kind: "Named", name, type_ });
export type UnnamedParam = {
kind: "Unnamed";
[0]: Type;
};
export const UnnamedParam = (v0: Type): UnnamedParam => ({ kind: "Unnamed", [0]: v0 });
export type Param = NamedParam | UnnamedParam;
2024-07-21 20:56:42 +01:00
export type NameType = {
kind: "Name";
2024-07-21 22:35:34 +01:00
[0]: Name;
2024-07-21 20:56:42 +01:00
};
2024-07-21 22:35:34 +01:00
export const NameType = (v0: Name): NameType => ({ kind: "Name", [0]: v0 });
2024-07-21 20:56:42 +01:00
export type OptionalType = {
kind: "Optional";
2024-07-21 22:35:34 +01:00
[0]: Type;
2024-07-21 20:56:42 +01:00
};
2024-07-21 22:35:34 +01:00
export const OptionalType = (v0: Type): OptionalType => ({ kind: "Optional", [0]: v0 });
2024-07-21 20:56:42 +01:00
export type MultipleType = {
kind: "Multiple";
2024-07-21 22:35:34 +01:00
[0]: Type;
2024-07-21 20:56:42 +01:00
};
2024-07-21 22:35:34 +01:00
export const MultipleType = (v0: Type): MultipleType => ({ kind: "Multiple", [0]: v0 });
2024-07-21 20:56:42 +01:00
export type Type = NameType | OptionalType | MultipleType;
export 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-21 22:35:34 +01:00
export const Name = (v0: string, line: number, col: number): Name => ({ [0]: v0, line, col });
2024-07-21 20:56:42 +01:00