diff --git a/Expression.cs b/Expression.cs index 9d2f244..4248e18 100644 --- a/Expression.cs +++ b/Expression.cs @@ -27,7 +27,11 @@ public Expression(String text, ExecutionContext context) public object GetValue() { - return GetValueOfTerm(rootTerm); + Object value = GetValueOfTerm(rootTerm); + if (value is SpecialValue) + value = ((SpecialValue)value).Value; + + return value; } public object GetValueOfTerm(Term term) @@ -248,6 +252,14 @@ private object TryProcessStructure(Term input) output = ((SpecialValue)baseTermValue).GetSuffix(suffixTerm.Text.ToUpper()); if (output != null) return output; + // Check if the SpecialValues projection is another SpesialValue that possible supports the suffux. + if (baseTermValue != ((SpecialValue)baseTermValue).Value && ((SpecialValue)baseTermValue).Value is SpecialValue) + { + baseTermValue = ((SpecialValue)baseTermValue).Value; + output = ((SpecialValue)baseTermValue).GetSuffix(suffixTerm.Text.ToUpper()); + if (output != null) return output; + } + throw new kOSException("Suffix '" + suffixTerm.Text + "' not found on object", executionContext); } else diff --git a/SpecialValue.cs b/SpecialValue.cs index 7387968..2a37dda 100644 --- a/SpecialValue.cs +++ b/SpecialValue.cs @@ -7,6 +7,11 @@ namespace kOS { public class SpecialValue { + public virtual Object Value + { + get { return this; } + } + public virtual bool SetSuffix(String suffixName, object value) { return false;