@bitcobblers/wod-wiki-library
Version:
A specialized markdown-like workout syntax editor and runtime for defining workouts
23 lines (22 loc) • 934 B
TypeScript
import { ITimerRuntime } from '../../../ITimerRuntime';
import { JitStatement } from '../../../JitStatement';
import { IRuntimeBlock } from '../../../IRuntimeBlock';
/**
* Interface for runtime block compilation strategies
* Implements the Strategy pattern for different block types
*/
export interface IRuntimeBlockStrategy {
/**
* Check if this strategy applies to the given precompiled nodes
* @param nodes Array of precompiled nodes to check
* @returns True if this strategy can handle the nodes
*/
canHandle(nodes: JitStatement[], runtime: ITimerRuntime): boolean;
/**
* Compile statement nodes into a runtime block
* @param nodes Array of precompiled nodes to compile
* @param runtime The runtime instance
* @returns A compiled runtime block or undefined if compilation fails
*/
compile(nodes: JitStatement[], runtime: ITimerRuntime): IRuntimeBlock | undefined;
}