Lines Matching refs:ctxt
48 ctxt->error = XML_REGEXP_COMPILE_ERROR; \
49 xmlRegexpErrCompile(ctxt, str);
50 #define NEXT ctxt->cur++
51 #define CUR (*(ctxt->cur))
52 #define NXT(index) (ctxt->cur[index])
55 #define NEXTL(l) ctxt->cur += l;
61 #define PREV (ctxt->cur[-1])
352 static void xmlFAParseRegExp(xmlRegParserCtxtPtr ctxt, int top);
374 xmlRegexpErrMemory(xmlRegParserCtxtPtr ctxt, const char *extra) in xmlRegexpErrMemory() argument
377 if (ctxt != NULL) { in xmlRegexpErrMemory()
378 regexp = (const char *) ctxt->string; in xmlRegexpErrMemory()
379 ctxt->error = XML_ERR_NO_MEMORY; in xmlRegexpErrMemory()
394 xmlRegexpErrCompile(xmlRegParserCtxtPtr ctxt, const char *extra) in xmlRegexpErrCompile() argument
399 if (ctxt != NULL) { in xmlRegexpErrCompile()
400 regexp = (const char *) ctxt->string; in xmlRegexpErrCompile()
401 idx = ctxt->cur - ctxt->string; in xmlRegexpErrCompile()
402 ctxt->error = XML_REGEXP_COMPILE_ERROR; in xmlRegexpErrCompile()
416 static int xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt);
426 xmlRegEpxFromParse(xmlRegParserCtxtPtr ctxt) { in xmlRegEpxFromParse() argument
431 xmlRegexpErrMemory(ctxt, "compiling regexp"); in xmlRegEpxFromParse()
435 ret->string = ctxt->string; in xmlRegEpxFromParse()
436 ret->nbStates = ctxt->nbStates; in xmlRegEpxFromParse()
437 ret->states = ctxt->states; in xmlRegEpxFromParse()
438 ret->nbAtoms = ctxt->nbAtoms; in xmlRegEpxFromParse()
439 ret->atoms = ctxt->atoms; in xmlRegEpxFromParse()
440 ret->nbCounters = ctxt->nbCounters; in xmlRegEpxFromParse()
441 ret->counters = ctxt->counters; in xmlRegEpxFromParse()
442 ret->determinist = ctxt->determinist; in xmlRegEpxFromParse()
443 ret->flags = ctxt->flags; in xmlRegEpxFromParse()
450 (ctxt->negs == 0) && in xmlRegEpxFromParse()
472 xmlRegexpErrMemory(ctxt, "compiling regexp"); in xmlRegEpxFromParse()
489 xmlRegexpErrMemory(ctxt, "compiling regexp"); in xmlRegEpxFromParse()
496 xmlRegexpErrMemory(ctxt, "compiling regexp"); in xmlRegEpxFromParse()
580 xmlRegexpErrMemory(ctxt, "compiling regexp"); in xmlRegEpxFromParse()
662 ctxt->string = NULL; in xmlRegEpxFromParse()
663 ctxt->nbStates = 0; in xmlRegEpxFromParse()
664 ctxt->states = NULL; in xmlRegEpxFromParse()
665 ctxt->nbAtoms = 0; in xmlRegEpxFromParse()
666 ctxt->atoms = NULL; in xmlRegEpxFromParse()
667 ctxt->nbCounters = 0; in xmlRegEpxFromParse()
668 ctxt->counters = NULL; in xmlRegEpxFromParse()
711 xmlRegNewRange(xmlRegParserCtxtPtr ctxt, in xmlRegNewRange() argument
717 xmlRegexpErrMemory(ctxt, "allocating range"); in xmlRegNewRange()
752 xmlRegCopyRange(xmlRegParserCtxtPtr ctxt, xmlRegRangePtr range) { in xmlRegCopyRange() argument
758 ret = xmlRegNewRange(ctxt, range->neg, range->type, range->start, in xmlRegCopyRange()
765 xmlRegexpErrMemory(ctxt, "allocating range"); in xmlRegCopyRange()
783 xmlRegNewAtom(xmlRegParserCtxtPtr ctxt, xmlRegAtomType type) { in xmlRegNewAtom() argument
788 xmlRegexpErrMemory(ctxt, "allocating atom"); in xmlRegNewAtom()
835 xmlRegCopyAtom(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom) { in xmlRegCopyAtom() argument
840 xmlRegexpErrMemory(ctxt, "copying atom"); in xmlRegCopyAtom()
854 xmlRegexpErrMemory(ctxt, "copying atom"); in xmlRegCopyAtom()
858 ret->ranges[i] = xmlRegCopyRange(ctxt, atom->ranges[i]); in xmlRegCopyAtom()
872 xmlRegNewState(xmlRegParserCtxtPtr ctxt) { in xmlRegNewState() argument
877 xmlRegexpErrMemory(ctxt, "allocating state"); in xmlRegNewState()
911 xmlRegFreeParserCtxt(xmlRegParserCtxtPtr ctxt) { in xmlRegFreeParserCtxt() argument
913 if (ctxt == NULL) in xmlRegFreeParserCtxt()
916 if (ctxt->string != NULL) in xmlRegFreeParserCtxt()
917 xmlFree(ctxt->string); in xmlRegFreeParserCtxt()
918 if (ctxt->states != NULL) { in xmlRegFreeParserCtxt()
919 for (i = 0;i < ctxt->nbStates;i++) in xmlRegFreeParserCtxt()
920 xmlRegFreeState(ctxt->states[i]); in xmlRegFreeParserCtxt()
921 xmlFree(ctxt->states); in xmlRegFreeParserCtxt()
923 if (ctxt->atoms != NULL) { in xmlRegFreeParserCtxt()
924 for (i = 0;i < ctxt->nbAtoms;i++) in xmlRegFreeParserCtxt()
925 xmlRegFreeAtom(ctxt->atoms[i]); in xmlRegFreeParserCtxt()
926 xmlFree(ctxt->atoms); in xmlRegFreeParserCtxt()
928 if (ctxt->counters != NULL) in xmlRegFreeParserCtxt()
929 xmlFree(ctxt->counters); in xmlRegFreeParserCtxt()
930 xmlFree(ctxt); in xmlRegFreeParserCtxt()
1166 xmlRegPrintCtxt(FILE *output, xmlRegParserCtxtPtr ctxt) { in xmlRegPrintCtxt() argument
1170 if (ctxt == NULL) { in xmlRegPrintCtxt()
1174 fprintf(output, "'%s' ", ctxt->string); in xmlRegPrintCtxt()
1175 if (ctxt->error) in xmlRegPrintCtxt()
1177 if (ctxt->neg) in xmlRegPrintCtxt()
1180 fprintf(output, "%d atoms:\n", ctxt->nbAtoms); in xmlRegPrintCtxt()
1181 for (i = 0;i < ctxt->nbAtoms; i++) { in xmlRegPrintCtxt()
1183 xmlRegPrintAtom(output, ctxt->atoms[i]); in xmlRegPrintCtxt()
1185 if (ctxt->atom != NULL) { in xmlRegPrintCtxt()
1187 xmlRegPrintAtom(output, ctxt->atom); in xmlRegPrintCtxt()
1189 fprintf(output, "%d states:", ctxt->nbStates); in xmlRegPrintCtxt()
1190 if (ctxt->start != NULL) in xmlRegPrintCtxt()
1191 fprintf(output, " start: %d", ctxt->start->no); in xmlRegPrintCtxt()
1192 if (ctxt->end != NULL) in xmlRegPrintCtxt()
1193 fprintf(output, " end: %d", ctxt->end->no); in xmlRegPrintCtxt()
1195 for (i = 0;i < ctxt->nbStates; i++) { in xmlRegPrintCtxt()
1196 xmlRegPrintState(output, ctxt->states[i]); in xmlRegPrintCtxt()
1198 fprintf(output, "%d counters:\n", ctxt->nbCounters); in xmlRegPrintCtxt()
1199 for (i = 0;i < ctxt->nbCounters; i++) { in xmlRegPrintCtxt()
1200 fprintf(output, " %d: min %d max %d\n", i, ctxt->counters[i].min, in xmlRegPrintCtxt()
1201 ctxt->counters[i].max); in xmlRegPrintCtxt()
1213 xmlRegAtomAddRange(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom, in xmlRegAtomAddRange() argument
1231 xmlRegexpErrMemory(ctxt, "adding ranges"); in xmlRegAtomAddRange()
1241 xmlRegexpErrMemory(ctxt, "adding ranges"); in xmlRegAtomAddRange()
1247 range = xmlRegNewRange(ctxt, neg, type, start, end); in xmlRegAtomAddRange()
1256 xmlRegGetCounter(xmlRegParserCtxtPtr ctxt) { in xmlRegGetCounter() argument
1257 if (ctxt->maxCounters == 0) { in xmlRegGetCounter()
1258 ctxt->maxCounters = 4; in xmlRegGetCounter()
1259 ctxt->counters = (xmlRegCounter *) xmlMalloc(ctxt->maxCounters * in xmlRegGetCounter()
1261 if (ctxt->counters == NULL) { in xmlRegGetCounter()
1262 xmlRegexpErrMemory(ctxt, "allocating counter"); in xmlRegGetCounter()
1263 ctxt->maxCounters = 0; in xmlRegGetCounter()
1266 } else if (ctxt->nbCounters >= ctxt->maxCounters) { in xmlRegGetCounter()
1268 ctxt->maxCounters *= 2; in xmlRegGetCounter()
1269 tmp = (xmlRegCounter *) xmlRealloc(ctxt->counters, ctxt->maxCounters * in xmlRegGetCounter()
1272 xmlRegexpErrMemory(ctxt, "allocating counter"); in xmlRegGetCounter()
1273 ctxt->maxCounters /= 2; in xmlRegGetCounter()
1276 ctxt->counters = tmp; in xmlRegGetCounter()
1278 ctxt->counters[ctxt->nbCounters].min = -1; in xmlRegGetCounter()
1279 ctxt->counters[ctxt->nbCounters].max = -1; in xmlRegGetCounter()
1280 return(ctxt->nbCounters++); in xmlRegGetCounter()
1284 xmlRegAtomPush(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom) { in xmlRegAtomPush() argument
1289 if (ctxt->maxAtoms == 0) { in xmlRegAtomPush()
1290 ctxt->maxAtoms = 4; in xmlRegAtomPush()
1291 ctxt->atoms = (xmlRegAtomPtr *) xmlMalloc(ctxt->maxAtoms * in xmlRegAtomPush()
1293 if (ctxt->atoms == NULL) { in xmlRegAtomPush()
1294 xmlRegexpErrMemory(ctxt, "pushing atom"); in xmlRegAtomPush()
1295 ctxt->maxAtoms = 0; in xmlRegAtomPush()
1298 } else if (ctxt->nbAtoms >= ctxt->maxAtoms) { in xmlRegAtomPush()
1300 ctxt->maxAtoms *= 2; in xmlRegAtomPush()
1301 tmp = (xmlRegAtomPtr *) xmlRealloc(ctxt->atoms, ctxt->maxAtoms * in xmlRegAtomPush()
1304 xmlRegexpErrMemory(ctxt, "allocating counter"); in xmlRegAtomPush()
1305 ctxt->maxAtoms /= 2; in xmlRegAtomPush()
1308 ctxt->atoms = tmp; in xmlRegAtomPush()
1310 atom->no = ctxt->nbAtoms; in xmlRegAtomPush()
1311 ctxt->atoms[ctxt->nbAtoms++] = atom; in xmlRegAtomPush()
1316 xmlRegStateAddTransTo(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr target, in xmlRegStateAddTransTo() argument
1323 xmlRegexpErrMemory(ctxt, "adding transition"); in xmlRegStateAddTransTo()
1333 xmlRegexpErrMemory(ctxt, "adding transition"); in xmlRegStateAddTransTo()
1344 xmlRegStateAddTrans(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state, in xmlRegStateAddTrans() argument
1383 xmlRegexpErrMemory(ctxt, "adding transition"); in xmlRegStateAddTrans()
1393 xmlRegexpErrMemory(ctxt, "adding transition"); in xmlRegStateAddTrans()
1419 xmlRegStateAddTransTo(ctxt, target, state->no); in xmlRegStateAddTrans()
1423 xmlRegStatePush(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state) { in xmlRegStatePush() argument
1425 if (ctxt->maxStates == 0) { in xmlRegStatePush()
1426 ctxt->maxStates = 4; in xmlRegStatePush()
1427 ctxt->states = (xmlRegStatePtr *) xmlMalloc(ctxt->maxStates * in xmlRegStatePush()
1429 if (ctxt->states == NULL) { in xmlRegStatePush()
1430 xmlRegexpErrMemory(ctxt, "adding state"); in xmlRegStatePush()
1431 ctxt->maxStates = 0; in xmlRegStatePush()
1434 } else if (ctxt->nbStates >= ctxt->maxStates) { in xmlRegStatePush()
1436 ctxt->maxStates *= 2; in xmlRegStatePush()
1437 tmp = (xmlRegStatePtr *) xmlRealloc(ctxt->states, ctxt->maxStates * in xmlRegStatePush()
1440 xmlRegexpErrMemory(ctxt, "adding state"); in xmlRegStatePush()
1441 ctxt->maxStates /= 2; in xmlRegStatePush()
1444 ctxt->states = tmp; in xmlRegStatePush()
1446 state->no = ctxt->nbStates; in xmlRegStatePush()
1447 ctxt->states[ctxt->nbStates++] = state; in xmlRegStatePush()
1460 xmlFAGenerateAllTransition(xmlRegParserCtxtPtr ctxt, in xmlFAGenerateAllTransition() argument
1464 to = xmlRegNewState(ctxt); in xmlFAGenerateAllTransition()
1465 xmlRegStatePush(ctxt, to); in xmlFAGenerateAllTransition()
1466 ctxt->state = to; in xmlFAGenerateAllTransition()
1469 xmlRegStateAddTrans(ctxt, from, NULL, to, -1, REGEXP_ALL_LAX_COUNTER); in xmlFAGenerateAllTransition()
1471 xmlRegStateAddTrans(ctxt, from, NULL, to, -1, REGEXP_ALL_COUNTER); in xmlFAGenerateAllTransition()
1482 xmlFAGenerateEpsilonTransition(xmlRegParserCtxtPtr ctxt, in xmlFAGenerateEpsilonTransition() argument
1485 to = xmlRegNewState(ctxt); in xmlFAGenerateEpsilonTransition()
1486 xmlRegStatePush(ctxt, to); in xmlFAGenerateEpsilonTransition()
1487 ctxt->state = to; in xmlFAGenerateEpsilonTransition()
1489 xmlRegStateAddTrans(ctxt, from, NULL, to, -1, -1); in xmlFAGenerateEpsilonTransition()
1501 xmlFAGenerateCountedEpsilonTransition(xmlRegParserCtxtPtr ctxt, in xmlFAGenerateCountedEpsilonTransition() argument
1504 to = xmlRegNewState(ctxt); in xmlFAGenerateCountedEpsilonTransition()
1505 xmlRegStatePush(ctxt, to); in xmlFAGenerateCountedEpsilonTransition()
1506 ctxt->state = to; in xmlFAGenerateCountedEpsilonTransition()
1508 xmlRegStateAddTrans(ctxt, from, NULL, to, counter, -1); in xmlFAGenerateCountedEpsilonTransition()
1520 xmlFAGenerateCountedTransition(xmlRegParserCtxtPtr ctxt, in xmlFAGenerateCountedTransition() argument
1523 to = xmlRegNewState(ctxt); in xmlFAGenerateCountedTransition()
1524 xmlRegStatePush(ctxt, to); in xmlFAGenerateCountedTransition()
1525 ctxt->state = to; in xmlFAGenerateCountedTransition()
1527 xmlRegStateAddTrans(ctxt, from, NULL, to, -1, counter); in xmlFAGenerateCountedTransition()
1540 xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from, in xmlFAGenerateTransitions() argument
1553 if (xmlRegAtomPush(ctxt, atom) < 0) { in xmlFAGenerateTransitions()
1561 xmlFAGenerateEpsilonTransition(ctxt, atom->stop, to); in xmlFAGenerateTransitions()
1565 to = xmlRegNewState(ctxt); in xmlFAGenerateTransitions()
1566 xmlRegStatePush(ctxt, to); in xmlFAGenerateTransitions()
1567 ctxt->state = to; in xmlFAGenerateTransitions()
1568 xmlFAGenerateEpsilonTransition(ctxt, atom->stop, to); in xmlFAGenerateTransitions()
1580 xmlFAGenerateEpsilonTransition(ctxt, atom->start, 0); in xmlFAGenerateTransitions()
1581 xmlFAGenerateEpsilonTransition(ctxt, atom->stop, in xmlFAGenerateTransitions()
1582 ctxt->state); in xmlFAGenerateTransitions()
1584 xmlFAGenerateEpsilonTransition(ctxt, atom->start, to); in xmlFAGenerateTransitions()
1589 xmlFAGenerateEpsilonTransition(ctxt, atom->start, atom->stop); in xmlFAGenerateTransitions()
1590 xmlFAGenerateEpsilonTransition(ctxt, atom->stop, atom->start); in xmlFAGenerateTransitions()
1594 xmlFAGenerateEpsilonTransition(ctxt, atom->stop, atom->start); in xmlFAGenerateTransitions()
1606 newstate = xmlRegNewState(ctxt); in xmlFAGenerateTransitions()
1607 xmlRegStatePush(ctxt, newstate); in xmlFAGenerateTransitions()
1627 copy = xmlRegCopyAtom(ctxt, atom); in xmlFAGenerateTransitions()
1634 if (xmlFAGenerateTransitions(ctxt, atom->start, NULL, copy) in xmlFAGenerateTransitions()
1637 inter = ctxt->state; in xmlFAGenerateTransitions()
1638 counter = xmlRegGetCounter(ctxt); in xmlFAGenerateTransitions()
1639 ctxt->counters[counter].min = atom->min - 1; in xmlFAGenerateTransitions()
1640 ctxt->counters[counter].max = atom->max - 1; in xmlFAGenerateTransitions()
1642 xmlFAGenerateCountedEpsilonTransition(ctxt, inter, in xmlFAGenerateTransitions()
1645 xmlFAGenerateCountedTransition(ctxt, inter, in xmlFAGenerateTransitions()
1648 xmlFAGenerateEpsilonTransition(ctxt, atom->start, in xmlFAGenerateTransitions()
1656 counter = xmlRegGetCounter(ctxt); in xmlFAGenerateTransitions()
1657 ctxt->counters[counter].min = atom->min - 1; in xmlFAGenerateTransitions()
1658 ctxt->counters[counter].max = atom->max - 1; in xmlFAGenerateTransitions()
1660 xmlFAGenerateCountedEpsilonTransition(ctxt, atom->stop, in xmlFAGenerateTransitions()
1663 xmlFAGenerateCountedTransition(ctxt, atom->stop, in xmlFAGenerateTransitions()
1667 xmlFAGenerateEpsilonTransition(ctxt, atom->start0, in xmlFAGenerateTransitions()
1674 ctxt->state = newstate; in xmlFAGenerateTransitions()
1687 to = xmlRegNewState(ctxt); in xmlFAGenerateTransitions()
1689 xmlRegStatePush(ctxt, to); in xmlFAGenerateTransitions()
1694 xmlFAGenerateEpsilonTransition(ctxt, from, to); in xmlFAGenerateTransitions()
1695 ctxt->state = to; in xmlFAGenerateTransitions()
1700 to = xmlRegNewState(ctxt); in xmlFAGenerateTransitions()
1702 xmlRegStatePush(ctxt, to); in xmlFAGenerateTransitions()
1717 tmp = xmlRegNewState(ctxt); in xmlFAGenerateTransitions()
1719 xmlRegStatePush(ctxt, tmp); in xmlFAGenerateTransitions()
1723 xmlFAGenerateEpsilonTransition(ctxt, tmp, to); in xmlFAGenerateTransitions()
1726 if (xmlRegAtomPush(ctxt, atom) < 0) { in xmlFAGenerateTransitions()
1729 xmlRegStateAddTrans(ctxt, from, atom, to, -1, -1); in xmlFAGenerateTransitions()
1730 ctxt->state = end; in xmlFAGenerateTransitions()
1734 xmlFAGenerateEpsilonTransition(ctxt, from, to); in xmlFAGenerateTransitions()
1738 xmlFAGenerateEpsilonTransition(ctxt, from, to); in xmlFAGenerateTransitions()
1739 xmlRegStateAddTrans(ctxt, to, atom, to, -1, -1); in xmlFAGenerateTransitions()
1743 xmlRegStateAddTrans(ctxt, to, atom, to, -1, -1); in xmlFAGenerateTransitions()
1748 xmlFAGenerateEpsilonTransition(ctxt, from, to); in xmlFAGenerateTransitions()
1767 xmlFAReduceEpsilonTransitions(xmlRegParserCtxtPtr ctxt, int fromnr, in xmlFAReduceEpsilonTransitions() argument
1776 from = ctxt->states[fromnr]; in xmlFAReduceEpsilonTransitions()
1779 to = ctxt->states[tonr]; in xmlFAReduceEpsilonTransitions()
1805 xmlRegStateAddTrans(ctxt, from, NULL, in xmlFAReduceEpsilonTransitions()
1806 ctxt->states[newto], in xmlFAReduceEpsilonTransitions()
1814 xmlFAReduceEpsilonTransitions(ctxt, fromnr, in xmlFAReduceEpsilonTransitions()
1818 xmlFAReduceEpsilonTransitions(ctxt, fromnr, in xmlFAReduceEpsilonTransitions()
1828 xmlRegStateAddTrans(ctxt, from, to->trans[transnr].atom, in xmlFAReduceEpsilonTransitions()
1829 ctxt->states[newto], in xmlFAReduceEpsilonTransitions()
1832 xmlRegStateAddTrans(ctxt, from, to->trans[transnr].atom, in xmlFAReduceEpsilonTransitions()
1833 ctxt->states[newto], counter, -1); in xmlFAReduceEpsilonTransitions()
1856 xmlFAEliminateSimpleEpsilonTransitions(xmlRegParserCtxtPtr ctxt) { in xmlFAEliminateSimpleEpsilonTransitions() argument
1860 for (statenr = 0;statenr < ctxt->nbStates;statenr++) { in xmlFAEliminateSimpleEpsilonTransitions()
1861 state = ctxt->states[statenr]; in xmlFAEliminateSimpleEpsilonTransitions()
1887 tmp = ctxt->states[state->transTo[i]]; in xmlFAEliminateSimpleEpsilonTransitions()
1895 xmlRegStateAddTrans(ctxt, tmp, tmp->trans[j].atom, in xmlFAEliminateSimpleEpsilonTransitions()
1896 ctxt->states[newto], in xmlFAEliminateSimpleEpsilonTransitions()
1903 ctxt->states[newto]->type = XML_REGEXP_FINAL_STATE; in xmlFAEliminateSimpleEpsilonTransitions()
1920 xmlFAEliminateEpsilonTransitions(xmlRegParserCtxtPtr ctxt) { in xmlFAEliminateEpsilonTransitions() argument
1925 if (ctxt->states == NULL) return; in xmlFAEliminateEpsilonTransitions()
1931 xmlFAEliminateSimpleEpsilonTransitions(ctxt); in xmlFAEliminateEpsilonTransitions()
1932 for (statenr = 0;statenr < ctxt->nbStates;statenr++) { in xmlFAEliminateEpsilonTransitions()
1933 state = ctxt->states[statenr]; in xmlFAEliminateEpsilonTransitions()
1939 ctxt->states[statenr] = NULL; in xmlFAEliminateEpsilonTransitions()
1953 for (statenr = ctxt->nbStates - 1;statenr >= 0;statenr--) { in xmlFAEliminateEpsilonTransitions()
1954 state = ctxt->states[statenr]; in xmlFAEliminateEpsilonTransitions()
1980 xmlFAReduceEpsilonTransitions(ctxt, statenr, in xmlFAEliminateEpsilonTransitions()
1996 for (statenr = 0;statenr < ctxt->nbStates;statenr++) { in xmlFAEliminateEpsilonTransitions()
1997 state = ctxt->states[statenr]; in xmlFAEliminateEpsilonTransitions()
2014 for (statenr = 0;statenr < ctxt->nbStates;statenr++) { in xmlFAEliminateEpsilonTransitions()
2015 state = ctxt->states[statenr]; in xmlFAEliminateEpsilonTransitions()
2019 state = ctxt->states[0]; in xmlFAEliminateEpsilonTransitions()
2034 if (ctxt->states[newto] == NULL) in xmlFAEliminateEpsilonTransitions()
2036 if (ctxt->states[newto]->reached == XML_REGEXP_MARK_NORMAL) { in xmlFAEliminateEpsilonTransitions()
2037 ctxt->states[newto]->reached = XML_REGEXP_MARK_START; in xmlFAEliminateEpsilonTransitions()
2038 target = ctxt->states[newto]; in xmlFAEliminateEpsilonTransitions()
2047 for (statenr = 1;statenr < ctxt->nbStates;statenr++) { in xmlFAEliminateEpsilonTransitions()
2048 state = ctxt->states[statenr]; in xmlFAEliminateEpsilonTransitions()
2058 for (statenr = 0;statenr < ctxt->nbStates;statenr++) { in xmlFAEliminateEpsilonTransitions()
2059 state = ctxt->states[statenr]; in xmlFAEliminateEpsilonTransitions()
2065 ctxt->states[statenr] = NULL; in xmlFAEliminateEpsilonTransitions()
2579 xmlFARecurseDeterminism(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state, in xmlFARecurseDeterminism() argument
2590 if (ctxt->flags & AM_AUTOMATA_RNG) in xmlFARecurseDeterminism()
2606 res = xmlFARecurseDeterminism(ctxt, ctxt->states[t1->to], in xmlFARecurseDeterminism()
2634 xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt) { in xmlFAComputesDeterminism() argument
2644 xmlRegPrintCtxt(stdout, ctxt); in xmlFAComputesDeterminism()
2646 if (ctxt->determinist != -1) in xmlFAComputesDeterminism()
2647 return(ctxt->determinist); in xmlFAComputesDeterminism()
2649 if (ctxt->flags & AM_AUTOMATA_RNG) in xmlFAComputesDeterminism()
2655 for (statenr = 0;statenr < ctxt->nbStates;statenr++) { in xmlFAComputesDeterminism()
2656 state = ctxt->states[statenr]; in xmlFAComputesDeterminism()
2697 for (statenr = 0;statenr < ctxt->nbStates;statenr++) { in xmlFAComputesDeterminism()
2698 state = ctxt->states[statenr]; in xmlFAComputesDeterminism()
2736 ret = xmlFARecurseDeterminism(ctxt, ctxt->states[t1->to], in xmlFAComputesDeterminism()
2771 ctxt->determinist = ret; in xmlFAComputesDeterminism()
4579 xmlFAIsChar(xmlRegParserCtxtPtr ctxt) { in xmlFAIsChar() argument
4583 cur = CUR_SCHAR(ctxt->cur, len); in xmlFAIsChar()
4609 xmlFAParseCharProp(xmlRegParserCtxtPtr ctxt) { in xmlFAParseCharProp() argument
4783 start = ctxt->cur; in xmlFAParseCharProp()
4800 blockName = xmlStrndup(start, ctxt->cur - start); in xmlFAParseCharProp()
4805 if (ctxt->atom == NULL) { in xmlFAParseCharProp()
4806 ctxt->atom = xmlRegNewAtom(ctxt, type); in xmlFAParseCharProp()
4807 if (ctxt->atom != NULL) in xmlFAParseCharProp()
4808 ctxt->atom->valuep = blockName; in xmlFAParseCharProp()
4809 } else if (ctxt->atom->type == XML_REGEXP_RANGES) { in xmlFAParseCharProp()
4810 xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg, in xmlFAParseCharProp()
4826 xmlFAParseCharClassEsc(xmlRegParserCtxtPtr ctxt) { in xmlFAParseCharClassEsc() argument
4830 if (ctxt->atom == NULL) { in xmlFAParseCharClassEsc()
4831 ctxt->atom = xmlRegNewAtom(ctxt, XML_REGEXP_ANYCHAR); in xmlFAParseCharClassEsc()
4832 } else if (ctxt->atom->type == XML_REGEXP_RANGES) { in xmlFAParseCharClassEsc()
4833 xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg, in xmlFAParseCharClassEsc()
4852 xmlFAParseCharProp(ctxt); in xmlFAParseCharClassEsc()
4865 xmlFAParseCharProp(ctxt); in xmlFAParseCharClassEsc()
4866 ctxt->atom->neg = 1; in xmlFAParseCharClassEsc()
4877 if (ctxt->atom == NULL) { in xmlFAParseCharClassEsc()
4878 ctxt->atom = xmlRegNewAtom(ctxt, XML_REGEXP_CHARVAL); in xmlFAParseCharClassEsc()
4879 if (ctxt->atom != NULL) { in xmlFAParseCharClassEsc()
4882 ctxt->atom->codepoint = '\n'; in xmlFAParseCharClassEsc()
4885 ctxt->atom->codepoint = '\r'; in xmlFAParseCharClassEsc()
4888 ctxt->atom->codepoint = '\t'; in xmlFAParseCharClassEsc()
4891 ctxt->atom->codepoint = cur; in xmlFAParseCharClassEsc()
4894 } else if (ctxt->atom->type == XML_REGEXP_RANGES) { in xmlFAParseCharClassEsc()
4906 xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg, in xmlFAParseCharClassEsc()
4948 if (ctxt->atom == NULL) { in xmlFAParseCharClassEsc()
4949 ctxt->atom = xmlRegNewAtom(ctxt, type); in xmlFAParseCharClassEsc()
4950 } else if (ctxt->atom->type == XML_REGEXP_RANGES) { in xmlFAParseCharClassEsc()
4951 xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg, in xmlFAParseCharClassEsc()
4970 xmlFAParseCharRange(xmlRegParserCtxtPtr ctxt) { in xmlFAParseCharRange() argument
4999 end = start = CUR_SCHAR(ctxt->cur, len); in xmlFAParseCharRange()
5015 xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg, in xmlFAParseCharRange()
5038 end = CUR_SCHAR(ctxt->cur, len); in xmlFAParseCharRange()
5048 xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg, in xmlFAParseCharRange()
5061 xmlFAParsePosCharGroup(xmlRegParserCtxtPtr ctxt) { in xmlFAParsePosCharGroup() argument
5064 xmlFAParseCharClassEsc(ctxt); in xmlFAParsePosCharGroup()
5066 xmlFAParseCharRange(ctxt); in xmlFAParsePosCharGroup()
5069 (CUR != 0) && (ctxt->error == 0)); in xmlFAParsePosCharGroup()
5082 xmlFAParseCharGroup(xmlRegParserCtxtPtr ctxt) { in xmlFAParseCharGroup() argument
5083 int n = ctxt->neg; in xmlFAParseCharGroup()
5084 while ((CUR != ']') && (ctxt->error == 0)) { in xmlFAParseCharGroup()
5086 int neg = ctxt->neg; in xmlFAParseCharGroup()
5089 ctxt->neg = !ctxt->neg; in xmlFAParseCharGroup()
5090 xmlFAParsePosCharGroup(ctxt); in xmlFAParseCharGroup()
5091 ctxt->neg = neg; in xmlFAParseCharGroup()
5093 int neg = ctxt->neg; in xmlFAParseCharGroup()
5094 ctxt->neg = 2; in xmlFAParseCharGroup()
5097 xmlFAParseCharGroup(ctxt); in xmlFAParseCharGroup()
5104 ctxt->neg = neg; in xmlFAParseCharGroup()
5107 xmlFAParsePosCharGroup(ctxt); in xmlFAParseCharGroup()
5110 ctxt->neg = n; in xmlFAParseCharGroup()
5121 xmlFAParseCharClass(xmlRegParserCtxtPtr ctxt) { in xmlFAParseCharClass() argument
5124 ctxt->atom = xmlRegNewAtom(ctxt, XML_REGEXP_RANGES); in xmlFAParseCharClass()
5125 if (ctxt->atom == NULL) in xmlFAParseCharClass()
5127 xmlFAParseCharGroup(ctxt); in xmlFAParseCharClass()
5134 xmlFAParseCharClassEsc(ctxt); in xmlFAParseCharClass()
5147 xmlFAParseQuantExact(xmlRegParserCtxtPtr ctxt) { in xmlFAParseQuantExact() argument
5173 xmlFAParseQuantifier(xmlRegParserCtxtPtr ctxt) { in xmlFAParseQuantifier() argument
5178 if (ctxt->atom != NULL) { in xmlFAParseQuantifier()
5180 ctxt->atom->quant = XML_REGEXP_QUANT_OPT; in xmlFAParseQuantifier()
5182 ctxt->atom->quant = XML_REGEXP_QUANT_MULT; in xmlFAParseQuantifier()
5184 ctxt->atom->quant = XML_REGEXP_QUANT_PLUS; in xmlFAParseQuantifier()
5193 cur = xmlFAParseQuantExact(ctxt); in xmlFAParseQuantifier()
5201 cur = xmlFAParseQuantExact(ctxt); in xmlFAParseQuantifier()
5216 if (ctxt->atom != NULL) { in xmlFAParseQuantifier()
5217 ctxt->atom->quant = XML_REGEXP_QUANT_RANGE; in xmlFAParseQuantifier()
5218 ctxt->atom->min = min; in xmlFAParseQuantifier()
5219 ctxt->atom->max = max; in xmlFAParseQuantifier()
5233 xmlFAParseAtom(xmlRegParserCtxtPtr ctxt) { in xmlFAParseAtom() argument
5236 codepoint = xmlFAIsChar(ctxt); in xmlFAParseAtom()
5238 ctxt->atom = xmlRegNewAtom(ctxt, XML_REGEXP_CHARVAL); in xmlFAParseAtom()
5239 if (ctxt->atom == NULL) in xmlFAParseAtom()
5241 codepoint = CUR_SCHAR(ctxt->cur, len); in xmlFAParseAtom()
5242 ctxt->atom->codepoint = codepoint; in xmlFAParseAtom()
5259 xmlFAGenerateEpsilonTransition(ctxt, ctxt->state, NULL); in xmlFAParseAtom()
5260 start0 = ctxt->state; in xmlFAParseAtom()
5261 xmlFAGenerateEpsilonTransition(ctxt, ctxt->state, NULL); in xmlFAParseAtom()
5262 start = ctxt->state; in xmlFAParseAtom()
5263 oldend = ctxt->end; in xmlFAParseAtom()
5264 ctxt->end = NULL; in xmlFAParseAtom()
5265 ctxt->atom = NULL; in xmlFAParseAtom()
5266 xmlFAParseRegExp(ctxt, 0); in xmlFAParseAtom()
5272 ctxt->atom = xmlRegNewAtom(ctxt, XML_REGEXP_SUBREG); in xmlFAParseAtom()
5273 if (ctxt->atom == NULL) in xmlFAParseAtom()
5275 ctxt->atom->start = start; in xmlFAParseAtom()
5276 ctxt->atom->start0 = start0; in xmlFAParseAtom()
5277 ctxt->atom->stop = ctxt->state; in xmlFAParseAtom()
5278 ctxt->end = oldend; in xmlFAParseAtom()
5281 xmlFAParseCharClass(ctxt); in xmlFAParseAtom()
5294 xmlFAParsePiece(xmlRegParserCtxtPtr ctxt) { in xmlFAParsePiece() argument
5297 ctxt->atom = NULL; in xmlFAParsePiece()
5298 ret = xmlFAParseAtom(ctxt); in xmlFAParsePiece()
5301 if (ctxt->atom == NULL) { in xmlFAParsePiece()
5304 xmlFAParseQuantifier(ctxt); in xmlFAParsePiece()
5319 xmlFAParseBranch(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr to) { in xmlFAParseBranch() argument
5323 previous = ctxt->state; in xmlFAParseBranch()
5324 ret = xmlFAParsePiece(ctxt); in xmlFAParseBranch()
5326 if (xmlFAGenerateTransitions(ctxt, previous, in xmlFAParseBranch()
5327 (CUR=='|' || CUR==')') ? to : NULL, ctxt->atom) < 0) in xmlFAParseBranch()
5329 previous = ctxt->state; in xmlFAParseBranch()
5330 ctxt->atom = NULL; in xmlFAParseBranch()
5332 while ((ret != 0) && (ctxt->error == 0)) { in xmlFAParseBranch()
5333 ret = xmlFAParsePiece(ctxt); in xmlFAParseBranch()
5335 if (xmlFAGenerateTransitions(ctxt, previous, in xmlFAParseBranch()
5336 (CUR=='|' || CUR==')') ? to : NULL, ctxt->atom) < 0) in xmlFAParseBranch()
5338 previous = ctxt->state; in xmlFAParseBranch()
5339 ctxt->atom = NULL; in xmlFAParseBranch()
5353 xmlFAParseRegExp(xmlRegParserCtxtPtr ctxt, int top) { in xmlFAParseRegExp() argument
5357 start = ctxt->state; in xmlFAParseRegExp()
5358 ctxt->end = NULL; in xmlFAParseRegExp()
5359 xmlFAParseBranch(ctxt, NULL); in xmlFAParseRegExp()
5362 printf("State %d is final\n", ctxt->state->no); in xmlFAParseRegExp()
5364 ctxt->state->type = XML_REGEXP_FINAL_STATE; in xmlFAParseRegExp()
5367 ctxt->end = ctxt->state; in xmlFAParseRegExp()
5370 end = ctxt->state; in xmlFAParseRegExp()
5371 while ((CUR == '|') && (ctxt->error == 0)) { in xmlFAParseRegExp()
5373 ctxt->state = start; in xmlFAParseRegExp()
5374 ctxt->end = NULL; in xmlFAParseRegExp()
5375 xmlFAParseBranch(ctxt, end); in xmlFAParseRegExp()
5378 ctxt->state = end; in xmlFAParseRegExp()
5379 ctxt->end = end; in xmlFAParseRegExp()
5439 xmlRegParserCtxtPtr ctxt; in xmlRegexpCompile() local
5441 ctxt = xmlRegNewParserCtxt(regexp); in xmlRegexpCompile()
5442 if (ctxt == NULL) in xmlRegexpCompile()
5446 ctxt->end = NULL; in xmlRegexpCompile()
5447 ctxt->start = ctxt->state = xmlRegNewState(ctxt); in xmlRegexpCompile()
5448 xmlRegStatePush(ctxt, ctxt->start); in xmlRegexpCompile()
5451 xmlFAParseRegExp(ctxt, 1); in xmlRegexpCompile()
5455 if (ctxt->error != 0) { in xmlRegexpCompile()
5456 xmlRegFreeParserCtxt(ctxt); in xmlRegexpCompile()
5459 ctxt->end = ctxt->state; in xmlRegexpCompile()
5460 ctxt->start->type = XML_REGEXP_START_STATE; in xmlRegexpCompile()
5461 ctxt->end->type = XML_REGEXP_FINAL_STATE; in xmlRegexpCompile()
5464 xmlFAEliminateEpsilonTransitions(ctxt); in xmlRegexpCompile()
5467 if (ctxt->error != 0) { in xmlRegexpCompile()
5468 xmlRegFreeParserCtxt(ctxt); in xmlRegexpCompile()
5471 ret = xmlRegEpxFromParse(ctxt); in xmlRegexpCompile()
5472 xmlRegFreeParserCtxt(ctxt); in xmlRegexpCompile()
5587 xmlAutomataPtr ctxt; in xmlNewAutomata() local
5589 ctxt = xmlRegNewParserCtxt(NULL); in xmlNewAutomata()
5590 if (ctxt == NULL) in xmlNewAutomata()
5594 ctxt->end = NULL; in xmlNewAutomata()
5595 ctxt->start = ctxt->state = xmlRegNewState(ctxt); in xmlNewAutomata()
5596 if (ctxt->start == NULL) { in xmlNewAutomata()
5597 xmlFreeAutomata(ctxt); in xmlNewAutomata()
5600 ctxt->start->type = XML_REGEXP_START_STATE; in xmlNewAutomata()
5601 if (xmlRegStatePush(ctxt, ctxt->start) < 0) { in xmlNewAutomata()
5602 xmlRegFreeState(ctxt->start); in xmlNewAutomata()
5603 xmlFreeAutomata(ctxt); in xmlNewAutomata()
5606 ctxt->flags = 0; in xmlNewAutomata()
5608 return(ctxt); in xmlNewAutomata()
6382 xmlExpFreeCtxt(xmlExpCtxtPtr ctxt) { in xmlExpFreeCtxt() argument
6383 if (ctxt == NULL) in xmlExpFreeCtxt()
6385 xmlDictFree(ctxt->dict); in xmlExpFreeCtxt()
6386 if (ctxt->table != NULL) in xmlExpFreeCtxt()
6387 xmlFree(ctxt->table); in xmlExpFreeCtxt()
6388 xmlFree(ctxt); in xmlExpFreeCtxt()
6445 static xmlExpNodePtr xmlExpNewNode(xmlExpCtxtPtr ctxt, xmlExpNodeType type);
6515 xmlExpNewNode(xmlExpCtxtPtr ctxt, xmlExpNodeType type) { in xmlExpNewNode() argument
6518 if (ctxt->nb_nodes >= MAX_NODES) in xmlExpNewNode()
6526 ctxt->nb_nodes++; in xmlExpNewNode()
6527 ctxt->nb_cons++; in xmlExpNewNode()
6542 xmlExpHashGetEntry(xmlExpCtxtPtr ctxt, xmlExpNodeType type, in xmlExpHashGetEntry() argument
6549 if (ctxt == NULL) in xmlExpHashGetEntry()
6565 xmlExpFree(ctxt, left); in xmlExpHashGetEntry()
6570 xmlExpFree(ctxt, left); in xmlExpHashGetEntry()
6581 xmlExpFree(ctxt, left); in xmlExpHashGetEntry()
6585 xmlExpFree(ctxt, right); in xmlExpHashGetEntry()
6607 xmlExpFree(ctxt, left); in xmlExpHashGetEntry()
6624 tmp = xmlExpHashGetEntry(ctxt, XML_EXP_OR, left->exp_right, right, in xmlExpHashGetEntry()
6627 tmp = xmlExpHashGetEntry(ctxt, XML_EXP_OR, left->exp_left, tmp, in xmlExpHashGetEntry()
6630 xmlExpFree(ctxt, left); in xmlExpHashGetEntry()
6639 tmp = xmlExpHashGetEntry(ctxt, XML_EXP_OR, right->exp_right, in xmlExpHashGetEntry()
6642 tmp = xmlExpHashGetEntry(ctxt, XML_EXP_OR, right->exp_left, in xmlExpHashGetEntry()
6644 xmlExpFree(ctxt, right); in xmlExpHashGetEntry()
6652 tmp = xmlExpHashGetEntry(ctxt, XML_EXP_OR, left, in xmlExpHashGetEntry()
6655 tmp = xmlExpHashGetEntry(ctxt, XML_EXP_OR, right->exp_left, in xmlExpHashGetEntry()
6657 xmlExpFree(ctxt, right); in xmlExpHashGetEntry()
6671 xmlExpFree(ctxt, right); in xmlExpHashGetEntry()
6675 xmlExpFree(ctxt, left); in xmlExpHashGetEntry()
6689 key = kbase % ctxt->size; in xmlExpHashGetEntry()
6690 if (ctxt->table[key] != NULL) { in xmlExpHashGetEntry()
6691 for (insert = ctxt->table[key]; insert != NULL; in xmlExpHashGetEntry()
6718 entry = xmlExpNewNode(ctxt, type); in xmlExpHashGetEntry()
6759 if (ctxt->table[key] != NULL) in xmlExpHashGetEntry()
6760 entry->next = ctxt->table[key]; in xmlExpHashGetEntry()
6762 ctxt->table[key] = entry; in xmlExpHashGetEntry()
6763 ctxt->nbElems++; in xmlExpHashGetEntry()
6776 xmlExpFree(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp) { in xmlExpFree() argument
6784 key = exp->key % ctxt->size; in xmlExpFree()
6785 if (ctxt->table[key] == exp) { in xmlExpFree()
6786 ctxt->table[key] = exp->next; in xmlExpFree()
6790 tmp = ctxt->table[key]; in xmlExpFree()
6801 xmlExpFree(ctxt, exp->exp_left); in xmlExpFree()
6802 xmlExpFree(ctxt, exp->exp_right); in xmlExpFree()
6804 xmlExpFree(ctxt, exp->exp_left); in xmlExpFree()
6807 ctxt->nb_nodes--; in xmlExpFree()
6834 xmlExpNewAtom(xmlExpCtxtPtr ctxt, const xmlChar *name, int len) { in xmlExpNewAtom() argument
6835 if ((ctxt == NULL) || (name == NULL)) in xmlExpNewAtom()
6837 name = xmlDictLookup(ctxt->dict, name, len); in xmlExpNewAtom()
6840 return(xmlExpHashGetEntry(ctxt, XML_EXP_ATOM, NULL, NULL, name, 0, 0)); in xmlExpNewAtom()
6857 xmlExpNewOr(xmlExpCtxtPtr ctxt, xmlExpNodePtr left, xmlExpNodePtr right) { in xmlExpNewOr() argument
6858 if (ctxt == NULL) in xmlExpNewOr()
6861 xmlExpFree(ctxt, left); in xmlExpNewOr()
6862 xmlExpFree(ctxt, right); in xmlExpNewOr()
6865 return(xmlExpHashGetEntry(ctxt, XML_EXP_OR, left, right, NULL, 0, 0)); in xmlExpNewOr()
6882 xmlExpNewSeq(xmlExpCtxtPtr ctxt, xmlExpNodePtr left, xmlExpNodePtr right) { in xmlExpNewSeq() argument
6883 if (ctxt == NULL) in xmlExpNewSeq()
6886 xmlExpFree(ctxt, left); in xmlExpNewSeq()
6887 xmlExpFree(ctxt, right); in xmlExpNewSeq()
6890 return(xmlExpHashGetEntry(ctxt, XML_EXP_SEQ, left, right, NULL, 0, 0)); in xmlExpNewSeq()
6908 xmlExpNewRange(xmlExpCtxtPtr ctxt, xmlExpNodePtr subset, int min, int max) { in xmlExpNewRange() argument
6909 if (ctxt == NULL) in xmlExpNewRange()
6913 xmlExpFree(ctxt, subset); in xmlExpNewRange()
6916 return(xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, subset, in xmlExpNewRange()
6927 xmlExpGetLanguageInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, in xmlExpGetLanguageInt() argument
6947 tmp = xmlExpGetLanguageInt(ctxt, exp->exp_left, list, len, nb); in xmlExpGetLanguageInt()
6950 tmp2 = xmlExpGetLanguageInt(ctxt, exp->exp_right, list, len, in xmlExpGetLanguageInt()
6972 xmlExpGetLanguage(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, in xmlExpGetLanguage() argument
6974 if ((ctxt == NULL) || (exp == NULL) || (langList == NULL) || (len <= 0)) in xmlExpGetLanguage()
6976 return(xmlExpGetLanguageInt(ctxt, exp, langList, len, 0)); in xmlExpGetLanguage()
6980 xmlExpGetStartInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, in xmlExpGetStartInt() argument
7001 tmp = xmlExpGetStartInt(ctxt, exp->exp_left, list, len, nb); in xmlExpGetStartInt()
7005 tmp2 = xmlExpGetStartInt(ctxt, exp->exp_right, list, len, in xmlExpGetStartInt()
7013 tmp = xmlExpGetStartInt(ctxt, exp->exp_left, list, len, nb); in xmlExpGetStartInt()
7016 tmp2 = xmlExpGetStartInt(ctxt, exp->exp_right, list, len, in xmlExpGetStartInt()
7040 xmlExpGetStart(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, in xmlExpGetStart() argument
7042 if ((ctxt == NULL) || (exp == NULL) || (tokList == NULL) || (len <= 0)) in xmlExpGetStart()
7044 return(xmlExpGetStartInt(ctxt, exp, tokList, len, 0)); in xmlExpGetStart()
7063 xmlExpStringDeriveInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, const xmlChar *str) in xmlExpStringDeriveInt() argument
7092 tmp = xmlExpStringDeriveInt(ctxt, exp->exp_left, str); in xmlExpStringDeriveInt()
7096 ret = xmlExpStringDeriveInt(ctxt, exp->exp_right, str); in xmlExpStringDeriveInt()
7098 xmlExpFree(ctxt, tmp); in xmlExpStringDeriveInt()
7101 ret = xmlExpHashGetEntry(ctxt, XML_EXP_OR, tmp, ret, in xmlExpStringDeriveInt()
7109 ret = xmlExpStringDeriveInt(ctxt, exp->exp_left, str); in xmlExpStringDeriveInt()
7117 ret = xmlExpStringDeriveInt(ctxt, exp->exp_right, str); in xmlExpStringDeriveInt()
7124 ret = xmlExpHashGetEntry(ctxt, XML_EXP_SEQ, ret, exp->exp_right, in xmlExpStringDeriveInt()
7134 ret = xmlExpStringDeriveInt(ctxt, exp->exp_left, str); in xmlExpStringDeriveInt()
7154 tmp = xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, exp->exp_left, NULL, in xmlExpStringDeriveInt()
7165 return(xmlExpHashGetEntry(ctxt, XML_EXP_SEQ, ret, tmp, in xmlExpStringDeriveInt()
7185 xmlExpStringDerive(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, in xmlExpStringDerive() argument
7189 if ((exp == NULL) || (ctxt == NULL) || (str == NULL)) { in xmlExpStringDerive()
7196 input = xmlDictExists(ctxt->dict, str, len); in xmlExpStringDerive()
7200 return(xmlExpStringDeriveInt(ctxt, exp, input)); in xmlExpStringDerive()
7220 static xmlExpNodePtr xmlExpExpDeriveInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp,
7238 xmlExpDivide(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub, in xmlExpDivide() argument
7250 tmp = xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, in xmlExpDivide()
7256 xmlExpFree(ctxt, tmp); in xmlExpDivide()
7259 tmp2 = xmlExpExpDeriveInt(ctxt, tmp, exp); in xmlExpDivide()
7261 xmlExpFree(ctxt, tmp); in xmlExpDivide()
7268 xmlExpFree(ctxt, tmp2); in xmlExpDivide()
7272 xmlExpFree(ctxt, tmp); in xmlExpDivide()
7278 xmlExpFree(ctxt, tmp); in xmlExpDivide()
7279 xmlExpFree(ctxt, tmp2); in xmlExpDivide()
7299 xmlExpExpDeriveInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) { in xmlExpExpDeriveInt() argument
7328 tmp = xmlExpExpDeriveInt(ctxt, exp, sub->exp_left); in xmlExpExpDeriveInt()
7333 ret = xmlExpExpDeriveInt(ctxt, tmp, sub->exp_right); in xmlExpExpDeriveInt()
7334 xmlExpFree(ctxt, tmp); in xmlExpExpDeriveInt()
7341 tmp = xmlExpExpDeriveInt(ctxt, exp, sub->exp_left); in xmlExpExpDeriveInt()
7346 ret = xmlExpExpDeriveInt(ctxt, exp, sub->exp_right); in xmlExpExpDeriveInt()
7348 xmlExpFree(ctxt, tmp); in xmlExpExpDeriveInt()
7351 return(xmlExpHashGetEntry(ctxt, XML_EXP_OR, tmp, ret, NULL, 0, 0)); in xmlExpExpDeriveInt()
7412 ret = xmlExpExpDeriveInt(ctxt, exp->exp_left, sub); in xmlExpExpDeriveInt()
7425 return(xmlExpHashGetEntry(ctxt, XML_EXP_SEQ, ret, in xmlExpExpDeriveInt()
7440 ret = xmlExpExpDeriveInt(ctxt, exp->exp_left, sub->exp_left); in xmlExpExpDeriveInt()
7456 tmp = xmlExpHashGetEntry(ctxt, XML_EXP_SEQ, ret, in xmlExpExpDeriveInt()
7462 tmp2 = xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, in xmlExpExpDeriveInt()
7465 xmlExpFree(ctxt, tmp); in xmlExpExpDeriveInt()
7468 ret = xmlExpExpDeriveInt(ctxt, tmp, tmp2); in xmlExpExpDeriveInt()
7469 xmlExpFree(ctxt, tmp); in xmlExpExpDeriveInt()
7470 xmlExpFree(ctxt, tmp2); in xmlExpExpDeriveInt()
7480 ret = xmlExpExpDeriveInt(ctxt, exp->exp_left, sub); in xmlExpExpDeriveInt()
7483 tmp = xmlExpExpDeriveInt(ctxt, exp->exp_right, sub); in xmlExpExpDeriveInt()
7485 xmlExpFree(ctxt, ret); in xmlExpExpDeriveInt()
7488 return(xmlExpHashGetEntry(ctxt, XML_EXP_OR, ret, tmp, NULL, 0, 0)); in xmlExpExpDeriveInt()
7496 tmp = xmlExpExpDeriveInt(ctxt, exp->exp_left, sub->exp_left); in xmlExpExpDeriveInt()
7505 mult = xmlExpDivide(ctxt, sub->exp_left, exp->exp_left, in xmlExpExpDeriveInt()
7524 xmlExpFree(ctxt, tmp); in xmlExpExpDeriveInt()
7544 xmlExpFree(ctxt, tmp); in xmlExpExpDeriveInt()
7562 xmlExpFree(ctxt, tmp); in xmlExpExpDeriveInt()
7583 xmlExpFree(ctxt, tmp); in xmlExpExpDeriveInt()
7606 xmlExpFree(ctxt, tmp); in xmlExpExpDeriveInt()
7620 tmp2 = xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, exp->exp_left, in xmlExpExpDeriveInt()
7625 ret = xmlExpHashGetEntry(ctxt, XML_EXP_SEQ, tmp, tmp2, in xmlExpExpDeriveInt()
7629 tmp = xmlExpExpDeriveInt(ctxt, exp->exp_left, sub); in xmlExpExpDeriveInt()
7651 tmp2 = xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, exp->exp_left, in xmlExpExpDeriveInt()
7655 ret = xmlExpHashGetEntry(ctxt, XML_EXP_SEQ, tmp, tmp2, in xmlExpExpDeriveInt()
7675 if (ctxt->tabSize == 0) in xmlExpExpDeriveInt()
7676 ctxt->tabSize = 40; in xmlExpExpDeriveInt()
7678 tab = (const xmlChar **) xmlMalloc(ctxt->tabSize * in xmlExpExpDeriveInt()
7687 len = xmlExpGetStartInt(ctxt, sub, tab, ctxt->tabSize, 0); in xmlExpExpDeriveInt()
7690 temp = (const xmlChar **) xmlRealloc((xmlChar **) tab, ctxt->tabSize * 2 * in xmlExpExpDeriveInt()
7697 ctxt->tabSize *= 2; in xmlExpExpDeriveInt()
7698 len = xmlExpGetStartInt(ctxt, sub, tab, ctxt->tabSize, 0); in xmlExpExpDeriveInt()
7701 tmp = xmlExpStringDeriveInt(ctxt, exp, tab[i]); in xmlExpExpDeriveInt()
7703 xmlExpFree(ctxt, ret); in xmlExpExpDeriveInt()
7707 tmp2 = xmlExpStringDeriveInt(ctxt, sub, tab[i]); in xmlExpExpDeriveInt()
7709 xmlExpFree(ctxt, tmp); in xmlExpExpDeriveInt()
7710 xmlExpFree(ctxt, ret); in xmlExpExpDeriveInt()
7714 tmp3 = xmlExpExpDeriveInt(ctxt, tmp, tmp2); in xmlExpExpDeriveInt()
7715 xmlExpFree(ctxt, tmp); in xmlExpExpDeriveInt()
7716 xmlExpFree(ctxt, tmp2); in xmlExpExpDeriveInt()
7719 xmlExpFree(ctxt, ret); in xmlExpExpDeriveInt()
7727 ret = xmlExpHashGetEntry(ctxt, XML_EXP_OR, ret, tmp3, NULL, 0, 0); in xmlExpExpDeriveInt()
7753 xmlExpExpDerive(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) { in xmlExpExpDerive() argument
7754 if ((exp == NULL) || (ctxt == NULL) || (sub == NULL)) in xmlExpExpDerive()
7772 return(xmlExpExpDeriveInt(ctxt, exp, sub)); in xmlExpExpDerive()
7787 xmlExpSubsume(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) { in xmlExpSubsume() argument
7790 if ((exp == NULL) || (ctxt == NULL) || (sub == NULL)) in xmlExpSubsume()
7812 tmp = xmlExpExpDeriveInt(ctxt, exp, sub); in xmlExpSubsume()
7824 xmlExpFree(ctxt, tmp); in xmlExpSubsume()
7827 xmlExpFree(ctxt, tmp); in xmlExpSubsume()
7837 static xmlExpNodePtr xmlExpParseExpr(xmlExpCtxtPtr ctxt);
7840 #define CUR (*ctxt->cur)
7842 #define NEXT ctxt->cur++;
7845 #define SKIP_BLANKS while (IS_BLANK(*ctxt->cur)) ctxt->cur++;
7848 xmlExpParseNumber(xmlExpCtxtPtr ctxt) { in xmlExpParseNumber() argument
7866 xmlExpParseOr(xmlExpCtxtPtr ctxt) { in xmlExpParseOr() argument
7872 base = ctxt->cur; in xmlExpParseOr()
7873 if (*ctxt->cur == '(') { in xmlExpParseOr()
7875 ret = xmlExpParseExpr(ctxt); in xmlExpParseOr()
7877 if (*ctxt->cur != ')') { in xmlExpParseOr()
7879 xmlExpFree(ctxt, ret); in xmlExpParseOr()
7890 val = xmlDictLookup(ctxt->dict, BAD_CAST base, ctxt->cur - base); in xmlExpParseOr()
7893 ret = xmlExpHashGetEntry(ctxt, XML_EXP_ATOM, NULL, NULL, val, 0, 0); in xmlExpParseOr()
7902 min = xmlExpParseNumber(ctxt); in xmlExpParseOr()
7904 xmlExpFree(ctxt, ret); in xmlExpParseOr()
7910 max = xmlExpParseNumber(ctxt); in xmlExpParseOr()
7915 xmlExpFree(ctxt, ret); in xmlExpParseOr()
7919 ret = xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, ret, NULL, NULL, in xmlExpParseOr()
7924 ret = xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, ret, NULL, NULL, in xmlExpParseOr()
7929 ret = xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, ret, NULL, NULL, in xmlExpParseOr()
7934 ret = xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, ret, NULL, NULL, in xmlExpParseOr()
7943 xmlExpParseSeq(xmlExpCtxtPtr ctxt) { in xmlExpParseSeq() argument
7946 ret = xmlExpParseOr(ctxt); in xmlExpParseSeq()
7950 right = xmlExpParseOr(ctxt); in xmlExpParseSeq()
7952 xmlExpFree(ctxt, ret); in xmlExpParseSeq()
7955 ret = xmlExpHashGetEntry(ctxt, XML_EXP_OR, ret, right, NULL, 0, 0); in xmlExpParseSeq()
7963 xmlExpParseExpr(xmlExpCtxtPtr ctxt) { in xmlExpParseExpr() argument
7966 ret = xmlExpParseSeq(ctxt); in xmlExpParseExpr()
7970 right = xmlExpParseSeq(ctxt); in xmlExpParseExpr()
7972 xmlExpFree(ctxt, ret); in xmlExpParseExpr()
7975 ret = xmlExpHashGetEntry(ctxt, XML_EXP_SEQ, ret, right, NULL, 0, 0); in xmlExpParseExpr()
8000 xmlExpParse(xmlExpCtxtPtr ctxt, const char *expr) { in xmlExpParse() argument
8003 ctxt->expr = expr; in xmlExpParse()
8004 ctxt->cur = expr; in xmlExpParse()
8006 ret = xmlExpParseExpr(ctxt); in xmlExpParse()
8008 if (*ctxt->cur != 0) { in xmlExpParse()
8009 xmlExpFree(ctxt, ret); in xmlExpParse()
8129 xmlExpCtxtNbNodes(xmlExpCtxtPtr ctxt) { in xmlExpCtxtNbNodes() argument
8130 if (ctxt == NULL) in xmlExpCtxtNbNodes()
8132 return(ctxt->nb_nodes); in xmlExpCtxtNbNodes()
8144 xmlExpCtxtNbCons(xmlExpCtxtPtr ctxt) { in xmlExpCtxtNbCons() argument
8145 if (ctxt == NULL) in xmlExpCtxtNbCons()
8147 return(ctxt->nb_cons); in xmlExpCtxtNbCons()