Commit 99c394d9 authored by Daniel Veillard's avatar Daniel Veillard

fixed where xmlMemoryDump() should be called. fixed handling of {0}, \n,

* testRegexp.c: fixed where xmlMemoryDump() should be called.
* xmlregexp.c: fixed handling of {0}, \n, \r and \t, two bugs
  affecting NIST regression tests
Daniel
parent 9202b674
Thu Jul 14 14:57:36 CEST 2005 Daniel Veillard <daniel@veillard.com>
* testRegexp.c: fixed where xmlMemoryDump() should be called.
* xmlregexp.c: fixed handling of {0}, \n, \r and \t, two bugs
affecting NIST regression tests
Thu Jul 14 11:30:24 CEST 2005 Daniel Veillard <daniel@veillard.com>
* configure.in: applied a patch from Gerrit P. Haase to add
......
......@@ -140,12 +140,11 @@ int main(int argc, char **argv) {
}
}
}
xmlMemoryDump();
if (comp != NULL)
xmlRegFreeRegexp(comp);
}
xmlCleanupParser();
/* xmlMemoryDump(); */
xmlMemoryDump();
return(0);
}
......
......@@ -1467,6 +1467,23 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
break;
}
return(0);
} else if ((atom->min == 0) && (atom->max == 0) &&
(atom->quant == XML_REGEXP_QUANT_RANGE)) {
/*
* we can discard the atom and generate an epsilon transition instead
*/
if (to == NULL) {
to = xmlRegNewState(ctxt);
if (to != NULL)
xmlRegStatePush(ctxt, to);
else {
return(-1);
}
}
xmlFAGenerateEpsilonTransition(ctxt, from, to);
ctxt->state = to;
xmlRegFreeAtom(atom);
return(0);
} else {
if (to == NULL) {
to = xmlRegNewState(ctxt);
......@@ -3815,8 +3832,21 @@ xmlFAParseCharClassEsc(xmlRegParserCtxtPtr ctxt) {
(cur == 0x5E)) {
if (ctxt->atom == NULL) {
ctxt->atom = xmlRegNewAtom(ctxt, XML_REGEXP_CHARVAL);
if (ctxt->atom != NULL)
ctxt->atom->codepoint = cur;
if (ctxt->atom != NULL) {
switch (cur) {
case 'n':
ctxt->atom->codepoint = '\n';
break;
case 'r':
ctxt->atom->codepoint = '\r';
break;
case 't':
ctxt->atom->codepoint = '\t';
break;
default:
ctxt->atom->codepoint = cur;
}
}
} else if (ctxt->atom->type == XML_REGEXP_RANGES) {
xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
XML_REGEXP_CHARVAL, cur, cur, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment