enhanced the logic of parsing char groups to better handle initial or
* xmlregexp.c: enhanced the logic of parsing char groups to
better handle initial or ending '-' (bug 135972)
diff --git a/ChangeLog b/ChangeLog
index 7cefe54..197a51e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sat Mar 20 22:25:18 HKT 2004 William Brack <wbrack@mmm.com.hk>
+
+ * xmlregexp.c: enhanced the logic of parsing char groups to
+ better handle initial or ending '-' (bug 135972)
+
Sat Mar 20 19:26:03 HKT 2004 William Brack <wbrack@mmm.com.hk>
* relaxng.c: added check for external reference in
diff --git a/xmlregexp.c b/xmlregexp.c
index 1706c74..057458b 100644
--- a/xmlregexp.c
+++ b/xmlregexp.c
@@ -3572,7 +3572,7 @@
return;
}
cur = CUR;
- if (cur != '-') {
+ if ((cur != '-') || (NXT(1) == ']')) {
xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
XML_REGEXP_CHARVAL, start, end, NULL);
return;
@@ -3650,15 +3650,11 @@
ctxt->neg = !ctxt->neg;
xmlFAParsePosCharGroup(ctxt);
ctxt->neg = neg;
- } else if (CUR == '-') {
+ } else if ((CUR == '-') && (NXT(1) == '[')) {
int neg = ctxt->neg;
- NEXT;
ctxt->neg = 2;
- if (CUR != '[') {
- ERROR("charClassExpr: '[' expected");
- break;
- }
- NEXT;
+ NEXT; /* eat the '-' */
+ NEXT; /* eat the '[' */
xmlFAParseCharGroup(ctxt);
if (CUR == ']') {
NEXT;