statement.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  3. Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. =============================================================================*/
  6. #if !defined(BOOST_SPIRIT_CALC8_STATEMENT_HPP)
  7. #define BOOST_SPIRIT_CALC8_STATEMENT_HPP
  8. #include "expression.hpp"
  9. namespace client { namespace parser
  10. {
  11. ///////////////////////////////////////////////////////////////////////////////
  12. // The statement grammar
  13. ///////////////////////////////////////////////////////////////////////////////
  14. template <typename Iterator>
  15. struct statement : qi::grammar<Iterator, ast::statement_list(), ascii::space_type>
  16. {
  17. statement(error_handler<Iterator>& error_handler);
  18. expression<Iterator> expr;
  19. qi::rule<Iterator, ast::statement_list(), ascii::space_type>
  20. statement_list, compound_statement;
  21. qi::rule<Iterator, ast::statement(), ascii::space_type> statement_;
  22. qi::rule<Iterator, ast::variable_declaration(), ascii::space_type> variable_declaration;
  23. qi::rule<Iterator, ast::assignment(), ascii::space_type> assignment;
  24. qi::rule<Iterator, ast::if_statement(), ascii::space_type> if_statement;
  25. qi::rule<Iterator, ast::while_statement(), ascii::space_type> while_statement;
  26. qi::rule<Iterator, std::string(), ascii::space_type> identifier;
  27. };
  28. }}
  29. #endif