pddl-workspace
Version:
85 lines (84 loc) • 2.79 kB
TypeScript
import { Variable } from "./language";
export interface CompilationDocumentation {
/** Documentation text header. */
title: string;
/** Markdown documentation text. */
codeblock?: string;
}
export interface Compilation {
readonly documentation: CompilationDocumentation;
readonly offset: number;
readonly code: string;
readonly shouldEnsureWhitespaceSeparation: boolean;
readonly removedCodeLength?: number;
readonly reason?: string;
}
export declare class CodeInjection implements Compilation {
readonly documentation: CompilationDocumentation;
readonly offset: number;
readonly code: string;
readonly reason: string | undefined;
private readonly _shouldEnsureWhitespaceSeparation;
constructor(options: {
offset: number;
code: string;
documentation: CompilationDocumentation;
doesNotRequireWhitespaceSurrounding?: boolean;
reason?: string;
});
get shouldEnsureWhitespaceSeparation(): boolean;
}
export declare class PddlCodeInjection extends CodeInjection {
constructor(options: {
offset: number;
code: string;
documentation: CompilationDocumentation;
reason: string;
});
}
export interface VariableDeclarationsInjectionOptions {
readonly documentation: CompilationDocumentation;
readonly offset: number;
readonly variables: Variable[];
readonly reason: string | undefined;
readonly prefix?: string;
readonly suffix?: string;
}
export declare class VariableDeclarationsInjection extends CodeInjection {
readonly variables: Variable[];
constructor(options: VariableDeclarationsInjectionOptions);
get shouldEnsureWhitespaceSeparation(): boolean;
}
export declare class CodeReplacement implements Compilation {
readonly documentation: CompilationDocumentation;
readonly offset: number;
readonly removedCodeLength: number;
readonly code: string;
readonly reason: string | undefined;
constructor(options: {
origCode: string;
newCode: string;
documentation: CompilationDocumentation;
offset: number;
reason?: string;
});
get shouldEnsureWhitespaceSeparation(): boolean;
}
/** Container for all code compilation. */
export declare class Compilations {
private compilations;
getAll(): Map<number, Compilation[]>;
add(compilation: Compilation): void;
addAll(index: number, injections: Compilation[]): void;
/**
* Applies all code compilations.
* @param input original code
* @returns resulting code with all the compilations
*/
applyAll(input: string): string;
/**
* Applies all compilations at `offset` and return the output.
*/
private applyAt;
private applyOne;
}