2013-03-07 1 views
1

제 컴파일러 및 lint 도구는 두 가지 형식으로 오류를 표시합니다. 나는 점진적으로 lint를위한 errorformat을 설정하고 컴파일러를위한 패턴을 추가하기로 결정했다. 여기 vim errorformat 설정 관련 문제

내 첫 번째 시도는

set errorformat=\"%f\"\\,%l\ \ %t%s 

했다 그리고 그것은 일

"C:\Documents and Settings\user\Projects\MyProject\trunk\src\myfile.c",126 Info 754: local structure member 'myStructMember' (line 126, file C:\Documents and Settings\user\Projects\MyProject\trunk\src\myfile.c) not referenced 

에 내가 일치하도록 노력하고있어 보풀 출력 라인입니다.

은 그 때 나는

set errorformat=\"%f\"\\,%l\ \ %t\ %s 

을 다음과 같이 설정을 시도하고 작동이 중지.

문제가 무엇인지 압니까? 설명서를 읽었지만 도움이되지 않았습니다.

도움을 주시면 감사하겠습니다.

+0

그래서 'Info 754'는 사이에 공백없이 정확하게 일치하지만 공백이 있으면 일치하지 않습니다. –

+0

문제를 파악했습니다. % t는 첫 번째 문자에만 일치합니다. 따라서 % t \ % s가 오류 유형의 첫 번째 문자와 일치하면 공백 다음 문자열을 찾습니다. 작동하게하려면 % t % * \ w % * \ s % s (으)로 변경해야했습니다. – flashburn

+1

해결책을 아래 응답으로 게시해야합니다 –

답변

0
" Match the filename and line number 
let &errorformat = '"%f"\,%l' 

" Match white space, first character of error type, the rest of the characters 
" of the error type, and white space again. 
let &errorformat .= '%*\s%t%*\w%*\s' 

"Match error number, whitespace and error message. 
let &errorformat .= '%n:%*\s%m'