public void UpdateModule(string filename, string srcText, int flags) { filename = EditorDataProvider.normalizePath(filename); DModule ast; try { ast = DParser.ParseString(srcText, false, true, _taskTokens); } catch (Exception ex) { ast = new DModule { ParseErrors = new System.Collections.ObjectModel.ReadOnlyCollection <ParserError>( new List <ParserError> { new ParserError(false, ex.Message + "\n\n" + ex.StackTrace, DTokens.Invariant, CodeLocation.Empty) }) }; //WTF } if (string.IsNullOrEmpty(ast.ModuleName)) { ast.ModuleName = Path.GetFileNameWithoutExtension(filename); } ast.FileName = filename; _modules [filename] = ast; _sources[filename] = srcText; GlobalParseCache.AddOrUpdateModule(ast); _editorDataProvider.OnSourceChanged(); //MessageBox.Show("UpdateModule(" + filename + ")"); //throw new NotImplementedException(); _activityCounter++; }
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 IsBinaryOperator(string filename, uint startLine, uint startIndex, uint endLine, uint endIndex, out bool pIsOp) { filename = EditorDataProvider.normalizePath(filename); var ast = GetModule(filename); if (ast == null) { throw new COMException("module not found", 1); } //MessageBox.Show("IsBinaryOperator()"); throw new NotImplementedException(); }
public void GetBinaryIsInLocations(string filename, out object locs) // array of pairs of DWORD { filename = EditorDataProvider.normalizePath(filename); var ast = GetModule(filename); if (ast == null) { throw new COMException("module not found", 1); } var visitor = new BinaryIsInVisitor(); ast.Accept(visitor); locs = visitor.locs.ToArray(); }
public VDServerDisposable(params string[] moduleCodes) { _moduleCodes = moduleCodes; ModuleFileNames = new string[moduleCodes.Length]; var tempDirectory = Path.GetTempPath(); _subFolder = Path.Combine(tempDirectory, "vdserver_test" + Interlocked.Increment(ref _folderSuffix)); _subFolder = EditorDataProvider.normalizeDir(_subFolder); Directory.CreateDirectory(_subFolder); for (var fileIterator = 0; fileIterator < moduleCodes.Length; fileIterator++) { var file = Path.Combine(_subFolder, "test" + fileIterator + ".d"); ModuleFileNames[fileIterator] = file; File.WriteAllText(file, moduleCodes[fileIterator]); } FirstModuleFile = ModuleFileNames.Length > 0 ? ModuleFileNames[0] : String.Empty; GlobalParseCache.ParseTaskFinished += ParseTaskFinished; }
public void GetParseErrors(string filename, out string errors) { filename = EditorDataProvider.normalizePath(filename); var ast = GetModule(filename); if (ast == null) { throw new COMException("module not found", 1); } var asterrors = ast.ParseErrors; var errs = new StringBuilder(); foreach (var err in asterrors) { errs.Append($"{err.Location.Line},{err.Location.Column - 1},{err.Location.Line},{err.Location.Column}:{err.Message}\n"); } errors = errs.ToString(); //MessageBox.Show("GetParseErrors()"); //throw new COMException("No Message", 1); }
public void GetCommentTasks(string filename, out string tasks) { filename = EditorDataProvider.normalizePath(filename); var ast = GetModule(filename); if (ast == null) { throw new COMException("module not found", 1); } var tsks = new StringBuilder(); if (ast.Tasks != null) { foreach (var task in ast.Tasks) { tsks.Append($"{task.Location.Line},{task.Location.Column - 1}:{task.Message}\n"); } } tasks = tsks.ToString(); //MessageBox.Show("GetCommentTasks()"); //throw new COMException("No Message", 1); }