'Parse a primitive regexp followed by *, +, ? modifiers.'

def parse_mod(self):

    re = self.parse_prim()
    while ((not self.end) and (self.c in '*+?')):
        if (self.c == '*'):
            re = Rep(re)
        elif (self.c == '+'):
            re = Rep1(re)
        else:
            re = Opt(re)
        self.next()
    return re
