ComponentClass::class_empty should only be used on finalized classes to
determine whether a given class contains any elements; it should not
take the cr_ucp or cps_ucp into account, as they have been folden in by
the finalize call.
Fixes our failure to identify that the pattern /[^\D\d]/8W can never
match.
}
bool AsciiComponentClass::class_empty(void) const {
- return cr.none() && cr_ucp.none();
+ assert(finalized);
+ return cr.none();
}
void AsciiComponentClass::createRange(unichar to) {
}
void ComponentClass::negate() {
- assert(class_empty());
m_negate = true;
}
Component *accept(ComponentVisitor &v) override = 0;
void accept(ConstComponentVisitor &v) const override = 0;
- /** True iff we have already started adding members to the class. This is
- * a different concept to Component::empty */
+ /** \brief True if the class contains no members (i.e. it will not match
+ * against anything). This function can only be called on a finalized
+ * class.
+ *
+ * Note: This is a different concept to Component::empty.
+ */
virtual bool class_empty(void) const = 0;
virtual void add(PredefinedClass c, bool negated) = 0;
}
bool UTF8ComponentClass::class_empty(void) const {
- return cps.none() && cps_ucp.none();
+ assert(finalized);
+ return cps.none();
}
void UTF8ComponentClass::createRange(unichar to) {
132:/[a[==]]/ #Unsupported POSIX collating element at index 2.
133:/[a[.\].]]/ #Unsupported POSIX collating element at index 2.
134:/[a[=\]=]]/ #Unsupported POSIX collating element at index 2.
+135:/[^\D\d]/8W #Pattern can never match.