// Delay timer for internal parsing void InternalParser_Tick(object sender, EventArgs e) { if (currentTab == null || !currentTab.shouldParse) { intParserTimer.Stop(); DEBUGINFO("Stop: Internal Parser"); return; } if (DateTime.Now >= intParser_TimeNext && !parserIsRunning) { intParserTimer.Stop(); DEBUGINFO("Run: Internal Parser"); if (!Settings.enableParser) // Parser off { tbOutputParse.Text = string.Empty; parserLabel.Text = "Parser: Get only macros"; parserLabel.ForeColor = Color.Crimson; new ParserInternal(currentTab, this); CodeFolder.UpdateFolding(currentDocument, currentTab.filename, currentTab.parseInfo.procs); ParserCompleted(currentTab, false); } else { CodeFolder.UpdateFolding(currentDocument, currentTab.filepath); //Quick update procedure data ParserInternal.UpdateProcInfo(ref currentTab.parseInfo, currentDocument.TextContent, currentTab.filepath); } } }
//Force update parser data private void ForceParseScript() { // останавливаем ранее сработавшие таймеры intParserTimer.Stop(); extParserTimer.Stop(); if (Settings.enableParser && currentTab.parseInfo.parseData) { parserIsRunning = true; // parse work CodeFolder.UpdateFolding(currentDocument, currentTab.filepath); bwSyntaxParser.RunWorkerAsync(new WorkerArgs(currentDocument.TextContent, currentTab)); } else { new ParserInternal(currentTab, this); CodeFolder.UpdateFolding(currentDocument, currentTab.filename, currentTab.parseInfo.procs); ParserCompleted(currentTab, false); } }
// 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; }