Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should debug_printer be a part of restinio::easy_parser? #117

Open
eao197 opened this issue Jul 18, 2020 · 0 comments
Open

Should debug_printer be a part of restinio::easy_parser? #117

eao197 opened this issue Jul 18, 2020 · 0 comments
Assignees

Comments

@eao197
Copy link
Member

eao197 commented Jul 18, 2020

RESTinio's easy_parser used in restinio::http_field_parsers doesn't contain debugging facilities (and it's an open question can such facilities be added). So the debugging of PEG parsers is not an easy task.

A simple helper debug_print was very useful in the implementation of parser for Host HTTP-field. Its source code can be found here:

struct debug_printer : public ep_impl::clause_tag
{
std::string m_tag;
debug_printer( std::string v ) noexcept : m_tag{ std::move(v) } {}
template< typename Target_Type >
RESTINIO_NODISCARD
optional_t< parse_error_t >
try_process( ep_impl::source_t & from, Target_Type & /*target*/ )
{
std::cout << "*** debug_print: " << m_tag << std::endl;
return nullopt;
}
};

Maybe debug_print should become a part of easy_parser?

@eao197 eao197 self-assigned this Jul 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant