Skip to content

Commit

Permalink
chore(search): improve parser error reporting (#3184)
Browse files Browse the repository at this point in the history

Signed-off-by: Roman Gershman <[email protected]>
  • Loading branch information
romange authored Jun 18, 2024
1 parent d207789 commit 50f3ffb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/search/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -174,5 +174,5 @@ tag_list:
void
dfly::search::Parser::error(const location_type& l, const string& m)
{
cerr << l << ": " << m << '\n';
driver->Error(l, m);
}
4 changes: 4 additions & 0 deletions src/core/search/query_driver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ void QueryDriver::ResetScanner() {
scanner_->SetParams(params_);
}

void QueryDriver::Error(const Parser::location_type& loc, std::string_view msg) {
LOG(ERROR) << "Parse error " << loc << ": " << msg;
}

} // namespace search

} // namespace dfly
2 changes: 2 additions & 0 deletions src/core/search/query_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ class QueryDriver {
return scanner_.get();
}

void Error(const Parser::location_type& loc, std::string_view msg);

public:
Parser::location_type location;

Expand Down

0 comments on commit 50f3ffb

Please sign in to comment.