Ejemplo n.º 1
0
        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++;
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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);
        }