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

source code of boost/libs/spirit/example/x3/minimal/employee_def.hpp