Rigid and microporous polymers for gas separation membranes