1
Vote

error parsing does not work for nvidia opencl

description

update Compiler.Compile as:
if (temp != null && temp.Count > 0)
            {
                var items = temp[0].Split(new string[] { "\n\n" }, StringSplitOptions.RemoveEmptyEntries);
                foreach (var item in items)
                {
                    var err = ErrorItem.Parse(item);
                    if (err != null)
                        logs.Add(err);
                }
//here
                if (logs.Count == 0) {
                    items = temp[0].Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (var item in items)  {
                        var err = ErrorItem.ParseNvidia(item);
                        if (err != null)  logs.Add(err);
                    }
                }
                logs.Sort((i1, i2) =>
                    {
                        int comp = i1.type.CompareTo(i2.type);
                       ...
and add method ErrorItem.ParseNvidia:
    public static ErrorItem ParseNvidia(string text)
    {
        ErrorItem result = new ErrorItem();
        var m = Regex.Match(text, @"^:\s*(?<line>\d+)\s*:\s*(?<pos>\d+)\s*:\s*(?<type>\w+):(?<desc>.*)", RegexOptions.Singleline);
        if (!m.Success)
            return null;
        result.desc = m.Groups["desc"].Value.Replace('\n', ' ').Replace("\t", " ").Trim();
        while (result.desc.Contains("  "))
            result.desc = result.desc.Replace("  ", " ");
        result.line = int.Parse(m.Groups["line"].Value);
        result.pos = int.Parse(m.Groups["pos"].Value);
        result.type = m.Groups["type"].Value == "error" ? ErrorItemType.Error : ErrorItemType.Warning;
        return result;
    }

comments