@scinorandex/sparse
Version:
Yet another parser generator
58 lines (57 loc) • 1.43 kB
TypeScript
import { Token } from "@scinorandex/slex";
export type Production = {
lhs: GrammarToken;
identifier: string;
originalProductionIndex: number;
name: string | null;
rhs: {
type: "terminal" | "variable";
token: GrammarToken;
identifier: string;
name: string | null;
}[];
};
export declare const dehydateProduction: (opts: Production) => {
lhs: {
column: number;
lexeme: string;
line: number;
type: GrammarTokenType;
};
identifier: string;
name: string | null;
originalProductionIndex: number;
rhs: {
type: "terminal" | "variable";
token: {
column: number;
lexeme: string;
line: number;
type: GrammarTokenType;
};
identifier: string;
name: string | null;
}[];
};
export declare const hydrateProduction: (production: ReturnType<typeof dehydateProduction>) => Production;
export type GrammarTokenMetadata = {};
export declare enum GrammarTokenType {
IDENTIFIER = 0,
L_ANGLE = 1,
R_ANGLE = 2,
L_BRACKET = 3,
R_BRACKET = 4,
L_PAREN = 5,
R_PAREN = 6,
PIPE = 7,
QUESTION_MARK = 8,
COLON = 9,
SEMICOLON = 10,
NUMBER = 11,
EQUALS = 12,
COMMA = 13,
EOF = 14,
PRODUCTION_NAME = 15,
TOKEN_NAME = 16
}
export type GrammarToken = Token<GrammarTokenType, GrammarTokenMetadata>;