Code cleanup.
This commit is contained in:
@@ -348,38 +348,6 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
#region Definitions
|
|
||||||
public class InputDefinition {
|
|
||||||
public int dim;
|
|
||||||
public string pdim;
|
|
||||||
public bool notnull;
|
|
||||||
public PairList<Identifier, PdtExpression> pass;
|
|
||||||
}
|
|
||||||
public class JudgeDefinition {
|
|
||||||
public PdtExpression clip;
|
|
||||||
public PdtExpression input;
|
|
||||||
public PdtExpression hit;
|
|
||||||
public PdtExpression persist;
|
|
||||||
public Identifier[] pass;
|
|
||||||
public Identifier[] miss;
|
|
||||||
public PairList<ScoreOperation, PdtExpression> scores;
|
|
||||||
public int stack;
|
|
||||||
public int prop = 1;
|
|
||||||
}
|
|
||||||
public class ScoreOperation {
|
|
||||||
public Identifier name;
|
|
||||||
public Identifier op;
|
|
||||||
public override string ToString() {
|
|
||||||
if (op == default(Identifier)) return name.ToString();
|
|
||||||
else return string.Format("{0} {1}", name, op);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public class ScoreDefinition {
|
|
||||||
public PdtExpression value;
|
|
||||||
public float init = 0;
|
|
||||||
public string format = "";
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class JudgePropagationException : Exception {
|
public class JudgePropagationException : Exception {
|
||||||
|
|||||||
@@ -65,12 +65,42 @@ namespace Cryville.Crtr {
|
|||||||
constraints.PrePatch(chart);
|
constraints.PrePatch(chart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public class InputDefinition {
|
||||||
|
public int dim;
|
||||||
|
public string pdim;
|
||||||
|
public bool notnull;
|
||||||
|
public PairList<Identifier, PdtExpression> pass;
|
||||||
|
}
|
||||||
public class JudgeDefinitionCollection {
|
public class JudgeDefinitionCollection {
|
||||||
[ElementList]
|
[ElementList]
|
||||||
public Dictionary<Identifier, JudgeDefinition> Judges = new Dictionary<Identifier, JudgeDefinition>();
|
public Dictionary<Identifier, JudgeDefinition> Judges = new Dictionary<Identifier, JudgeDefinition>();
|
||||||
[PropertyList]
|
[PropertyList]
|
||||||
public Dictionary<Identifier, PdtExpression> Areas = new Dictionary<Identifier, PdtExpression>();
|
public Dictionary<Identifier, PdtExpression> Areas = new Dictionary<Identifier, PdtExpression>();
|
||||||
}
|
}
|
||||||
|
public class JudgeDefinition {
|
||||||
|
public int stack;
|
||||||
|
public int prop;
|
||||||
|
public PdtExpression clip;
|
||||||
|
public PdtExpression input;
|
||||||
|
public PdtExpression hit;
|
||||||
|
public PdtExpression persist; // TODO Compat
|
||||||
|
public Identifier[] pass; // TODO Compat
|
||||||
|
public Identifier[] miss; // TODO Compat
|
||||||
|
public PairList<ScoreOperation, PdtExpression> scores; // TODO Compat
|
||||||
|
}
|
||||||
|
public class ScoreOperation {
|
||||||
|
public Identifier name;
|
||||||
|
public Identifier op;
|
||||||
|
public override string ToString() {
|
||||||
|
if (op == default(Identifier)) return name.ToString();
|
||||||
|
else return string.Format("{0} {1}", name, op);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class ScoreDefinition {
|
||||||
|
public PdtExpression value;
|
||||||
|
public float init = 0;
|
||||||
|
public string format = "";
|
||||||
|
}
|
||||||
public class Constraint {
|
public class Constraint {
|
||||||
static readonly PropOp.Arbitrary _arbop = new PropOp.Arbitrary();
|
static readonly PropOp.Arbitrary _arbop = new PropOp.Arbitrary();
|
||||||
[ElementList]
|
[ElementList]
|
||||||
|
|||||||
@@ -10,47 +10,50 @@ namespace Cryville.Crtr {
|
|||||||
readonly List<RulesetSelector> s = new List<RulesetSelector>();
|
readonly List<RulesetSelector> s = new List<RulesetSelector>();
|
||||||
readonly List<string> a = new List<string>();
|
readonly List<string> a = new List<string>();
|
||||||
protected override object InterpretKey(Type type) {
|
protected override object InterpretKey(Type type) {
|
||||||
if (type == typeof(Constraint)) {
|
if (type == typeof(Constraint))
|
||||||
s.Clear(); a.Clear();
|
return InterpretConstraintKey();
|
||||||
string key = "";
|
else
|
||||||
while (true) {
|
return base.InterpretKey(type);
|
||||||
int pp = Position;
|
}
|
||||||
switch (cc) {
|
object InterpretConstraintKey() {
|
||||||
case '@':
|
s.Clear(); a.Clear();
|
||||||
GetChar();
|
string key = "";
|
||||||
a.Add(GetIdentifier());
|
while (true) {
|
||||||
break;
|
int pp = Position;
|
||||||
case '$':
|
switch (cc) {
|
||||||
GetChar();
|
case '@':
|
||||||
s.Add(new RulesetSelector.CreateItem());
|
GetChar();
|
||||||
key = null;
|
a.Add(GetIdentifier());
|
||||||
break;
|
break;
|
||||||
case '#':
|
case '$':
|
||||||
GetChar();
|
GetChar();
|
||||||
s.Add(new RulesetSelector.Index());
|
s.Add(new RulesetSelector.CreateItem());
|
||||||
break;
|
key = null;
|
||||||
case '>':
|
break;
|
||||||
GetChar();
|
case '#':
|
||||||
s.Add(new RulesetSelector.Property(GetExp()));
|
GetChar();
|
||||||
break;
|
s.Add(new RulesetSelector.Index());
|
||||||
case ';':
|
break;
|
||||||
case ':':
|
case '>':
|
||||||
return new PropertyKey(a.Contains("var") ? PropertyType.Variable : PropertyType.Property, key);
|
GetChar();
|
||||||
case '{':
|
s.Add(new RulesetSelector.Property(GetExp()));
|
||||||
return new RulesetSelectors(s);
|
break;
|
||||||
case '}':
|
case ';':
|
||||||
return null;
|
case ':':
|
||||||
default:
|
return new PropertyKey(a.Contains("var") ? PropertyType.Variable : PropertyType.Property, key);
|
||||||
var p4 = GetIdentifier();
|
case '{':
|
||||||
s.Add(new RulesetSelector.EventType(p4));
|
return new RulesetSelectors(s);
|
||||||
if (key != null) key += p4;
|
case '}':
|
||||||
break;
|
return null;
|
||||||
}
|
default:
|
||||||
ws();
|
var p4 = GetIdentifier();
|
||||||
if (Position == pp) throw new FormatException("Invalid selector or key format");
|
s.Add(new RulesetSelector.EventType(p4));
|
||||||
|
if (key != null) key += p4;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
ws();
|
||||||
|
if (Position == pp) throw new FormatException("Invalid selector or key format");
|
||||||
}
|
}
|
||||||
else return base.InterpretKey(type);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user