1
我想爲vim-opencl plugin編寫OpenCL語法檢查程序。 OpenCL編譯器會對輸出錯誤進行一些奇怪的格式化。有兩種類型的錯誤。如何寫多行errorformat字符串?
正常(小錯誤解釋):
"/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作爲generel語句檢查器。現在我有它這樣的代碼:
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;
它幾乎OK(尤其是在第二種情況),但我不知道如何使它像這樣:
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。更新errorformat和期望
感謝您的評論這是沒有。!需要根據合成幫助轉義空格:https://github.com/scrooloose/syntastic/blob/master/doc/syntastic.txt#L341 – petRUShka
我將在%C之前對%Z和空間進行實驗 – petRUShka