public static MainFunc Find(string str) { Match match = Is.MatchesAll(str); if (match == null) { return(null); } var returnIntOrVoid = new MemberName("int"); if (match.Groups["MainFunc_returnInt"].ToString() == "") { returnIntOrVoid = new MemberName("void"); } var statements = Statements.Find(match.Groups["MainFunc_statements"].ToString()); if (statements == null) { return(null); } return(new MainFunc { returnIntOrVoid = returnIntOrVoid, _statements = statements, argsName = new LocalVaribleName(match.Groups["MainFunc_argsName"].ToString()) }); }