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[] IntellicodeScanProject() { AssertOpenProject("IntellicodeScanProject"); CWErrors[] errsout = new CWErrors[g.Project.FileList.Count]; for (int i = 0; i < errsout.Length; i++) { errsout[i] = IntellicodeScanFile((g.Project.FileList[i] as CProject.File).ToCWFile()); } return(errsout); }
public static CWErrors IntellicodeScanFile(CWFile File) { AssertOpenProject("IntellicodeScanFile"); AssertValidFile(File, "IntellicodeScanFile"); netMercs.TorqueDev.Lexer.ErrorCollection errcoll = null; CWErrors errout = new CWErrors(File, new ArrayList()); errcoll = g.Main.ScanFile(GetFile(File)); // Translate the errors foreach (netMercs.TorqueDev.Lexer.Error err in errcoll) { errout.file_errors.Add(new CWErrors.CWError( err.Text, err.Line, err.Column)); } return(errout); }
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); }