Add judge action fields on_hit and on_miss.

This commit is contained in:
2023-05-20 16:23:59 +08:00
parent d1b9b9607b
commit 25b4f3ccb7
5 changed files with 151 additions and 42 deletions

View File

@@ -1,3 +1,4 @@
using Cryville.Common.Collections.Generic;
using Cryville.Common.Pdt;
using System;
using System.Collections.Generic;
@@ -10,11 +11,29 @@ namespace Cryville.Crtr {
readonly List<RulesetSelector> s = new List<RulesetSelector>();
readonly HashSet<string> a = new HashSet<string>();
protected override object InterpretKey(Type type) {
if (type == typeof(Constraint))
if (PairCollection<JudgeAction, PdtExpression>.IsPairCollection(type))
return InterpretJudgeAction();
else if (type == typeof(Constraint))
return InterpretConstraintKey();
else
return base.InterpretKey(type);
}
object InterpretJudgeAction() {
a.Clear();
while (true) {
int pp = Position;
switch (cc) {
case '@':
GetChar();
a.Add(GetIdentifier());
break;
default:
return JudgeAction.Construct(a, (string)base.InterpretKey(null));
}
ws();
if (Position == pp) throw new FormatException("Invalid judge action format.");
}
}
object InterpretConstraintKey() {
s.Clear(); a.Clear();
string key = "";