コード例 #1
0
        private void ParserCompleted(TabInfo tab, bool parseIsFail)
        {
            if (currentTab == tab)
            {
                //Procedure[] procs = null;
                //if (parseIsFail) { // предыдущая попытка парсинга была неудачной
                //    procs = ParserInternal.GetProcsData(tab.textEditor.Text, tab.filepath); // обновить данные об имеющихся процедур (для чего?)
                //}
                HighlightProcedures.UpdateList(tab.textEditor.Document, tab.parseInfo.procs); //(!parseIsFail) ? tab.parseInfo.procs : procs
                UpdateNames();                                                                // Update Tree Variables/Procedures

                if (tab.filepath != null)
                {
                    if (tab.parseInfo.parseData)                                         //.parsed
                    {
                        if (tab.textEditor.Document.FoldingManager.FoldMarker.Count > 0) //tab.parseInfo.procs.Length
                        {
                            Outline_toolStripButton.Enabled = true;
                        }

                        if (Settings.enableParser)
                        {
                            parserLabel.Text = (!tab.parseInfo.parseError) ? "Parser: Complete" : "Parser: Script syntax error (see parser errors log)";
                        }
                        else
                        {
                            parserLabel.Text = parseoff + " [Get only macros]";
                        }
                    }
                    else
                    {
                        parserLabel.Text = (Settings.enableParser) ? "Parser: Failed script parsing (see parser errors log)" : parseoff + " [Get only macros]";
                        //currentTab.needsParse = true; // требуется обновление
                    }
                    tab.needsParse = false;
                }
                else
                {
                    parserLabel.Text = (Settings.enableParser) ? "Parser: Get only local macros" : parseoff;
                }
            }
            GetParserErrorLog(tab);
            // Event for update
            if (ParserUpdatedInfo != null)
            {
                ParserUpdatedInfo(this, EventArgs.Empty);
            }
        }
コード例 #2
0
        // Parse first open script
        private void FirstParseScript(TabInfo cTab)
        {
            cTab.textEditor.Document.ExtraWordList = new HighlightExtraWord();

            tbOutputParse.Text = string.Empty;

            firstParse = true;

            GetMacros.GetGlobalMacros(Settings.pathHeadersFiles);

            DEBUGINFO("First Parse...");
            new ParserInternal(cTab, this);

            //while (parserIsRunning) System.Threading.Thread.Sleep(10); // Avoid stomping on files while the parser is running

            var ExtParser = new ParserExternal(firstParse);

            cTab.parseInfo = ExtParser.Parse(cTab.textEditor.Text, cTab.filepath, cTab.parseInfo);
            DEBUGINFO("External first parse status: " + ExtParser.LastStatus);

            HighlightProcedures.AddAllToList(cTab.textEditor.Document, cTab.parseInfo.procs);
            CodeFolder.UpdateFolding(cTab.textEditor.Document, cTab.filename, cTab.parseInfo.procs);
            CodeFolder.GetProceduresCollapse(cTab.textEditor.Document, cTab.filename);

            GetParserErrorLog(cTab);

            if (cTab.parseInfo.parseError)
            {
                tabControl2.SelectedIndex = 2;
                if (WindowState != FormWindowState.Minimized)
                {
                    MaximizeLog();
                }
            }
            firstParse = false;
        }