summaryrefslogtreecommitdiff
path: root/src/piraha/Multi.cc
blob: ae79564565a85ff513c42fc87284ab0fea0c4a5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
#include "Piraha.hpp"

using namespace cctki_piraha;

bool Multi::match(Matcher *m) {
    vector<smart_ptr<Group> > chSave;
    for(int i=0;i<maxv;i++) {
        int save = m->pos;
        chSave = m->children;
        if(!pattern->match(m) || m->pos == save) {
            m->pos = save;
            m->children = chSave;
            return i >= minv;
        }
    }
    return true;
}