我想为vim-opencl 插件编写 OpenCL 语法检查器。OpenCL 编译器对输出错误进行了一些奇怪的格式化。有两种类型的错误。
正常(带有小错误说明):
"/tmp/OCLUKvOsF.cl", line 143: error: expression must have integral type
rec_table[PRIME_P - ri] = PRIME_P - i;
^
并且错误解释中的换行符不正常:
"/tmp/OCLUKvOsF.cl", line 148: error: a value of type "uint16" cannot be used
to initialize an entity of type "uint"
uint a = value, b = PRIME_P, u = 0, v = 0;
^
因此,麻烦在于将第二种情况下的损坏错误解释和第一种情况下的正常错误处理的两部分串联起来。
我使用syntastic作为通用语法检查器。现在我有这样的代码:
let errorformat = '%E"%f"\, line %l: error: %m,%+C%.%#,%-Z%p^,'.
\'%W"%f"\, line %l: warning: %m,%-C%.%#,'.
\'%-G%.%#'
因此,第一个和第二个错误如下所示:
program.cl|143 error| expression must have integral type rec_table[PRIME_P - ri] = PRIME_P - i; ^
program.cl|148 col 14 error| a value of type "uint16" cannot be used to initialize an entity of type "uint" uint a = value, b = PRIME_P, u = 0, v = 0;
几乎没问题(尤其是在第二种情况下),但我不知道如何做到这一点:
program.cl|143 col 19 error| expression must have integral type
program.cl|148 col 14 error| a value of type "uint16" cannot be used to initialize an entity of type "uint"
或者至少是这样的:
program.cl|143 col 19 error| expression must have integral type rec_table[PRIME_P - ri] = PRIME_P - i;
program.cl|148 col 14 error| a value of type "uint16" cannot be used to initialize an entity of type "uint" uint a = value, b = PRIME_P, u = 0, v = 0;
你有什么想法吗?
UPD。更新了错误格式和期望