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 51 52
|
template<class IterationPolicy>
struct Mon_iteration_policy :public IterationPolicy
{
template <typename ScannerT>
void
advance(ScannerT const& scan) const
{
IterationPolicy::advance(scan);
}
template <typename ScannerT>
bool at_end(ScannerT const& scan) const
{
return IterationPolicy::at_end(scan);
}
template <typename T>
T filter(T ch) const
{
return IterationPolicy::filter(ch);
}
template <typename ScannerT>
typename ScannerT::ref_t
get(ScannerT const& scan) const
{
return IterationPolicy::get(scan);
}
};
class MaGrammaire
:public grammar<MaGrammaire>
{
public:
template <typename ScannerT>
typename parser_result<self_t, ScannerT>::type
parse(ScannerT const& scan) const
{
//change_policies
scanner_policies<
Mon_iteration_policy<ScannerT::policies_t::iteration_policy_t>,
ScannerT::policies_t::match_policy_t,
ScannerT::policies_t::action_policy_t
> MaNouvellePolitique;
return grammar::parse(scan.change_policies(MaNouvellePolitique));
}
template <typename ScannerT>
struct definition
{
... |
Partager