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 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 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); }