Menu

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

Download this file

32 lines (26 with data), 670 Bytes

 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
#ifndef CHILON_PARSER_TRY_HPP
#define CHILON_PARSER_TRY_HPP
#include <chilon/parser/parse.hpp>
#include <chilon/parser/unskippable.hpp>
namespace chilon { namespace parser {
template <class T>
struct try_ {
template <class Stream>
inline static bool skip(Stream& stream) {
auto bak = stream.begin();
if (T::skip(stream)) {
stream.begin() = bak;
return true;
}
else return false;
}
};
template <class T>
struct parse<try_<T>> : unskippable< try_<T> > {
template <class Stream, class O>
inline static bool skip(Stream& stream, O&) {
return try_<T>::skip(stream);
}
};
} }
#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.