public object Resolve(ITokenErrLog tok, object scope, ResolvedEnoughDelegate isItResolvedEnough = null) { DelimOp op = sourceMeta as DelimOp; if (op != null) { return(op.resolve.Invoke(tok, this, scope, isItResolvedEnough)); } List <object> finalTerms = ResolveTerms(tok, scope, tokens, isItResolvedEnough); object result = finalTerms; if (rules != null && rules.Simplify != null) { if (isItResolvedEnough != null && isItResolvedEnough.Invoke(result)) { return(result); } result = rules.Simplify.Invoke(finalTerms); } return(result); }
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(); }