public TargetCodeResult Compile(SourceCode aSourceCode, string aCurrentCodeLine, int aLinePosition) { String line = aCurrentCodeLine; if (aSourceCode.ContainKeyword(aCurrentCodeLine, "override")) line = aSourceCode.RemoveKeyword(line, "override"); if (aSourceCode.ContainKeyword(aCurrentCodeLine, "virtual")) line = aSourceCode.RemoveKeyword(line,"virtual"); if (aSourceCode.ContainKeyword(aCurrentCodeLine, "internal")) line = aSourceCode.ReplaceKeyword(line, "internal", "protected"); if (aSourceCode.ContainKeyword(aCurrentCodeLine, "internal protected")) line = aSourceCode.ReplaceKeyword(line, "internal protected", "protected"); StringBuilder newLine = new StringBuilder(); newLine.Append(line); // TODO: We need to b able to indicate exception per method not just for all methods //if (aSourceCode.Arguments.ContainProgramArgument("throwexceptions")) //newLine.Append(" throws Exception"); return new TargetCodeResult(newLine.ToString()); }
private static String GetUsingNamespace(SourceCode aSourceCode, string aCurrentCodeLine) { String usingNamespace = aCurrentCodeLine; usingNamespace = aSourceCode.ReplaceKeyword(usingNamespace, "using", "").Trim(); usingNamespace = usingNamespace.Replace(";", "").Trim(); return usingNamespace; }