import * as TSU from "@panyam/tsutils"; import * as TLEX from "tlex"; import { Sym, Grammar, Rule } from "./grammar"; type Nullable = TSU.Nullable; export type BeforeAddingChildCallback = (parent: PTNode, child: PTNode) => PTNode[]; export type RuleReductionCallback = (node: PTNode, rule: Rule) => PTNode; export type NextTokenCallback = (token: TLEX.Token) => TSU.Nullable; export declare class PFNode { readonly id: number; readonly sym: Sym; value: any; children: this[]; constructor(id: number, sym: Sym, value: any, ...children: PFNode[]); get childCount(): number; childAt(index: number): this; get isTerminal(): boolean; add(node: this, index?: number): this; splice(index: number, numToDelete: number, ...nodes: this[]): this; get reprString(): string; debugValue(raw?: boolean): any; } export declare class PTNode extends PFNode { parent: Nullable; add(node: this, index?: number): this; splice(index: number, numToDelete: number, ...nodes: this[]): this; } export declare abstract class ParserBase { tokenbuffer: TLEX.TokenBuffer; setTokenizer(tokenizer: TLEX.NextTokenFunc): this; abstract get grammar(): Grammar; getSym(token: TLEX.Token): Sym; } export declare abstract class SimpleParser extends ParserBase { parse(input: string | TLEX.Tape, delegate?: any): Nullable; protected abstract parseInput(input: TLEX.Tape, delegate: any): Nullable; } export declare abstract class ParallelParser extends ParserBase { parse(input: string | TLEX.Tape, delegate?: any): PFNode[]; protected abstract parseInput(input: TLEX.Tape, delegate: any): PFNode[]; } export {};