1 /*============================================================================= 2 Copyright (c) 2002-2018 Joel de Guzman 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 =============================================================================*/ 7 #if !defined(BOOST_SPIRIT_X3_MINIMAL_EMPLOYEE_DEF_HPP) 8 #define BOOST_SPIRIT_X3_MINIMAL_EMPLOYEE_DEF_HPP 9 10 #include <boost/config/warning_disable.hpp> 11 #include <boost/spirit/home/x3.hpp> 12 13 #include "ast.hpp" 14 #include "ast_adapted.hpp" 15 #include "employee.hpp" 16 17 namespace client 18 { 19 /////////////////////////////////////////////////////////////////////////////// 20 // Our employee parser definition 21 /////////////////////////////////////////////////////////////////////////////// 22 namespace parser 23 { 24 namespace x3 = boost::spirit::x3; 25 namespace ascii = boost::spirit::x3::ascii; 26 27 using x3::int_; 28 using x3::lit; 29 using x3::double_; 30 using x3::lexeme; 31 using ascii::char_; 32 33 x3::rule<class employee, ast::employee> const employee = "employee"; 34 35 auto const quoted_string = lexeme['"' >> +(char_ - '"') >> '"']; 36 37 auto const employee_def = 38 lit("employee") 39 >> '{' 40 >> int_ >> ',' 41 >> quoted_string >> ',' 42 >> quoted_string >> ',' 43 >> double_ 44 >> '}' 45 ; 46 47 BOOST_SPIRIT_DEFINE(employee); 48 } 49 employee()50 parser::employee_type employee() 51 { 52 return parser::employee; 53 } 54 } 55 56 #endif 57