On 05/21/2014 04:05 PM, Nicolas Desprès wrote: > at the time the AST node is created the file location is frozen. > Locations are controlled by the lexer so do comments.
Correct. This has to be done by the lexer. We already have documentation blocks that are "indistinguishable from comments": #.rst: # ...reStructuredText docs... #[=====[.rst: ...reStructuredText docs... #]=====] I see no reason this can't be used for #line too: #.cmake-source-line: 1234 "/path/to/real/file" In all of the above cases there is no semantic meaning to the comments as far as the CMake language processor is concerned. The last case only changes the file names and line numbers in backtraces. One remaining challenge is CMAKE_CURRENT_LIST_FILE and CMAKE_CURRENT_LIST_LINE. Since the "current file" is not handled by the lexer these may not be consistent unless some kind of refactoring is done in the language implementation. However, it is not clear whether CMAKE_CURRENT_LIST_FILE can safely refer back to some transformed location because sometimes code uses it to look next to the file being processed to locate other files. If some source location mapping is in place then that may not be well-defined. -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers