UNPKG

python2ib

Version:

Convert Python code to IB Pseudocode format

75 lines 3.29 kB
/** * Main API for Python to IB Pseudocode converter */ /** * Main entry point for the Python to IB Pseudocode converter */ export * from './converter.js'; export * from './types/ir.js'; export * from './types/config.js'; export * from './utils/keywords.js'; export * from './utils/operators.js'; export * from './utils/indent.js'; export * from './parser/index.js'; export * from './emitter/index.js'; export { PythonSyntaxError, UnsupportedSyntaxError, ConversionError, ConfigurationError, createUnsupportedSyntaxError, formatErrorForCLI } from './errors/index.js'; export { loadConfigFromFile, mergeConfig, getConfig, createSampleConfig, DEFAULT_CONFIG } from './config/index.js'; import { ConvertOptions } from './types/config.js'; import { IR } from './types/ir.js'; /** Main converter class */ export declare class PythonToIBConverter { private config; private parser; private emitter; constructor(options?: Partial<ConvertOptions>); /** Convert Python code to IB Pseudocode (async) */ convert(pythonCode: string): Promise<string>; /** Convert Python code to IB Pseudocode (sync) */ convertSync(pythonCode: string): string; /** Convert Python code to IR only */ parseToIR(pythonCode: string): Promise<IR>; /** Convert Python code to IR only (sync) */ parseToIRSync(pythonCode: string): IR; /** Convert IR to IB Pseudocode */ emitFromIR(ir: IR): string; /** Validate Python syntax */ validateSyntax(pythonCode: string): { isValid: boolean; errors: string[]; }; /** Get supported Python constructs */ getSupportedConstructs(): string[]; /** Get unsupported Python constructs */ getUnsupportedConstructs(): string[]; /** Update configuration */ updateConfig(options: Partial<ConvertOptions>): void; /** Get current configuration */ getConfig(): Required<ConvertOptions>; /** Reset converter state */ reset(): void; } /** Convenience functions */ /** Convert Python to IB Pseudocode with default settings (sync) */ export declare function convertPythonToIB(pythonCode: string, options?: Partial<ConvertOptions>): string; /** Convert Python to IB Pseudocode with default settings (sync) */ export declare function convertPythonToIBSync(pythonCode: string, options?: Partial<ConvertOptions>): string; /** Parse Python to IR with default settings (async) */ export declare function parsePythonToIR(pythonCode: string, options?: Partial<ConvertOptions>): Promise<IR>; /** Parse Python to IR with default settings (sync) */ export declare function parsePythonToIRSync(pythonCode: string, options?: Partial<ConvertOptions>): IR; /** Emit IR to IB Pseudocode with custom options */ export declare function emitIRToIB(ir: IR, options?: Partial<ConvertOptions>): string; /** Quick conversion with minimal setup */ export declare function quickConvert(pythonCode: string): string; /** Validate Python code syntax */ export declare function validatePythonSyntax(pythonCode: string): { isValid: boolean; errors: string[]; }; /** Get information about supported/unsupported constructs */ export declare function getConstructInfo(): { supported: string[]; unsupported: string[]; }; export default PythonToIBConverter; //# sourceMappingURL=index.d.ts.map