/** * @file Grammar Engine Base * @description Abstract base class for grammar matching engines */ import { Token } from '../parser-contracts/parser-types'; import { GrammarRule, PatternMatch, GrammarContext, GrammarBuilder } from './grammar-builder'; import { PatternCompiler } from './pattern-compiler'; /** * Grammar matching options */ export interface GrammarMatchOptions { /** Minimum confidence threshold */ minConfidence?: number; /** Maximum number of matches to return */ maxMatches?: number; /** Whether to allow partial matches */ allowPartial?: boolean; } /** * Abstract base class for grammar engines * Language-specific implementations provide concrete matching logic */ export declare abstract class GrammarEngine { protected rules: GrammarRule[]; protected rulesByAction: Map; protected compiler: PatternCompiler; constructor(compiler: PatternCompiler); /** * Add a grammar rule */ addRule(rule: GrammarRule): void; /** * Add multiple rules */ addRules(rules: GrammarRule[]): void; /** * Find matching grammar rules for tokens */ abstract findMatches(tokens: Token[], context: GrammarContext, options?: GrammarMatchOptions): PatternMatch[]; /** * Get the best match from a set of tokens */ getBestMatch(tokens: Token[], context: GrammarContext, options?: GrammarMatchOptions): PatternMatch | null; /** * Clear all rules */ clear(): void; /** * Get all rules */ getRules(): GrammarRule[]; /** * Get rules for a specific action */ getRulesForAction(action: string): GrammarRule[]; /** * Sort rules by priority (descending) */ protected sortRules(): void; /** * Create a grammar builder connected to this engine */ createBuilder(): GrammarBuilder; } //# sourceMappingURL=grammar-engine.d.ts.map