public CodeController(CodeRules rules, CodeRepository repos, MerlinReadContext readContext, MerlinReadStore readStore) { this.rules = rules; this.repos = repos; this.readContext = readContext; this.readStore = readStore; }
public static string Format(string format, object scope, Tokenizer tokenizer = null) { if (tokenizer == null) { tokenizer = new Tokenizer(); } tokenizer.Tokenize(format, CodeRules.CodeInString); StringBuilder sb = new StringBuilder(); for (int i = 0; i < tokenizer.tokens.Count; ++i) { object obj; Type type; Token token = tokenizer.tokens[i]; CodeRules.op_ResolveToken(tokenizer, token, scope, out obj, out type); sb.Append(obj.ToString()); } return(sb.ToString()); }
/// <summary> /// used to resolve tokens /// </summary> /// <param name="token"></param> /// <param name="tokenizer"></param> /// <param name="scope"></param> /// <param name="data"></param> /// <returns></returns> public static bool TryParse(Token token, out object data, object scope, ITokenErrLog tokenizer) { CodeRules.op_ResolveToken(tokenizer, token, scope, out data, out Type resultType); return(resultType != null); }