pddl-workspace
Version:
73 lines (72 loc) • 2.88 kB
TypeScript
import * as nunjucks from 'nunjucks';
export interface OutputAdaptor {
appendLine(text: string): void;
show(): void;
}
export declare class PreProcessingError implements Error {
readonly message: string;
readonly line: number;
readonly column: number;
stack?: string;
constructor(message: string, line: number, column: number);
get name(): string;
}
export declare abstract class PreProcessor {
protected metaDataLine?: string | undefined;
readonly metaDataLineOffset?: number | undefined;
constructor(metaDataLine?: string | undefined, metaDataLineOffset?: number | undefined);
abstract transform(input: string, workingDirectory: string, outputWindow: OutputAdaptor): Promise<string>;
abstract toString(): string;
abstract getInputFiles(): string[];
abstract getLabel(): string;
protected removeMetaDataLine(text: string): string;
}
/**
* Shell command based pre-processor.
*/
export declare class CommandPreProcessor extends PreProcessor {
private command;
protected args: string[];
constructor(command: string, args: string[], metaDataLine?: string, metaDataLineOffset?: number);
toString(): string;
static fromJson(json: never): PreProcessor;
getInputFiles(): string[];
getLabel(): string;
handleError(error: Error): void;
handleErrorAsync(error: Error, reject: (message: any) => void): void;
transform(input: string, workingDirectory: string, outputWindow: OutputAdaptor): Promise<string>;
}
/**
* Python-based pre-processor
*/
export declare class PythonPreProcessor extends CommandPreProcessor {
constructor(pythonPath: string, script: string, args: string[], metaDataLine?: string, metaDataLineOffset?: number);
getInputFiles(): string[];
getLabel(): string;
static fromJson(_json: never): PreProcessor;
private static readonly JINJA2_TEMPLATE_SYNTAX_ERROR_PREFIX;
private static readonly PYTHON_JSON_DECODER;
handleErrorAsync(error: Error, reject: (message: any) => void): void;
}
/**
* Jinja2 pre-processor
*/
export declare class Jinja2PreProcessor extends PythonPreProcessor {
dataFileName: string;
constructor(pythonPath: string, extensionRoot: string, dataFileName: string, metaDataLine?: string, metaDataLineOffset?: number);
static fromJson(_json: unknown): PreProcessor;
getInputFiles(): string[];
getLabel(): string;
}
/**
* Nunjucks based pre-processor
*/
export declare class NunjucksPreProcessor extends PreProcessor {
dataFileName: string;
nunjucksEnv: nunjucks.Environment;
constructor(dataFileName: string, metaDataLine: string | undefined, metaDataLineOffset: number, preserveWhitespace: boolean);
getInputFiles(): string[];
getLabel(): string;
toString(): string;
transform(input: string, workingDirectory: string, _outputWindow: OutputAdaptor): Promise<string>;
}