private void ParseFromBacktrace(MutableString message, RubyArray backtrace) { m_message = message.ToString(); var trace = backtrace.Cast <MutableString>().Select((line) => line.ToString().Trim()); var rubyPathLine = from line in trace let match = Regex.Match(line, @"(.*\.rb):(\d+)(:in\s+(.*))?$") let groupCnt = match.Groups.Count where match.Success let innerLoc = match.Groups[4].Value select new { FilePath = match.Groups[1].Value, FileLine = int.Parse(match.Groups[2].Value), InnerLoc = String.IsNullOrEmpty(innerLoc) ? "<top>" : innerLoc }; var infoObj = rubyPathLine.FirstOrDefault(); if (infoObj != null) { m_hasInfo = true; m_format = ErrorMessageFormat.Error; m_message = String.Format("{0} (in {1})", m_message, infoObj.InnerLoc); m_path = infoObj.FilePath; m_line = infoObj.FileLine; } }
public override void ErrorReported(ScriptSource source, string message, SourceSpan span, int errorCode, Severity severity) { m_hasInfo = true; m_message = message; m_path = source.Path; m_line = span.Start.Line; m_col = span.Start.Column; switch (severity) { case Severity.Error: case Severity.FatalError: m_format = ErrorMessageFormat.Error; break; case Severity.Ignore: case Severity.Warning: m_format = ErrorMessageFormat.Warning; break; } }
private void ParseFromBacktrace(MutableString message, RubyArray backtrace) { m_message = message.ToString(); var trace = backtrace.Cast<MutableString>().Select((line) => line.ToString().Trim()); var rubyPathLine = from line in trace let match = Regex.Match(line, @"(.*\.rb):(\d+)(:in\s+(.*))?$") let groupCnt = match.Groups.Count where match.Success let innerLoc = match.Groups[4].Value select new { FilePath = match.Groups[1].Value, FileLine = int.Parse(match.Groups[2].Value), InnerLoc = String.IsNullOrEmpty(innerLoc) ? "<top>" : innerLoc }; var infoObj = rubyPathLine.FirstOrDefault(); if (infoObj != null) { m_hasInfo = true; m_format = ErrorMessageFormat.Error; m_message = String.Format("{0} (in {1})", m_message, infoObj.InnerLoc); m_path = infoObj.FilePath; m_line = infoObj.FileLine; } }
public override void ErrorReported(ScriptSource source, string message, SourceSpan span, int errorCode, Severity severity) { m_hasInfo = true; m_message = message; m_path = source.Path; m_line = span.Start.Line; m_col = span.Start.Column; switch (severity) { case Severity.Error: case Severity.FatalError: m_format = ErrorMessageFormat.Error; break; case Severity.Ignore: case Severity.Warning: m_format = ErrorMessageFormat.Warning; break; } }
private void OnScriptError(string message, string path, int? line, int? column, ErrorMessageFormat format) { if (ScriptError != null) { var args = new ScriptErrorEventArgs { Message = message, Path = path, Line = (line == null) ? -1 : (int)line, Column = (column == null) ? -1 : (int)column, Type = format }; ScriptError(this, args); } }
private void OnScriptError(string message, string path, int?line, int?column, ErrorMessageFormat format) { if (ScriptError != null) { var args = new ScriptErrorEventArgs { Message = message, Path = path, Line = (line == null) ? -1 : (int)line, Column = (column == null) ? -1 : (int)column, Type = format }; ScriptError(this, args); } }