@scinorandex/sparse
Version:
Yet another parser generator
24 lines (23 loc) • 992 B
TypeScript
import { Slex } from "@scinorandex/slex";
import { Result, Sparse } from "../index";
import { selfhosted } from "./states";
import { GrammarToken, GrammarTokenMetadata, GrammarTokenType, Production } from "./common";
export declare const grammarLexerGenerator: Slex<GrammarTokenType, GrammarTokenMetadata>;
export declare abstract class BaseNode {
}
export declare class ListNode<T> extends BaseNode {
private items;
constructor(items: T | T[]);
add(item: T): this;
getItems(): T[];
getItemsReversed(): T[];
}
export declare function getSelfHostedParserGenerator(e?: typeof selfhosted): Sparse<GrammarTokenType, GrammarTokenMetadata, BaseNode>;
export declare const tryBuildProductions: (lexer: LexerInterface | string) => Result<Production[]>;
interface LexerInterface {
peekNextToken(): GrammarToken;
getNextToken(): GrammarToken;
hasNextToken(): boolean;
}
export declare const buildProductions: (lexer: LexerInterface | string) => Production[];
export {};