protected override string Replace(string part) { var parameters = part.Split(",").Where(a => !string.IsNullOrEmpty(a)).ToArray(); if (parameters.Length != Arguments.Count) { throw new IncorrectFunctionDefineArgsCount(Identifier, Arguments.Count, parameters.Length); } // Convert args into individual find/replace defines var defines = new List <FindAndReplace>(); for (var i = 0; i < Arguments.Count; i++) { var arg = Arguments[i]; var val = parameters[i]; defines.Add(new FindAndReplace(arg, val)); } var replacement = Other.Trim(Replacement); var replaced = Apply(replacement, defines); return(replaced); }
public string Apply(string input) { var match = Regex.Match(input, FindRegex); if (!match.Success) { return(input); } var r = Replace(match.Groups["body"].Value); r = Other.Trim(r); var v = input[..match.Index]
private IEnumerable <string> Others() { var run = new List <string>(); foreach (var stmt in Statements.SkipWhile(a => a is not LineLabel)) { if (stmt is Other other) { var content = Other.Trim(other.Content); run.Add(content); } else if (run.Count > 0) { yield return(string.Join("", run)); run.Clear(); } } yield return(string.Join("", run)); }