parser.hpp
Go to the documentation of this file.
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2021 Mikhail Komarov <nemo@nil.foundation>
3 // Copyright (c) 2021 Nikita Kaskov <nbering@nil.foundation>
4 //
5 // MIT License
6 //
7 // Permission is hereby granted, free of charge, to any person obtaining a copy
8 // of this software and associated documentation files (the "Software"), to deal
9 // in the Software without restriction, including without limitation the rights
10 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 // copies of the Software, and to permit persons to whom the Software is
12 // furnished to do so, subject to the following conditions:
13 //
14 // The above copyright notice and this permission notice shall be included in all
15 // copies or substantial portions of the Software.
16 //
17 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 // SOFTWARE.
24 //---------------------------------------------------------------------------//
25 
26 #ifndef CRYPTO3_MATH_EXPRESSION_PARSER_HPP
27 #define CRYPTO3_MATH_EXPRESSION_PARSER_HPP
28 
29 #ifndef CRYPTO3_MATH_EXPRESSION_HPP
30 #error "parser.hpp must not be included directly!"
31 #endif
32 
33 #include <list>
34 #include <string>
35 
36 #include <boost/spirit/home/x3.hpp>
37 #include <boost/spirit/home/x3/support/ast/variant.hpp>
38 
41 
42 namespace nil {
43  namespace crypto3 {
44  namespace math {
45  namespace expressions {
46  namespace detail {
47 
48  namespace x3 = boost::spirit::x3;
49 
50  namespace parser {
51 
52  using iterator_type = std::string::const_iterator;
53  using context_type = x3::phrase_parse_context<x3::ascii::space_type>::type;
54  BOOST_SPIRIT_INSTANTIATE(expression_type, iterator_type, context_type)
55 
56  } // namespace parser
57  } // namespace detail
58  } // namespace expressions
59  } // namespace math
60  } // namespace crypto3
61 } // namespace nil
62 
63 #endif // CRYPTO3_MATH_EXPRESSION_PARSER_HPP
std::string::const_iterator iterator_type
Definition: parser.hpp:52
x3::phrase_parse_context< x3::ascii::space_type >::type context_type
Definition: parser.hpp:53
x3::rule< expression_class, ast::expression > expression_type
Definition: parser_def.hpp:308
Definition: pair.hpp:31