public RTTemplateContext(string srcText, IRTMatch data, IRTMetadataFactory factory, int totalMatchCount) : base(factory) { this._srcText = srcText; this._matchInput = data; this._totalMatchCount = totalMatchCount; }
public string Execute(IRTMatch data, int totalMatchCount) { Init(); RTExecutionContext context = new RTTemplateContext(_templateExpr, data, _factory, totalMatchCount); var result = _interpreter.Execute(context); if (context.HasError) { throw new RTExecutionException(context.Errors, ErrorMessages.Template_Execution_Error); } if (result == null) { return null; } else { return result.ToString(); } }
public string Execute(IRTMatch data) { return Execute(data, data == null ? 0 : 1); }
internal string Execute(string expr, IRTMatch values, int count) { //init MatchValues = values; MatchId = values == null ? -1 : values.MatchIndex; MatchCount = count; _inExpr = false; buffer.Clear(); _exprDepth = 0; int index = 0; while (true) { int startIndex = index; if (startIndex >= expr.Length) break; TokenType token = ReadToken(expr, ref index); Debug.Assert(token == TokenType.None); //other types are handled in expression if (index > startIndex) { AppendEscape(expr, startIndex, index - startIndex, '{'); } if (_inExpr) //next token is { { var retval = Execute(expr, ref index); buffer.Append(retval); } } return buffer.ToString(); }