1 /*=============================================================================
2 Copyright (c) 2001-2011 Joel de Guzman
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 =============================================================================*/
7 #if !defined(BOOST_SPIRIT_MINIC_EXPRESSION_HPP)
8 #define BOOST_SPIRIT_MINIC_EXPRESSION_HPP
10 ///////////////////////////////////////////////////////////////////////////////
11 // Spirit v2.5 allows you to suppress automatic generation
12 // of predefined terminals to speed up complation. With
13 // BOOST_SPIRIT_NO_PREDEFINED_TERMINALS defined, you are
14 // responsible in creating instances of the terminals that
15 // you need (e.g. see qi::uint_type uint_ below).
16 #define BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
17 ///////////////////////////////////////////////////////////////////////////////
19 ///////////////////////////////////////////////////////////////////////////////
20 // Uncomment this if you want to enable debugging
21 // #define BOOST_SPIRIT_QI_DEBUG
22 ///////////////////////////////////////////////////////////////////////////////
24 #include <boost/spirit/include/qi.hpp>
26 #include "error_handler.hpp"
27 #include "skipper.hpp"
30 namespace client { namespace parser
32 namespace qi = boost::spirit::qi;
33 namespace ascii = boost::spirit::ascii;
35 ///////////////////////////////////////////////////////////////////////////////
36 // The expression grammar
37 ///////////////////////////////////////////////////////////////////////////////
38 template <typename Iterator>
39 struct expression : qi::grammar<Iterator, ast::expression(), skipper<Iterator> >
41 expression(error_handler<Iterator>& error_handler);
43 qi::rule<Iterator, ast::expression(), skipper<Iterator> >
44 expr, equality_expr, relational_expr,
45 logical_or_expr, logical_and_expr,
46 additive_expr, multiplicative_expr
49 qi::rule<Iterator, ast::operand(), skipper<Iterator> >
50 unary_expr, primary_expr
53 qi::rule<Iterator, ast::function_call(), skipper<Iterator> >
57 qi::rule<Iterator, std::list<ast::expression>(), skipper<Iterator> >
61 qi::rule<Iterator, std::string(), skipper<Iterator> >
65 qi::symbols<char, ast::optoken>
66 logical_or_op, logical_and_op,
67 equality_op, relational_op,
68 additive_op, multiplicative_op, unary_op