source: icGREP/icgrep-devel/icgrep/re/re_group.h @ 5792

Last change on this file since 5792 was 5767, checked in by cameron, 19 months ago

Regular expression group header

File size: 1.0 KB
Line 
1#ifndef RE_GROUP_H
2#define RE_GROUP_H
3
4#include <re/re_re.h>
5#include <llvm/Support/Casting.h>
6
7namespace re {
8   
9/*  Grouped regular expression to represent mode flags.
10    (?g:...)  or (?i)....
11*/
12
13class Group : public RE {
14public:
15    static inline bool classof(const RE * re) {return re->getClassTypeId() == ClassTypeId::Group;}
16    static inline bool classof(const void *) {return false;}
17   
18    enum class Mode {CaseInsensitiveMode, GraphemeMode};
19    enum class Sense {On, Off};
20    Mode getMode() const {return mMode;}
21    Sense getSense() const {return mSense;}
22    RE * getRE() const {return mExpr;}
23    friend Group * makeGroup(Mode m, RE * r, Sense s);
24    void setRE(RE * r) {mExpr = r;}
25protected:
26    Group(Mode m, RE * r, Sense s) : RE(ClassTypeId::Group), mMode(m), mExpr(r), mSense(s) {}
27
28private:
29    Mode                mMode;
30    RE *                mExpr;
31    Sense               mSense;
32};
33
34inline Group * makeGroup(Group::Mode m, RE * r, Group::Sense s = Group::Sense::On) {
35    return new Group(m, r, s);
36}
37}
38
39#endif // RE_GROUP_H
Note: See TracBrowser for help on using the repository browser.