1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-29 11:41:22 +03:00

fixing some Negative Character Group and Character Class Subtraction

* xmlregexp.c: fixing some Negative Character Group and
  Character Class Subtraction handling.
Daniel
This commit is contained in:
Daniel Veillard
2003-11-24 14:27:26 +00:00
parent f2a1283564
commit f8b9de3254
2 changed files with 17 additions and 4 deletions

View File

@ -1,3 +1,8 @@
Mon Nov 24 15:26:21 CET 2003 Daniel Veillard <daniel@veillard.com>
* xmlregexp.c: fixing some Negative Character Group and
Character Class Subtraction handling.
Mon Nov 24 14:01:57 CET 2003 Daniel Veillard <daniel@veillard.com> Mon Nov 24 14:01:57 CET 2003 Daniel Veillard <daniel@veillard.com>
* xmlregexp.c xmlschemas.c: more XML Schemas fixes based * xmlregexp.c xmlschemas.c: more XML Schemas fixes based

View File

@ -141,7 +141,7 @@ typedef struct _xmlRegRange xmlRegRange;
typedef xmlRegRange *xmlRegRangePtr; typedef xmlRegRange *xmlRegRangePtr;
struct _xmlRegRange { struct _xmlRegRange {
int neg; int neg; /* 0 normal, 1 not, 2 exclude */
xmlRegAtomType type; xmlRegAtomType type;
int start; int start;
int end; int end;
@ -1995,14 +1995,20 @@ xmlRegCheckCharacter(xmlRegAtomPtr atom, int codepoint) {
for (i = 0;i < atom->nbRanges;i++) { for (i = 0;i < atom->nbRanges;i++) {
range = atom->ranges[i]; range = atom->ranges[i];
if (range->neg) { if (range->neg == 2) {
ret = xmlRegCheckCharacterRange(range->type, codepoint, ret = xmlRegCheckCharacterRange(range->type, codepoint,
0, range->start, range->end, 0, range->start, range->end,
range->blockName); range->blockName);
if (ret != 0) if (ret != 0)
return(0); /* excluded char */ return(0); /* excluded char */
else } else if (range->neg) {
ret = xmlRegCheckCharacterRange(range->type, codepoint,
0, range->start, range->end,
range->blockName);
if (ret == 0)
accept = 1; accept = 1;
else
return(0);
} else { } else {
ret = xmlRegCheckCharacterRange(range->type, codepoint, ret = xmlRegCheckCharacterRange(range->type, codepoint,
0, range->start, range->end, 0, range->start, range->end,
@ -3634,8 +3640,9 @@ xmlFAParseCharGroup(xmlRegParserCtxtPtr ctxt) {
xmlFAParsePosCharGroup(ctxt); xmlFAParsePosCharGroup(ctxt);
ctxt->neg = neg; ctxt->neg = neg;
} else if (CUR == '-') { } else if (CUR == '-') {
int neg = ctxt->neg;
NEXT; NEXT;
ctxt->neg = !ctxt->neg; ctxt->neg = 2;
if (CUR != '[') { if (CUR != '[') {
ERROR("charClassExpr: '[' expected"); ERROR("charClassExpr: '[' expected");
break; break;
@ -3648,6 +3655,7 @@ xmlFAParseCharGroup(xmlRegParserCtxtPtr ctxt) {
ERROR("charClassExpr: ']' expected"); ERROR("charClassExpr: ']' expected");
break; break;
} }
ctxt->neg = neg;
break; break;
} else if (CUR != ']') { } else if (CUR != ']') {
xmlFAParsePosCharGroup(ctxt); xmlFAParsePosCharGroup(ctxt);