Rename constraint types to avoid ambiguity.
This commit is contained in:
@@ -146,7 +146,7 @@ namespace Cryville.Crtr {
|
||||
[ElementList]
|
||||
public PairList<RulesetSelectors, Constraint> Elements = new PairList<RulesetSelectors, Constraint>();
|
||||
[PropertyList]
|
||||
public PairList<PropertyKey, PdtExpression> Properties = new PairList<PropertyKey, PdtExpression>();
|
||||
public PairList<ConstraintKey, PdtExpression> Properties = new PairList<ConstraintKey, PdtExpression>();
|
||||
public void Optimize(PdtEvaluatorBase etor) {
|
||||
foreach (var e in Properties) {
|
||||
etor.Optimize(e.Value);
|
||||
@@ -164,13 +164,13 @@ namespace Cryville.Crtr {
|
||||
foreach (var prop in Properties) {
|
||||
var name = prop.Key.Name;
|
||||
switch (prop.Key.Type) {
|
||||
case PropertyType.Property:
|
||||
case ConstraintType.Property:
|
||||
if (ev.PropSrcs.TryGetValue(name, out src))
|
||||
etor.ContextSelfValue = src;
|
||||
etor.Evaluate(ev.PropOps[name], prop.Value);
|
||||
etor.ContextSelfValue = null;
|
||||
break;
|
||||
case PropertyType.Variable:
|
||||
case ConstraintType.Variable:
|
||||
_arbop.Name = name;
|
||||
etor.Evaluate(_arbop, prop.Value);
|
||||
break;
|
||||
@@ -187,22 +187,22 @@ namespace Cryville.Crtr {
|
||||
etor.ContextCascadeDiscard();
|
||||
}
|
||||
}
|
||||
public class PropertyKey {
|
||||
public PropertyType Type { get; private set; }
|
||||
public class ConstraintKey {
|
||||
public ConstraintType Type { get; private set; }
|
||||
public int Name { get; private set; }
|
||||
public PropertyKey(PropertyType type, string name) {
|
||||
public ConstraintKey(ConstraintType type, string name) {
|
||||
Type = type;
|
||||
Name = IdentifierManager.Shared.Request(name);
|
||||
}
|
||||
public override string ToString() {
|
||||
switch (Type) {
|
||||
case PropertyType.Property: return (string)IdentifierManager.Shared.Retrieve(Name);
|
||||
case PropertyType.Variable: return string.Format("@var {0}", IdentifierManager.Shared.Retrieve(Name));
|
||||
case ConstraintType.Property: return (string)IdentifierManager.Shared.Retrieve(Name);
|
||||
case ConstraintType.Variable: return string.Format("@var {0}", IdentifierManager.Shared.Retrieve(Name));
|
||||
default: return string.Format("<{0}> {1}", Type, IdentifierManager.Shared.Retrieve(Name));
|
||||
}
|
||||
}
|
||||
}
|
||||
public enum PropertyType {
|
||||
public enum ConstraintType {
|
||||
Property,
|
||||
Variable,
|
||||
}
|
||||
|
@@ -59,7 +59,7 @@ namespace Cryville.Crtr {
|
||||
break;
|
||||
case ';':
|
||||
case ':':
|
||||
return new PropertyKey(a.Contains("var") ? PropertyType.Variable : PropertyType.Property, key);
|
||||
return new ConstraintKey(a.Contains("var") ? ConstraintType.Variable : ConstraintType.Property, key);
|
||||
case '{':
|
||||
return new RulesetSelectors(s);
|
||||
case '}':
|
||||
|
Reference in New Issue
Block a user