UNPKG

python2igcse

Version:

Convert Python code to IGCSE Pseudocode format

114 lines 3.29 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; /** * 関数の検索 */ protected findFunction(name: string): FunctionInfo | undefined; /** * クラスの登録 */ protected registerClass(name: string, line?: number): void; /** * インデントレベルの増加 */ protected increaseIndent(): void; /** * インデントレベルの減少 */ protected decreaseIndent(): void; /** * IRノードの作成(ヘルパー) */ protected createIRNode(kind: import('../types/ir').IRKind, text: string, children?: IR[], meta?: import('../types/ir').IRMeta): IR; /** * パース結果の作成 */ protected createParseResult(ir: IR[]): ParseResult; /** * IRノード数のカウント */ protected countNodes(ir: IR): number; /** * 関数数のカウント */ protected countFunctions(): number; /** * 変数数のカウント */ protected countVariables(): number; /** * パースの開始時刻を記録 */ protected startParsing(): void; /** * デバッグ情報の出力 */ protected debug(_message: string): void; /** * コンテキストのリセット */ protected resetContext(): void; /** * エラーの取得 */ protected getErrors(): import('../types/parser').ParseError[]; /** * 警告の取得 */ protected getWarnings(): import('../types/parser').ParseWarning[]; } //# sourceMappingURL=base-parser.d.ts.map