types/grammar.types.ts
types/grammar.types.ts is a file in Bane's Lab Site. 99 lines of code and 19 definitions.
import type { DistinctView, EdgeRef } from "#types/link.types";
export interface Keyword {
readonly description: string;
readonly example?: string;
readonly name: string;
}
export interface KeywordBlock {
readonly keywords: readonly (Keyword | string)[];
readonly kind: "keyword";
}
export interface Comparison {
readonly correct: string;
readonly issue: string;
readonly wrong: string;
}
export interface CompareBlock {
readonly entries: readonly Comparison[];
readonly kind: "compare";
}
export interface CheckBlock {
readonly items: readonly string[];
readonly kind: "check";
}
export interface Signature {
readonly name: string;
readonly purpose: string;
readonly verb: string;
}
export interface TypeBlock {
readonly kind: "type";
readonly types: readonly Signature[];
}
export interface DiagramBlock {
readonly grammar?: boolean;
readonly kind: "diagram";
readonly text: string;
}
export type GrammarBlock = CheckBlock | CompareBlock | DiagramBlock | KeywordBlock | TypeBlock;
export interface GrammarRule {
readonly grammar: string;
readonly title: string;
}
export interface KeywordRoleView {
readonly category: string;
readonly example: string;
readonly grounds: readonly EdgeRef[];
readonly meaning: string;
}
export interface KeywordView {
readonly anchor: string;
readonly distinctFrom: readonly DistinctView[];
readonly name: string;
readonly roles: readonly [KeywordRoleView, ...KeywordRoleView[]];
}
export interface KeywordCategoryView {
readonly category: string;
readonly keywords: readonly KeywordView[];
}
export interface GrammarProductionView {
readonly anchor: string;
readonly grounds: readonly EdgeRef[];
readonly lhs: string;
readonly rhs: string;
}
export interface ProductionGroupView {
readonly group: string;
readonly productions: readonly GrammarProductionView[];
}
export interface DocumentTypeView {
readonly anchor: string;
readonly axis: EdgeRef | null;
readonly defaultVerb: string;
readonly grounds: readonly EdgeRef[];
readonly model: EdgeRef | null;
readonly purpose: string;
readonly type: string;
readonly verbs: readonly string[];
}
export interface TemplateSlotView {
readonly description: string;
readonly kind: string;
readonly name: string;
readonly required: boolean;
readonly values: readonly string[];
}
export interface TemplateView {
readonly anchor: string;
readonly body: string;
readonly constraints: readonly string[];
readonly slots: readonly TemplateSlotView[];
readonly title: string;
readonly type: string;
}
export interface GrammarView {
readonly categories: readonly KeywordCategoryView[];
readonly documentTypes: readonly DocumentTypeView[];
readonly groups: readonly ProductionGroupView[];
readonly templates: readonly TemplateView[];
}