public ParamCollection Add(string s) { Match m = this.StartMatch(s); ParamCollection pc = null; if (m.Success) { s = s.Remove(m.Index, m.Length).Trim(); string file_name = m.Groups[FILE_NAME].Value; if (file_name != null) { StringParser parser; if (Parsers.TryGetValue(file_name.GetHashCode(), out parser)) { pc = Result[Result.Add(parser.Parse(ref s))]; foreach (string fname in pc.Files.Values) { //this.Files.Add(fname.Trim().GetHashCode(), pc); this.Files.Add(Files.Count + 1, pc); } } } } return(pc); }
private ParamCollection Parse(ref string s, string pattern, bool remove, string tag, RegexOptions options) { ParamCollection cmd = new ParamCollection(Name); Regex rex = new Regex(pattern, options); Match m1 = rex.Match(s); while (m1.Success) { string param = m1.Groups[PARAM].Value; string arg = m1.Groups[ARGS].Value; if (param != null) { param = param.TrimEnd(' '); ArgCollection prm = cmd.Add(param, new ArgCollection(param, tag)); if (arg != null) { arg = arg.TrimEnd(' '); if (!string.IsNullOrEmpty(arg)) { prm.Add(arg); } } } if (remove) { s = s.Remove(m1.Index, m1.Length).Trim(); m1 = rex.Match(s); } else { m1 = rex.Match(s, m1.Index + m1.Length); } } return(cmd); }
protected string Match(ref Regex rex, ref ParamCollection result, ref Match m, string s, string group, string tag) { string file_name = m.Groups[group].Value.Trim(); result.Add(file_name, new ArgCollection(file_name, tag)); s = s.Remove(m.Index, m.Length).Trim(); m = rex.Match(s); return(s); }
public override ParamCollection Parse(ref string s) { ParamCollection result = base.Parse(ref s); Regex file = new Regex(FILE_REGEX); Match m = file.Match(s); while (m.Success) { result.Files.Add(result.Files.Count + 1, m.Groups[FILE].Value); s = Match(ref file, ref result, ref m, s, FILE, "input-file-list"); } return(result); }