Open thisismiller opened 4 years ago
Sorry, currently, it does not have the feature you said. To do that, as you pointed out, we need to define toml::key
as a struct and add region information in parser. So far, I personally did not need to do that and no one craimed it. That is why it does not have the feature.
I'm now refactoring region
related stuff to reduce complexity around it and once I've done it, maybe we would have full control on it. But since the region
is an internal component, essentially interface might be changed without anouncement even in a minor release.
Since region of a key seems to be useful feature, so I will consider implementing it in the future release.
Suppose I have the following
example.toml
file:After parsing this, I'd like to be able to print an error message like:
And I... can't seem to figure out how to make this happen.
toml::key
is an alias tostd::string
and nottoml::string
, so it loses (and the parser doesn't seem to track) the region information. I tried to get something close by usingtoml::get_region( toml::find( data, "bar" ) )
to get the value's region and trying to work backwards in the line from there, butbase_region
doesn't give me something likelocation::retrace
nor can I construct a newlocation
covering[line_begin(), begin())
.How can I get a
source_location
describing the location of a key in a table?