UNPKG

python2igcse

Version:

Convert Python code to IGCSE Pseudocode format

109 lines 2.73 kB
import { IR } from '../types/ir'; import { EmitterOptions, EmitResult, EmitContext, FormatterConfig } from '../types/emitter'; /** * Base class for emitters * Provides IR to text conversion functionality */ export declare abstract class BaseEmitter { protected options: EmitterOptions; protected context: EmitContext; protected startTime: number; constructor(options?: Partial<EmitterOptions>); /** * Create initial context */ private createInitialContext; /** * Execute emit (abstract method) */ abstract emit(ir: IR): EmitResult; /** * Add error */ protected addError(message: string, type: import('../types/emitter').EmitErrorType, node?: IR): void; /** * Add warning */ protected addWarning(message: string, type: import('../types/emitter').EmitWarningType, node?: IR): void; /** * Increase indent level */ protected increaseIndent(): void; /** * Decrease indent level */ protected decreaseIndent(): void; /** * Output line */ protected emitLine(text: string, indent?: boolean): void; /** * Output empty line */ protected emitBlankLine(): void; /** * Output comment */ protected emitComment(text: string): void; /** * Process IR node (abstract method) */ protected abstract emitNode(node: IR): void; /** * Process child nodes */ protected emitChildren(node: IR): void; /** * Format text */ protected formatText(text: string): string; /** * Capitalize keywords */ private uppercaseKeywords; /** * Convert operators (Python → IGCSE) */ private convertOperators; /** * Add space around operators */ private addSpaceAroundOperators; /** * Escape for regular expressions */ private escapeRegex; /** * Add space after commas outside string literals */ private addSpaceAfterCommaOutsideStrings; /** * Create emit result */ protected createEmitResult(): EmitResult; /** * Record emit start time */ protected startEmitting(): void; /** * Output debug information */ protected debug(_message: string): void; /** * Reset context */ protected resetContext(): void; /** * Wrap long lines */ protected wrapLongLine(text: string, maxLength?: number): string[]; /** * Update options */ updateOptions(options: Partial<EmitterOptions>): void; /** * Update formatter configuration */ updateFormatterConfig(config: Partial<FormatterConfig>): void; } //# sourceMappingURL=base-emitter.d.ts.map