tzlaine / parser

A C++ parser combinator library.
Boost Software License 1.0
70 stars 12 forks source link

diagnostic stream to VisualStudio output window #124

Closed tobias-loew closed 3 months ago

tobias-loew commented 4 months ago

I'm not sure if this is too VS-centric, but for non-console applications it would be helpful having a predefined error-handler, that sends the trace-messages to the VS-Output-Window. Here's a link how to wrap a C++ stream around the OutputDebugString-API https://gist.github.com/comargo/f7fe244e539325cef0f66704b58dc35a

tzlaine commented 4 months ago

Yes, I'm afraid this is too Windows-centric for me. That code is simple enough, but getting a char * or a wchar_t * to print using one of those Win32 syscalls is nontrivial in the general case. However, if someone were to submit a PR for this as a new error_handler option, I would merge it. :)

tobias-loew commented 4 months ago

Got the message :) Which branch against would you like the PR? develop?

tzlaine commented 4 months ago

Yes! Develop would be great. I'll re-open this, then. Please mention it by number in the PR commit message.

tobias-loew commented 4 months ago

It already works with the error_handler: image

tobias-loew commented 4 months ago

Opened a PR https://github.com/tzlaine/parser/pull/156 for this. Now, I would also like to send the trace to the VS-output window. I've already changed the functions in printing.hpp to additionally take an ostream-argument. The question is: what to feed in for that arg from the parser?