public static void UpdateParseCacheAsync(IEnumerable <string> Cache, bool skipfunctionbodies = false, ParseFinishedHandler onfinished = null) { if (Cache == null) { throw new ArgumentNullException("Cache"); } GlobalParseCache.BeginAddOrUpdatePaths(Cache, skipfunctionbodies, onfinished); }
public static void UpdateParseCacheAsync(IEnumerable <string> Cache, string fallBack, string solutionPath, bool skipfunctionbodies = false, ParseFinishedHandler onfinished = null) { if (Cache == null) { throw new ArgumentNullException("Cache"); } GlobalParseCache.BeginAddOrUpdatePaths(Parser.DParserWrapper.EnsureAbsolutePaths(Cache, fallBack, solutionPath), skipfunctionbodies, finishedHandler: onfinished); }
private void button_ReparseProjSources_Click(object sender, RoutedEventArgs e) { if (ManagedProject == null) { return; } button_ReparsePrjDirectory.IsEnabled = false; GlobalParseCache.BeginAddOrUpdatePaths(new[] { ManagedProject.BaseDirectory }, false, (ParsingFinishedEventArgs ea) => button_ReparsePrjDirectory.IsEnabled = true); }
public static ParseCacheView ParsePhobos(bool ufcs = true) { var dir = "/usr/include/d"; GlobalParseCache.ParseTaskFinished += pc_FinishedParsing; GlobalParseCache.BeginAddOrUpdatePaths(new[] { dir }, false); GlobalParseCache.WaitForFinish(); return(new ParseCacheView(new[] { dir })); }
public void ConfigureSemanticProject(string filename, string imp, string stringImp, string versionids, string debugids, string cmdline, uint flags) { _editorDataProvider.ConfigureEnvironment(imp, versionids, debugids, flags); if (_imports != imp) { string[] uniqueDirs = EditorDataProvider.uniqueDirectories(imp); GlobalParseCache.BeginAddOrUpdatePaths(uniqueDirs, taskTokens: _taskTokens); _activityCounter++; } _imports = imp; }
public void ConfigureSemanticProject(string filename, string imp, string stringImp, string versionids, string debugids, uint flags) { if (_imports != imp) { string[] uniqueDirs = uniqueDirectories(imp); GlobalParseCache.BeginAddOrUpdatePaths(uniqueDirs); } _imports = imp; _stringImports = stringImp; _versionIds = versionids; _debugIds = debugids; _flags = flags; _setupEditorData(); //MessageBox.Show("ConfigureSemanticProject()"); //throw new NotImplementedException(); }
public static async Task SetWorkspaceRoots(IEnumerable <string> workspaceFolders, ProgressManager progressManager, IWorkDoneProgressParams workDoneProgressParams) { WorkspaceFolders.OnNext(workspaceFolders.ToImmutableList()); var completionSource = new TaskCompletionSource <bool>(); var initialParseProgress = progressManager.WorkDone(workDoneProgressParams, new WorkDoneProgressBegin() { Title = "Begin parsing workspace", Percentage = 0 }); var partProgresses = GlobalParseCache.BeginAddOrUpdatePaths(WorkspaceFolders.Value, finishedHandler: ea => { initialParseProgress.OnNext(new WorkDoneProgressReport() { Message = "Done parsing workspace", Percentage = 100 }); initialParseProgress.OnCompleted(); completionSource.SetResult(true); }); int partIndex = 1; foreach (var statisticsHandle in partProgresses) { initialParseProgress.OnNext(new WorkDoneProgressReport() { Percentage = partIndex / partProgresses.Count, Message = "Parse " + statisticsHandle.basePath }); statisticsHandle.WaitForCompletion(); partIndex++; initialParseProgress.OnNext(new WorkDoneProgressReport() { Percentage = partIndex / partProgresses.Count, Message = "Finished parsing " + statisticsHandle.basePath }); } await completionSource.Task; }
public static void Main(string[] args) { /* * var sw2 = new Stopwatch(); * var code = File.ReadAllText(@"B:\Programs\D\dmd2\src\phobos\std\datetime.d"); * sw2.Start(); * var ast = DParser.ParseString(code, true); * sw2.Stop(); * Console.WriteLine (sw2.ElapsedMilliseconds); * return;*/ (new ResolutionTests()).Unqual(); (new EvaluationTests()).IsExpressionAlias(); return; // Indent testing /*var code = @" * "; * var line = 4; * var ind = D_Parser.Formatting.Indent.IndentEngineWrapper.CalculateIndent(code, line, false, 4); * var o = DocumentHelper.LocationToOffset(code, line,1); * * var o2 = o; * while(o2 < code.Length && code[o2] == ' ' || code[o2] == '\t') * o2++; * * code = code.Substring(0,o) + ind + code.Substring(o2); * Console.Write(code+"|"); * * Console.ReadKey(true); * return;*/ // Phobos & Druntime parsing Console.WriteLine("Begin parsing..."); var dirs = Environment.OSVersion.Platform == PlatformID.Unix ? new[] { @"/usr/include/dlang" } : new[] { @"B:\Programs\D\dmd2\src\phobos", @"B:\Programs\D\dmd2\src\druntime\import" }; var dirsLeft = dirs.Length; var ev = new System.Threading.AutoResetEvent(false); GlobalParseCache.BeginAddOrUpdatePaths(dirs, false, (pc) => { Console.WriteLine("{1}ms", pc.Directory, pc.ParseDuration); ev.Set(); }); ev.WaitOne(); Console.WriteLine("done."); Console.WriteLine(); var pcw = new ParseCacheView(dirs); var ccf = new ConditionalCompilationFlags(new[] { Environment.OSVersion.Platform == PlatformID.Unix ?"Posix":"Windows", "D2" }, 1, true, null, 0); Console.WriteLine("Dump parse errors:"); foreach (var dir in dirs) { foreach (var mod in GlobalParseCache.EnumModulesRecursively(dir)) { if (mod.ParseErrors.Count > 0) { Console.WriteLine(" " + mod.FileName); Console.WriteLine(" (" + mod.ModuleName + ")"); foreach (var err in mod.ParseErrors) { Console.WriteLine("({0}):", err.Location.ToString()); Console.WriteLine("\t" + err.Message); } } } } Console.WriteLine(); Console.Write("Press any key to continue . . . "); Console.ReadKey(true); }
public void ReparseImportDirectories() { InitialParsingDone = false; GlobalParseCache.BeginAddOrUpdatePaths(tempImports = ImportDirectories.ToArray(), true, parsedSources); }
/// <summary> /// Parse all D sources that belong to the project /// </summary> public void ParseDSourcesAsync() { GlobalParseCache.BeginAddOrUpdatePaths(new[] { BaseDirectory }, false); }