struct LoadResult
{
std::unique_ptr<Document> document;
std::vector<ParseError> errors;
std::vector<std::string> dependencies; // includes only, no host
std::set<std::string> dependencySet; // host + includes, sorted
bool ok() const; // document produced && nothing worse than a Warning
};
| Field | Meaning |
document | the parsed Document; null only when the file cannot be opened — a malformed file still yields a partial one |
errors | everything the parser recorded, warnings included; each is a ParseError with kind / message / filename / line / col |
dependencies | canonical paths of every file opened while resolving %include — the host file is not in this list |
dependencySet | the complete set to watch for reload — host file plus every included file, de-duplicated and sorted. No manual host addition needed. |
ok() | true when document is non-null and no error worse than Kind::Warning was recorded |
auto r = Fson::load( "service.fson" );
if( !r.ok() ) { /* report r.errors */ }
for( auto const& f : r.dependencySet ) watch( f );