Example #1
0
        internal void ShowInfo(NemerleSource source)
        {
            if (!IsAutoUpdate)
            {
                return;
            }

            Action action = () =>
            {
                _checkCountLabel.Text = (++_checkCount).ToString();
                _items.Clear();
                ProjectInfo projectInfo = source.ProjectInfo;

                if (projectInfo == null || !projectInfo.Engine.IsProjectAvailable)
                {
                    return;
                }

                switch (_displayType.SelectedIndex)
                {
                case 0:                         // Tokens
                    string code = source.GetText();

                    LexerBase lex = new LexerString((ManagerClass)projectInfo.Engine, code,
                                                    new Location(source.FileIndex, 1, 1));
                    //lex.BeginParseFile();
                    lex.Keywords = lex.Manager.CoreEnv.Keywords;
                    AstUtils.FillList(lex, _items);
                    break;

                case 1:                         // AST
                                                //var ns = projectInfo.Engine.Project.CompileUnits
                                                //	                    .GetTopNamespace(source.FileIndex);
                                                //AstUtils.FillList(ns, _items);
                    break;
                }

                _grid.RowCount = _items.Count;
                _grid.Invalidate();
                _grid.Update();
            };

            _checkCountLabel.BeginInvoke(action);
        }
Example #2
0
        internal void ShowInfo(NemerleSource source)
        {
            if (!IsAutoUpdate)
                return;

            Action action = () =>
            {
                _checkCountLabel.Text = (++_checkCount).ToString();
                _items.Clear();
                ProjectInfo projectInfo = source.ProjectInfo;

                if (projectInfo == null || !projectInfo.Engine.IsProjectAvailable)
                    return;

                switch (_displayType.SelectedIndex)
                {
                    case 0: // Tokens
                        string code = source.GetText();

                        LexerBase lex = new LexerString((ManagerClass)projectInfo.Engine, code,
                            new Location(source.FileIndex, 1, 1));
                        //lex.BeginParseFile();
                        lex.Keywords = lex.Manager.CoreEnv.Keywords;
                        AstUtils.FillList(lex, _items);
                        break;
                    case 1: // AST
                        //var ns = projectInfo.Engine.Project.CompileUnits
                        //	                    .GetTopNamespace(source.FileIndex);
                        //AstUtils.FillList(ns, _items);
                        break;
                }

                _grid.RowCount = _items.Count;
                _grid.Invalidate();
                _grid.Update();
            };

            _checkCountLabel.BeginInvoke(action);
        }