28 lines
513 B
Go
28 lines
513 B
Go
package engine
|
|
|
|
import (
|
|
"git.maximhutz.com/max/lambda/internal/config"
|
|
"git.maximhutz.com/max/lambda/pkg/emitter"
|
|
"git.maximhutz.com/max/lambda/pkg/lambda"
|
|
)
|
|
|
|
type Engine struct {
|
|
Config *config.Config
|
|
Expression *lambda.Expression
|
|
emitter.Emitter
|
|
}
|
|
|
|
func New(config *config.Config, expression *lambda.Expression) *Engine {
|
|
return &Engine{Config: config, Expression: expression}
|
|
}
|
|
|
|
func (e Engine) Run() {
|
|
e.Emit("start")
|
|
|
|
for lambda.ReduceOnce(e.Expression) {
|
|
e.Emit("step")
|
|
}
|
|
|
|
e.Emit("end")
|
|
}
|