UNPKG

python2igcse

Version:

Convert Python code to IGCSE Pseudocode format

126 lines 3.6 kB
import { IR } from '../types/ir'; import { ParserOptions, ParseResult, ParserContext, VariableInfo, FunctionInfo } from '../types/parser'; import { IGCSEDataType } from '../types/igcse'; /** * Base parser class * Provides common parsing functionality */ export declare abstract class BaseParser { protected options: Required<ParserOptions>; protected context: ParserContext; protected startTime: number; constructor(options?: ParserOptions); /** * Get default options */ private getDefaultOptions; /** * Create initial context */ private createInitialContext; /** * Execute parsing (abstract method) */ abstract parse(source: string): ParseResult; /** * Add error */ protected addError(message: string, type: import('../types/parser').ParseErrorType, line?: number, column?: number): void; /** * Add warning */ protected addWarning(message: string, type: import('../types/parser').ParseWarningType, line?: number, column?: number): void; /** * Start new scope */ protected enterScope(name: string, type: import('../types/parser').ScopeType): void; /** * End scope */ protected exitScope(): void; /** * Get current loop type */ protected getCurrentLoopType(): 'while' | 'for' | null; /** * Register variable */ protected registerVariable(name: string, type: IGCSEDataType, line?: number): void; /** * Register function */ protected registerFunction(name: string, parameters: import('../types/parser').ParameterInfo[], returnType?: IGCSEDataType, line?: number): void; /** * Find variable */ protected findVariable(name: string): VariableInfo | undefined; /** * Find function */ protected findFunction(name: string): FunctionInfo | undefined; /** * Register class */ protected registerClass(name: string, line?: number): void; /** * Increase indent level */ protected increaseIndent(): void; /** * Decrease indent level */ protected decreaseIndent(): void; /** * Create IR node (helper) */ protected createIRNode(kind: import('../types/ir').IRKind, text: string, children?: IR[], meta?: import('../types/ir').IRMeta): IR; /** * Create parse result */ protected createParseResult(ir: IR[]): ParseResult; /** * Count IR nodes */ protected countNodes(ir: IR): number; /** * Count functions */ protected countFunctions(): number; /** * Count variables */ protected countVariables(): number; /** * Record parse start time */ protected startParsing(): void; /** * Output debug information */ protected debug(_message: string): void; /** * Reset context */ protected resetContext(): void; /** * Get errors */ protected getErrors(): import('../types/parser').ParseError[]; /** * Get warnings */ protected getWarnings(): import('../types/parser').ParseWarning[]; /** * Record function call information */ protected recordFunctionCall(name: string, argumentTypes: IGCSEDataType[]): void; /** * Get function call information */ protected getFunctionCallInfo(name: string): import('../types/parser').FunctionCallInfo | undefined; /** * Get all function call information */ getAllFunctionCalls(): Map<string, import('../types/parser').FunctionCallInfo>; } //# sourceMappingURL=base-parser.d.ts.map