[Boost-bugs] [Boost C++ Libraries] #6253: lex::lexertl::generate_static_dfa compiler errors if lexer has wchar_t as underlying stream type

Subject: [Boost-bugs] [Boost C++ Libraries] #6253: lex::lexertl::generate_static_dfa compiler errors if lexer has wchar_t as underlying stream type
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-12-11 19:32:05


#6253: lex::lexertl::generate_static_dfa compiler errors if lexer has wchar_t as
underlying stream type
------------------------------------------------+---------------------------
 Reporter: Ryan Molden <ryanmolden@…> | Owner: hkaiser
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: spirit
  Version: Boost 1.47.0 | Severity: Problem
 Keywords: generate_static_dfa lexertl |
------------------------------------------------+---------------------------
 Try and compile the following code, you will get compiler errors because
 generate_static.hpp has one line which says a std::map has a element type
 of char when, in this case, it should be wchar_t. After fixing that to
 use Char (which is an existing template param on the method with the
 error) the output C++ code from this method further encodes 'char' in a
 number of places thus compiling a lexer using the produced static table
 also fails.

 <--------------------- Begin Repro ------------------------------>

 #include <fstream>
 #include <boost/config/warning_disable.hpp>
 #include <boost/spirit/include/lex_lexertl.hpp>
 #include <boost/spirit/include/lex_generate_static_lexertl.hpp>
 #include <boost/spirit/include/lex_static_lexertl.hpp>

 using namespace std;
 using namespace boost::spirit;

 template <typename BaseLexer>
 struct MyLexer : boost::spirit::lex::lexer<BaseLexer>
 {
     MyLexer()
     {
         token = L"Yay winning!";
         this->self = token;
     }

     lex::token_def<lex::unused_type, wchar_t> token;
 };

 int main(int argc, char* argv[])
 {
     typedef lex::lexertl::token<const wchar_t*> token_type;
     typedef lex::lexertl::lexer<token_type> lexer_type;

     MyLexer<lexer_type> lexer;

     ofstream outputStream("test.hpp");

     return lex::lexertl::generate_static_dfa(lexer, outputStream, "test")
 ? 0 : -1;
 }

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6253>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:08 UTC