fstiewitz / build-tools-cpp

Build your projects in atom
https://atom.io/packages/build-tools
MIT License
31 stars 6 forks source link

clang parsing #17

Closed likask closed 9 years ago

likask commented 9 years ago

For given example:

In file included from /Users/likask/MyBuild/mofem-cephas/mofem_v0.2/users_modules/helmholtz/best_approximation.cpp:47:
/Users/likask/MyBuild/mofem-cephas/mofem_v0.2/users_modules/helmholtz/src/AnalyticalSolutions.hpp:47:2: error: expected ';' after enum
}
 ^

Second line with error is not parsed by linter, only first line. As result error error: expected ';' after enum point to the file header instead to error in hpp file.

I was able to apply crude fix in lib/build-parser.coffee:getFileNames, i.e. parsing file names which have rows and columns set by clang,

regstring = "([\\S]+(?:" + extensions + "))(?::([\\d]+)(?::([\\d]+)))"

This is crude fix, since I am not able traverse from error point to include file and next to actual error in header file.

I hope that is helpful for potential future fix.

fstiewitz commented 9 years ago

Do you use the latest version of my package (v1.2.3) ? My regstring is

regstring = "([\\S]+(?:" + extensions + "))(?::([\\d]+)(?::([\\d]+))?)?"

, which is almost the same as your fix and your example works on my pc.

likask commented 9 years ago

Yes, I am using v1.2.3.

I make change of this line, i.e. that only lines with format: FilePath:rownb:colnb. For your case you allow for FilePath, FilePath:rownb and variant with ::.

If I have your regstring, atom is pointing to error in best_approximation.cpp, but not to error in header file AnalyticalSolutions.hpp. In my case of my regstring error is pointed to line in hpp file. In the optimal case atom error should show error in cpp file and then to error in hpp file.

The problem is I am not familiar with coffee or java scripts as result I don't fully understand your code.

Gcc for that error shows,

In file included from /mnt/home/MyBuild/mofem-cephas/mofem_v0.2/users_modules/helmholtz/best_approximation.cpp:47:0:
/mnt/home/MyBuild/mofem-cephas/mofem_v0.2/users_modules/helmholtz/src/AnalyticalSolutions.hpp:52:39: error: two or more data types in declaration of 'analytical_solution_types'
 const char *analytical_solution_types[] = {

clang on Mac:

MyBuild/mofem-cephas/mofem_v0.2/users_modules/helmholtz/best_approximation.cpp:47:
/Users/likask/MyBuild/mofem-cephas/mofem_v0.2/users_modules/helmholtz/src/AnalyticalSolutions.hpp:47:2: error: expected ';' after enum
}
fstiewitz commented 9 years ago

I think I understand you now. You want both best_approximation.cpp:47 and AnalyticalSolutions.hpp:47 to be highlighted by Linter ? Sounds good, I'll start working on it.

likask commented 9 years ago

Yes. Thank you for all this. You are doing really great job.