Menu

[94f52a]: / parser / node_parser.hpp  Maximize  Restore  History

Download this file

51 lines (35 with data), 1.2 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef CHILON_PARSER_NODE_PARSER_HPP
#define CHILON_PARSER_NODE_PARSER_HPP
#include <chilon/parser/parse.hpp>
#include <chilon/meta/return.hpp>
#include <type_traits>
namespace chilon { namespace parser {
struct is_simple_node;
namespace detail {
template <class T, bool is_node>
struct node_parser_helper {
typedef T parser_type;
typedef typename stored<parser_type>::type store_type;
template <class U>
static inline auto get(U&& u) CHILON_RETURN(std::forward<U>(u))
};
template <class T>
struct node_parser_helper<T, true> {
typedef typename T::node_parser_type parser_type;
typedef T store_type;
typedef typename stored<parser_type>::type node_store_type;
template <class U>
static inline node_store_type& get(U& u) {
return u.value_;
}
};
}
template <class T>
struct node_parser
: detail::node_parser_helper<T, std::is_base_of<is_simple_node, T>::value> {};
template <class T>
struct node_parser< sequence<T> > : node_parser<T> {};
template <class T>
struct node_parser< parse<T> > : node_parser<T> {};
} }
#endif
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.