public void Translate(string code, ITemplateBuilder templateBuilder) { if (templateBuilder == null) { throw new ArgumentNullException("templateBuilder"); } templateBuilder.AddCodeBlock(code); }
public void Translate(string code, ITemplateBuilder templateBuilder) { if (code == null) { throw new ArgumentNullException("code"); } if (templateBuilder == null) { throw new ArgumentNullException("templateBuilder"); } templateBuilder.AddCodeBlock(CleanContentForCode(code)); }
public void Translate(string code, ITemplateBuilder templateBuilder) { if (code == null) { throw new ArgumentNullException("code"); } if (templateBuilder == null) { throw new ArgumentNullException("templateBuilder"); } Match match = Regex.Match(code, FOREACH_REGEX); templateBuilder.AddCodeBlock(String.Format("for(var __i=0; __i<{0}.length; __i++) {{ var {1} = {0}[__i]; ", match.Groups["Enumerator"].Value, match.Groups["Variable"].Value)); }