private bool TryGetValue_String(Token token) { //memberValue = token.ToString(s); CodeRules.op_ResolveToken(tok, token, scope, out memberValue, out Type _memberType); if (memberType == null || memberValue == null || (!memberType.IsAssignableFrom(memberValue.GetType()) && !CodeConvert.TryConvert(ref memberValue, memberType))) { AddError("unable to convert (" + memberValue + ") to type '" + memberType + "'"); return(false); } return(true); }
public object Resolve(ITokenErrLog tok, object scope, ResolvedEnoughDelegate isItResolvedEnough = null) { if (isItResolvedEnough != null && isItResolvedEnough(this)) { return(this); } if (index == -1 && length == -1) { return(meta); } if (meta == null) { throw new NullReferenceException("can't resolve NULL token"); } switch (meta) { case string s: { string str = ToString(s); //Show.Log("@@@ "+str+" "+scope); if (scope != null && (isItResolvedEnough == null || isItResolvedEnough.Invoke(str))) { if (CodeRules.op_SearchForMember(str, out object value, out Type type, scope)) { //Show.Log(str+" "+foundIt+" "+value); return(value); } } return(str); } case TokenSubstitution ss: return(ss.value); case Delim d: return(d.text); case SyntaxTree pce: return(pce.Resolve(tok, scope, isItResolvedEnough)); } throw new DecoderFallbackException(); }