Teach Zeekygen to produce source-code-range information

Related to https://github.com/zeek/zeek-docs/issues/56
This commit is contained in:
Jon Siwek 2021-02-26 14:55:59 -08:00
parent c95a364ff7
commit 6ac499882c
16 changed files with 147 additions and 7 deletions

View file

@ -6,6 +6,7 @@
#include <time.h> // for time_t
#include <string>
#include <optional>
namespace zeek::detail { class ID; }
@ -74,4 +75,18 @@ std::string redef_indication(const std::string& from_script);
*
*/
std::string normalize_script_path(std::string_view path);
/**
* Determines the associated section of source code associated with an
* identifier's definition.
*
* @param id identifier for which obtain source code location info is obtained
*
* @return a nil value if source code location could not be determined, else
* a space-separated string with 3 components. The 1st component is a path
* relative to the "scripts/" directory, the 2nd and 3rd components are
* line numbers denoting the start and end of the relevant source code.
*/
std::optional<std::string> source_code_range(const zeek::detail::ID* id);
} // namespace zeek::zeekygen::detail