public void ParseError(string msg, params object[] args) { if (lastFileNamePrinted != FileName) { lastFileNamePrinted = FileName; Console.WriteLine("File {0}:", lastFileNamePrinted); } AssemblerErrors.AddError(FileName, String.Format(msg, args)); }
private void errorHandler(object sendingProcess, DataReceivedEventArgs outLine) { // parse the line of error output; it has the following format // FILENAME:LINENUMBER: ERROR MESSAGE string line = outLine.Data; if (line == null) { return; } int lineNum; // look for 2 consecutive colons separated only by decimal digits int colon1pos = -1; int colon2pos = -1; do { colon2pos = line.IndexOf(':', colon1pos + 1); if (colon2pos <= colon1pos) { return; } lineNum = 0; for (int i = colon1pos + 1; i < colon2pos; i++) { char c = line[i]; if (!Char.IsDigit(c)) { colon1pos = colon2pos; break; } lineNum = lineNum * 10 + (int)c - (int)'0'; } } while (colon1pos == colon2pos); string message = line.Substring(colon2pos + 1); AssemblerErrors.AddError(fileName, lineNum, 0, message); errorCnt++; }