JOJ3/internal/parser/dummy/parser.go
张泊明518370910136 08cd9d287b
Some checks failed
build / build (push) Failing after 8s
build / trigger-build-image (push) Has been skipped
submodules sync / sync (push) Successful in 32s
feat(parser/dummy): support force quit
2024-10-28 23:59:43 -04:00

28 lines
538 B
Go

package dummy
import (
"github.com/joint-online-judge/JOJ3/internal/stage"
)
type Conf struct {
Score int
Comment string
ForceQuit bool
}
type Dummy struct{}
func (*Dummy) Run(results []stage.ExecutorResult, confAny any) (
[]stage.ParserResult, bool, error,
) {
conf, err := stage.DecodeConf[Conf](confAny)
if err != nil {
return nil, true, err
}
var res []stage.ParserResult
for range results {
res = append(res, stage.ParserResult{Score: conf.Score, Comment: conf.Comment})
}
return res, conf.ForceQuit, nil
}