source: icGREP/icgrep-devel/icgrep/re/re_range.h @ 5786

Last change on this file since 5786 was 5764, checked in by cameron, 19 months ago

Range RE new files

File size: 966 bytes
Line 
1#ifndef RE_RANGE_H
2#define RE_RANGE_H
3
4#include <re/re_re.h>
5
6//
7// Ranges generally represent CCs, but might not be able to be
8// converted to CCs during parsing, if one or both endpoints are
9// symbolic.   [\N{some name}-\N{some other name}],  [\q(ch)-k]
10namespace re {
11
12class Range : public RE {
13public:
14    static inline bool classof(const RE * re) {
15        return re->getClassTypeId() == ClassTypeId::Range;
16    }
17    static inline bool classof(const void *) {
18        return false;
19    }
20    RE * getLo() const {
21        return mLo;
22    }
23    void setLo(RE * lh) {
24        mLo = lh;
25    }
26    RE * getHi() const {
27        return mHi;
28    }
29    void setHi(RE * rh) {
30        mHi = rh;
31    }
32protected:
33    friend RE * makeRange(RE*, RE*);
34    Range(RE * lh, RE * rh)
35    : RE(ClassTypeId::Range)
36    , mLo(lh)
37    , mHi(rh)
38    {
39
40    }
41    virtual ~Range() {}
42private:
43    RE * mLo;
44    RE * mHi;
45};
46
47RE * makeRange(RE * lh, RE * rh);
48}
49
50#endif // RE_RANGE_H
Note: See TracBrowser for help on using the repository browser.