diff --git a/internal/parser/all.go b/internal/parser/all.go index 0f9e445..819bff7 100644 --- a/internal/parser/all.go +++ b/internal/parser/all.go @@ -4,6 +4,7 @@ import ( _ "github.com/joint-online-judge/JOJ3/internal/parser/clangtidy" _ "github.com/joint-online-judge/JOJ3/internal/parser/cppcheck" _ "github.com/joint-online-judge/JOJ3/internal/parser/cpplint" + _ "github.com/joint-online-judge/JOJ3/internal/parser/debug" _ "github.com/joint-online-judge/JOJ3/internal/parser/diff" _ "github.com/joint-online-judge/JOJ3/internal/parser/dummy" _ "github.com/joint-online-judge/JOJ3/internal/parser/healthcheck" diff --git a/internal/parser/debug/meta.go b/internal/parser/debug/meta.go new file mode 100644 index 0000000..a1d807b --- /dev/null +++ b/internal/parser/debug/meta.go @@ -0,0 +1,9 @@ +package debug + +import "github.com/joint-online-judge/JOJ3/internal/stage" + +var name = "debug" + +func init() { + stage.RegisterParser(name, &Debug{}) +} diff --git a/internal/parser/debug/parser.go b/internal/parser/debug/parser.go new file mode 100644 index 0000000..4efc6f6 --- /dev/null +++ b/internal/parser/debug/parser.go @@ -0,0 +1,36 @@ +package debug + +import ( + "log/slog" + + "github.com/joint-online-judge/JOJ3/internal/stage" +) + +type Conf struct{} + +type Debug struct{} + +func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult { + slog.Debug("debug parser", "executorResult", executorResult) + for name, content := range executorResult.Files { + slog.Debug("debug parser file", "name", name, "content", content) + } + return stage.ParserResult{ + Score: 0, + Comment: "", + } +} + +func (*Debug) 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 _, result := range results { + res = append(res, Parse(result, *conf)) + } + return res, false, nil +}