public CSharpProjectContent() { this.unresolvedFiles = new Dictionary <string, IUnresolvedFile>(Platform.FileNameComparer); this.assemblyReferences = new List <IAssemblyReference>(); this.compilerSettings = new CompilerSettings(); compilerSettings.Freeze(); }
protected CSharpProjectContent(CSharpProjectContent pc) { this.assemblyName = pc.assemblyName; this.fullAssemblyName = pc.fullAssemblyName; this.projectFileName = pc.projectFileName; this.location = pc.location; this.unresolvedFiles = new Dictionary <string, IUnresolvedFile>(pc.unresolvedFiles, Platform.FileNameComparer); this.assemblyReferences = new List <IAssemblyReference>(pc.assemblyReferences); this.compilerSettings = pc.compilerSettings; }
public static ICSharpCode.NRefactory.PlayScript.CompilerSettings GetCompilerArguments(MonoDevelop.Projects.Project project) { var compilerArguments = new ICSharpCode.NRefactory.PlayScript.CompilerSettings(); /// compilerArguments.TabSize = 1; if (project == null || MonoDevelop.Ide.IdeApp.Workspace == null) { compilerArguments.AllowUnsafeBlocks = true; return(compilerArguments); } var configuration = project.GetConfiguration(MonoDevelop.Ide.IdeApp.Workspace.ActiveConfiguration) as DotNetProjectConfiguration; var par = configuration != null ? configuration.CompilationParameters as PlayScriptCompilerParameters : null; if (par == null) { return(compilerArguments); } if (!string.IsNullOrEmpty(par.DefineSymbols)) { foreach (var sym in par.DefineSymbols.Split(';', ',', ' ', '\t').Where(s => !string.IsNullOrWhiteSpace(s))) { compilerArguments.ConditionalSymbols.Add(sym); } } compilerArguments.AllowUnsafeBlocks = par.UnsafeCode; compilerArguments.LanguageVersion = ConvertLanguageVersion(par.LangVersion); compilerArguments.CheckForOverflow = par.GenerateOverflowChecks; compilerArguments.WarningLevel = par.WarningLevel; compilerArguments.TreatWarningsAsErrors = par.TreatWarningsAsErrors; if (!string.IsNullOrEmpty(par.NoWarnings)) { foreach (var warning in par.NoWarnings.Split(';', ',', ' ', '\t')) { int w; try { w = int.Parse(warning); } catch (Exception) { continue; } compilerArguments.DisabledWarnings.Add(w); } } return(compilerArguments); }
public static SyntaxTree Parse(ITextSource textSource, string fileName = "", CompilerSettings settings = null, CancellationToken cancellationToken = default(CancellationToken)) { var parser = new PlayScriptParser(settings); return(parser.Parse(textSource, fileName)); }