Handling Output Messages

To make the handling of output messages of the generated parser and scanner, the package defines the class ylmm::basic_messenger.

It provides a number of servies to output text to a normal stream, and to an error stream. The default behaviour is to print to std::cout and std::cerr respectively.

However, one can instantise a ylmm::basic_messenger object with any two I/O streams, and then pass it to the scanner and parser classes via the member functions ylmm::parser_base::messenger and ylmm::scanner_base. The classes will then use that messenger to handle output.

In this way, the client code can ensure that all messages and errors are logged to the same stream from both the scanner and the parser, and perhaps also from the client code itself.

The client code can derive a sub-class from ylmm::basic_messenger if needed, but a better approach is to use the std::streambuf layer of the standard library (see More on ylmm::basic_buffer).

Top of page
Christian Holm (home page)
Last update Fri Jul 8 12:58:03 2005
Created by DoxyGen 1.4.3-20050530