regression_matlib_generate_switch.cpp 1002 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright (c) 2001-2011 Hartmut Kaiser
  2. // Copyright (c) 2009 Carl Barron
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. #include <boost/detail/lightweight_test.hpp>
  7. #include <boost/spirit/include/lex_lexertl.hpp>
  8. #include <boost/spirit/include/lex_generate_static_lexertl.hpp>
  9. #include <fstream>
  10. #include <vector>
  11. #include "matlib.h"
  12. int main(int argc, char* argv[])
  13. {
  14. std::vector<std::vector<double> > results;
  15. typedef std::string::iterator iter;
  16. typedef boost::spirit::lex::lexertl::actor_lexer<
  17. boost::spirit::lex::lexertl::token<iter>
  18. > lexer_type;
  19. typedef matlib_tokens<lexer_type> matlib_type;
  20. matlib_type matrix(results);
  21. std::ofstream out(argc < 2 ? "matlib_static_switch.h" : argv[1]);
  22. BOOST_TEST(boost::spirit::lex::lexertl::generate_static_switch(
  23. matrix, out, "matlib_switch"));
  24. return boost::report_errors();
  25. }