This commit adds validation logic in compiler to check for max allowed characters per line for scripts. This allows preventing bugs caused by limitation of terminal emulators. Other supporting changes: - Rename/refactor related code for clarity and better maintainability. - Drop `I` prefix from interfaces to align with latest convention. - Refactor CodeValidator to be functional rather than object-oriented for simplicity. - Refactor syntax definition construction to be functional and be part of rule for better separation of concerns. - Refactored validation logic to use an enum-based factory pattern for improved maintainability and scalability.
22 lines
758 B
TypeScript
22 lines
758 B
TypeScript
import type { CategoryCollectionContext } from '@/application/Parser/Executable/CategoryCollectionContext';
|
|
import { ScriptingLanguage } from '@/domain/ScriptingLanguage';
|
|
import type { ScriptCompiler } from '@/application/Parser/Executable/Script/Compiler/ScriptCompiler';
|
|
import { ScriptCompilerStub } from './ScriptCompilerStub';
|
|
|
|
export class CategoryCollectionContextStub
|
|
implements CategoryCollectionContext {
|
|
public compiler: ScriptCompiler = new ScriptCompilerStub();
|
|
|
|
public language: ScriptingLanguage = ScriptingLanguage.shellscript;
|
|
|
|
public withCompiler(compiler: ScriptCompiler) {
|
|
this.compiler = compiler;
|
|
return this;
|
|
}
|
|
|
|
public withLanguage(language: ScriptingLanguage) {
|
|
this.language = language;
|
|
return this;
|
|
}
|
|
}
|