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