This commit consolidates scripts and categories under a unified 'Executable' concept. This simplifies the architecture and improves code readability. - Introduce subfolders within `src/domain` to segregate domain elements. - Update class and interface names by removing the 'I' prefix in alignment with new coding standards. - Replace 'Node' with 'Executable' to clarify usage; reserve 'Node' exclusively for the UI's tree component.
30 lines
963 B
TypeScript
30 lines
963 B
TypeScript
import type { IExpression } from '@/application/Parser/Executable/Script/Compiler/Expressions/Expression/IExpression';
|
|
import type { IExpressionParser } from '@/application/Parser/Executable/Script/Compiler/Expressions/Parser/IExpressionParser';
|
|
|
|
export class ExpressionParserStub implements IExpressionParser {
|
|
public callHistory = new Array<string>();
|
|
|
|
private results = new Map<string, readonly IExpression[]>();
|
|
|
|
public withResult(code: string, result: readonly IExpression[]) {
|
|
if (this.results.has(code)) {
|
|
throw new Error(
|
|
'Result for code is already registered.'
|
|
+ `\nCode: ${code}`
|
|
+ `\nResult: ${JSON.stringify(result)}`,
|
|
);
|
|
}
|
|
this.results.set(code, result);
|
|
return this;
|
|
}
|
|
|
|
public findExpressions(code: string): IExpression[] {
|
|
this.callHistory.push(code);
|
|
const foundResult = this.results.get(code);
|
|
if (foundResult) {
|
|
return [...foundResult];
|
|
}
|
|
return [];
|
|
}
|
|
}
|