import * as TSU from "@panyam/tsutils"; import { Sym, Grammar, Rule } from "./grammar"; import { IDSet } from "./sets"; type Nullable = TSU.Nullable; type NumMap = TSU.NumMap; export declare class LRItem { id: number; readonly rule: Rule; readonly position: number; constructor(rule: Rule, position?: number); advance(): LRItem; copy(): LRItem; get key(): string; compareTo(another: this): number; equals(another: this): boolean; get debugString(): string; } export declare class LRItemSet { id: number; readonly itemGraph: LRItemGraph; protected _key: Nullable; readonly values: number[]; protected _lookaheads: NumMap; protected _hasLookAheads: boolean; constructor(ig: LRItemGraph, ...entries: number[]); copy(): LRItemSet; addLookAhead(item: LRItem, sym: Sym): boolean; clearLookAheads(): void; getLookAheads(item: LRItem): ReadonlyArray; get key(): string; protected revalKey(): string; has(itemId: number): boolean; equals(another: LRItemSet): boolean; add(itemId: number): this; get size(): number; get debugString(): string; get hasLookAheads(): boolean; get debugValue(): any; } export declare abstract class LRItemGraph { readonly grammar: Grammar; items: IDSet; itemSets: IDSet; gotoSets: NumMap>; abstract closure(itemSet: LRItemSet): LRItemSet; abstract startSet(): LRItemSet; constructor(grammar: Grammar); protected startItem(): LRItem; reset(): void; refresh(): this; protected evalGotoSets(): void; goto(itemSet: LRItemSet, sym: Sym): LRItemSet; protected advanceItemAndAdd(itemToAdvance: LRItem, fromItemSet: LRItemSet, toItemSet: LRItemSet): void; protected newItemSet(...items: LRItem[]): LRItemSet; get size(): number; protected ensureGotoSet(fromSet: LRItemSet): NumMap; setGoto(fromSet: LRItemSet, sym: Sym, toSet: LRItemSet): void; getGoto(fromSet: LRItemSet, sym: Sym): Nullable; forEachGoto(itemSet: LRItemSet, visitor: (sym: Sym, nextSet: LRItemSet) => boolean | void): void; gotoSetFor(itemSet: LRItemSet): NumMap; get debugValue(): any; } export declare class LR0ItemGraph extends LRItemGraph { startSet(): LRItemSet; closure(itemSet: LRItemSet): LRItemSet; } export declare class LR1ItemGraph extends LRItemGraph { startSet(): LRItemSet; closure(itemSet: LRItemSet): LRItemSet; } export {};