public static CWErrors IntellicodeScanString(string code) { // Scan a piece of code for errors CWErrors errs = new CWErrors(null, new ArrayList()); MemoryStream stream_code = new MemoryStream(System.Text.ASCIIEncoding.ASCII.GetBytes(code)); // Load up the lexer into memory netMercs.TorqueDev.Lexer.Scanner scanner = new netMercs.TorqueDev.Lexer.Scanner(stream_code); netMercs.TorqueDev.Lexer.Parser parser = new netMercs.TorqueDev.Lexer.Parser(scanner); // Parse the code parser.Parse(); // Translate the errors foreach (netMercs.TorqueDev.Lexer.Error err in parser.errors.ErrCollection) { errs.file_errors.Add(new CWErrors.CWError( err.Text, err.Line, err.Column)); } stream_code.Close(); return(errs); }
public static CWErrors IntellicodeScanExternalFile(string path) { // Scan a file for errors CWErrors errs = new CWErrors(null, new ArrayList()); // Load up the lexer into memory netMercs.TorqueDev.Lexer.Scanner scanner = new netMercs.TorqueDev.Lexer.Scanner(path); netMercs.TorqueDev.Lexer.Parser parser = new netMercs.TorqueDev.Lexer.Parser(scanner); // Parse the code parser.Parse(); // Translate the errors foreach (netMercs.TorqueDev.Lexer.Error err in parser.errors.ErrCollection) { errs.file_errors.Add(new CWErrors.CWError( err.Text, err.Line, err.Column)); } return(errs); }
private void tmrErrorMonitor_Tick(object sender, System.EventArgs e) { // If this is a text file, don't scan for errors if (g_curFile.isText) { this.tmrErrorMonitor.Enabled = false; return; } // Disable the timer if we're not requiring it if (g.Config.b_Err_WhileTyping == false) { this.tmrErrorMonitor.Enabled = false; return; } if (this._LastMoved) { this._LastMoved = false; return; } if (this.txtEditor.Text != this._LastText) { MemoryStream mem = new MemoryStream(System.Text.ASCIIEncoding.ASCII.GetBytes(txtEditor.Document.GetText(LineEndStyle.CarriageReturnNewline))); mem.Position = 0; netMercs.TorqueDev.Lexer.Scanner scanner = new netMercs.TorqueDev.Lexer.Scanner(mem); netMercs.TorqueDev.Lexer.Parser parser = new netMercs.TorqueDev.Lexer.Parser(scanner); parser.Parse(); netMercs.TorqueDev.Lexer.ErrorCollection errcoll = (netMercs.TorqueDev.Lexer.ErrorCollection)parser.errors.ErrCollection.Clone(); parser = null; scanner = null; mem.Close(); if (g.Project.ErrorList.Contains(this.g_curFile)) g.Project.ErrorList[this.g_curFile] = errcoll; else g.Project.ErrorList.Add(this.g_curFile, errcoll); this._LastText = this.txtEditor.Text; // Render the squiggles ErrorRender(); // Render the treeview g.Main.ScanBuildTree(); } else { // Just render the error if the text didn't change ErrorRender(); } }
public static CWErrors IntellicodeScanString(string code) { // Scan a piece of code for errors CWErrors errs = new CWErrors(null, new ArrayList()); MemoryStream stream_code = new MemoryStream(System.Text.ASCIIEncoding.ASCII.GetBytes(code)); // Load up the lexer into memory netMercs.TorqueDev.Lexer.Scanner scanner = new netMercs.TorqueDev.Lexer.Scanner(stream_code); netMercs.TorqueDev.Lexer.Parser parser = new netMercs.TorqueDev.Lexer.Parser(scanner); // Parse the code parser.Parse(); // Translate the errors foreach (netMercs.TorqueDev.Lexer.Error err in parser.errors.ErrCollection) { errs.file_errors.Add(new CWErrors.CWError( err.Text, err.Line, err.Column)); } stream_code.Close(); return errs; }
public static CWErrors IntellicodeScanExternalFile(string path) { // Scan a file for errors CWErrors errs = new CWErrors(null, new ArrayList()); // Load up the lexer into memory netMercs.TorqueDev.Lexer.Scanner scanner = new netMercs.TorqueDev.Lexer.Scanner(path); netMercs.TorqueDev.Lexer.Parser parser = new netMercs.TorqueDev.Lexer.Parser(scanner); // Parse the code parser.Parse(); // Translate the errors foreach (netMercs.TorqueDev.Lexer.Error err in parser.errors.ErrCollection) { errs.file_errors.Add(new CWErrors.CWError( err.Text, err.Line, err.Column)); } return errs; }