Lines Matching refs:ctxt
51 ctxt->error = XML_REGEXP_COMPILE_ERROR; \
52 xmlRegexpErrCompile(ctxt, str);
53 #define NEXT ctxt->cur++
54 #define CUR (*(ctxt->cur))
55 #define NXT(index) (ctxt->cur[index])
58 #define NEXTL(l) ctxt->cur += l;
64 #define PREV (ctxt->cur[-1])
356 static void xmlFAParseRegExp(xmlRegParserCtxtPtr ctxt, int top);
378 xmlRegexpErrMemory(xmlRegParserCtxtPtr ctxt, const char *extra) in xmlRegexpErrMemory() argument
381 if (ctxt != NULL) { in xmlRegexpErrMemory()
382 regexp = (const char *) ctxt->string; in xmlRegexpErrMemory()
383 ctxt->error = XML_ERR_NO_MEMORY; in xmlRegexpErrMemory()
398 xmlRegexpErrCompile(xmlRegParserCtxtPtr ctxt, const char *extra) in xmlRegexpErrCompile() argument
403 if (ctxt != NULL) { in xmlRegexpErrCompile()
404 regexp = (const char *) ctxt->string; in xmlRegexpErrCompile()
405 idx = ctxt->cur - ctxt->string; in xmlRegexpErrCompile()
406 ctxt->error = XML_REGEXP_COMPILE_ERROR; in xmlRegexpErrCompile()
420 static int xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt);
430 xmlRegEpxFromParse(xmlRegParserCtxtPtr ctxt) { in xmlRegEpxFromParse() argument
435 xmlRegexpErrMemory(ctxt, "compiling regexp"); in xmlRegEpxFromParse()
439 ret->string = ctxt->string; in xmlRegEpxFromParse()
440 ret->nbStates = ctxt->nbStates; in xmlRegEpxFromParse()
441 ret->states = ctxt->states; in xmlRegEpxFromParse()
442 ret->nbAtoms = ctxt->nbAtoms; in xmlRegEpxFromParse()
443 ret->atoms = ctxt->atoms; in xmlRegEpxFromParse()
444 ret->nbCounters = ctxt->nbCounters; in xmlRegEpxFromParse()
445 ret->counters = ctxt->counters; in xmlRegEpxFromParse()
446 ret->determinist = ctxt->determinist; in xmlRegEpxFromParse()
447 ret->flags = ctxt->flags; in xmlRegEpxFromParse()
454 (ctxt->negs == 0) && in xmlRegEpxFromParse()
476 xmlRegexpErrMemory(ctxt, "compiling regexp"); in xmlRegEpxFromParse()
493 xmlRegexpErrMemory(ctxt, "compiling regexp"); in xmlRegEpxFromParse()
500 xmlRegexpErrMemory(ctxt, "compiling regexp"); in xmlRegEpxFromParse()
584 xmlRegexpErrMemory(ctxt, "compiling regexp"); in xmlRegEpxFromParse()
666 ctxt->string = NULL; in xmlRegEpxFromParse()
667 ctxt->nbStates = 0; in xmlRegEpxFromParse()
668 ctxt->states = NULL; in xmlRegEpxFromParse()
669 ctxt->nbAtoms = 0; in xmlRegEpxFromParse()
670 ctxt->atoms = NULL; in xmlRegEpxFromParse()
671 ctxt->nbCounters = 0; in xmlRegEpxFromParse()
672 ctxt->counters = NULL; in xmlRegEpxFromParse()
715 xmlRegNewRange(xmlRegParserCtxtPtr ctxt, in xmlRegNewRange() argument
721 xmlRegexpErrMemory(ctxt, "allocating range"); in xmlRegNewRange()
756 xmlRegCopyRange(xmlRegParserCtxtPtr ctxt, xmlRegRangePtr range) { in xmlRegCopyRange() argument
762 ret = xmlRegNewRange(ctxt, range->neg, range->type, range->start, in xmlRegCopyRange()
769 xmlRegexpErrMemory(ctxt, "allocating range"); in xmlRegCopyRange()
787 xmlRegNewAtom(xmlRegParserCtxtPtr ctxt, xmlRegAtomType type) { in xmlRegNewAtom() argument
792 xmlRegexpErrMemory(ctxt, "allocating atom"); in xmlRegNewAtom()
839 xmlRegCopyAtom(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom) { in xmlRegCopyAtom() argument
844 xmlRegexpErrMemory(ctxt, "copying atom"); in xmlRegCopyAtom()
858 xmlRegexpErrMemory(ctxt, "copying atom"); in xmlRegCopyAtom()
862 ret->ranges[i] = xmlRegCopyRange(ctxt, atom->ranges[i]); in xmlRegCopyAtom()
876 xmlRegNewState(xmlRegParserCtxtPtr ctxt) { in xmlRegNewState() argument
881 xmlRegexpErrMemory(ctxt, "allocating state"); in xmlRegNewState()
915 xmlRegFreeParserCtxt(xmlRegParserCtxtPtr ctxt) { in xmlRegFreeParserCtxt() argument
917 if (ctxt == NULL) in xmlRegFreeParserCtxt()
920 if (ctxt->string != NULL) in xmlRegFreeParserCtxt()
921 xmlFree(ctxt->string); in xmlRegFreeParserCtxt()
922 if (ctxt->states != NULL) { in xmlRegFreeParserCtxt()
923 for (i = 0;i < ctxt->nbStates;i++) in xmlRegFreeParserCtxt()
924 xmlRegFreeState(ctxt->states[i]); in xmlRegFreeParserCtxt()
925 xmlFree(ctxt->states); in xmlRegFreeParserCtxt()
927 if (ctxt->atoms != NULL) { in xmlRegFreeParserCtxt()
928 for (i = 0;i < ctxt->nbAtoms;i++) in xmlRegFreeParserCtxt()
929 xmlRegFreeAtom(ctxt->atoms[i]); in xmlRegFreeParserCtxt()
930 xmlFree(ctxt->atoms); in xmlRegFreeParserCtxt()
932 if (ctxt->counters != NULL) in xmlRegFreeParserCtxt()
933 xmlFree(ctxt->counters); in xmlRegFreeParserCtxt()
934 xmlFree(ctxt); in xmlRegFreeParserCtxt()
1170 xmlRegPrintCtxt(FILE *output, xmlRegParserCtxtPtr ctxt) { in xmlRegPrintCtxt() argument
1174 if (ctxt == NULL) { in xmlRegPrintCtxt()
1178 fprintf(output, "'%s' ", ctxt->string); in xmlRegPrintCtxt()
1179 if (ctxt->error) in xmlRegPrintCtxt()
1181 if (ctxt->neg) in xmlRegPrintCtxt()
1184 fprintf(output, "%d atoms:\n", ctxt->nbAtoms); in xmlRegPrintCtxt()
1185 for (i = 0;i < ctxt->nbAtoms; i++) { in xmlRegPrintCtxt()
1187 xmlRegPrintAtom(output, ctxt->atoms[i]); in xmlRegPrintCtxt()
1189 if (ctxt->atom != NULL) { in xmlRegPrintCtxt()
1191 xmlRegPrintAtom(output, ctxt->atom); in xmlRegPrintCtxt()
1193 fprintf(output, "%d states:", ctxt->nbStates); in xmlRegPrintCtxt()
1194 if (ctxt->start != NULL) in xmlRegPrintCtxt()
1195 fprintf(output, " start: %d", ctxt->start->no); in xmlRegPrintCtxt()
1196 if (ctxt->end != NULL) in xmlRegPrintCtxt()
1197 fprintf(output, " end: %d", ctxt->end->no); in xmlRegPrintCtxt()
1199 for (i = 0;i < ctxt->nbStates; i++) { in xmlRegPrintCtxt()
1200 xmlRegPrintState(output, ctxt->states[i]); in xmlRegPrintCtxt()
1202 fprintf(output, "%d counters:\n", ctxt->nbCounters); in xmlRegPrintCtxt()
1203 for (i = 0;i < ctxt->nbCounters; i++) { in xmlRegPrintCtxt()
1204 fprintf(output, " %d: min %d max %d\n", i, ctxt->counters[i].min, in xmlRegPrintCtxt()
1205 ctxt->counters[i].max); in xmlRegPrintCtxt()
1217 xmlRegAtomAddRange(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom, in xmlRegAtomAddRange() argument
1235 xmlRegexpErrMemory(ctxt, "adding ranges"); in xmlRegAtomAddRange()
1245 xmlRegexpErrMemory(ctxt, "adding ranges"); in xmlRegAtomAddRange()
1251 range = xmlRegNewRange(ctxt, neg, type, start, end); in xmlRegAtomAddRange()
1260 xmlRegGetCounter(xmlRegParserCtxtPtr ctxt) { in xmlRegGetCounter() argument
1261 if (ctxt->maxCounters == 0) { in xmlRegGetCounter()
1262 ctxt->maxCounters = 4; in xmlRegGetCounter()
1263 ctxt->counters = (xmlRegCounter *) xmlMalloc(ctxt->maxCounters * in xmlRegGetCounter()
1265 if (ctxt->counters == NULL) { in xmlRegGetCounter()
1266 xmlRegexpErrMemory(ctxt, "allocating counter"); in xmlRegGetCounter()
1267 ctxt->maxCounters = 0; in xmlRegGetCounter()
1270 } else if (ctxt->nbCounters >= ctxt->maxCounters) { in xmlRegGetCounter()
1272 ctxt->maxCounters *= 2; in xmlRegGetCounter()
1273 tmp = (xmlRegCounter *) xmlRealloc(ctxt->counters, ctxt->maxCounters * in xmlRegGetCounter()
1276 xmlRegexpErrMemory(ctxt, "allocating counter"); in xmlRegGetCounter()
1277 ctxt->maxCounters /= 2; in xmlRegGetCounter()
1280 ctxt->counters = tmp; in xmlRegGetCounter()
1282 ctxt->counters[ctxt->nbCounters].min = -1; in xmlRegGetCounter()
1283 ctxt->counters[ctxt->nbCounters].max = -1; in xmlRegGetCounter()
1284 return(ctxt->nbCounters++); in xmlRegGetCounter()
1288 xmlRegAtomPush(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom) { in xmlRegAtomPush() argument
1293 if (ctxt->maxAtoms == 0) { in xmlRegAtomPush()
1294 ctxt->maxAtoms = 4; in xmlRegAtomPush()
1295 ctxt->atoms = (xmlRegAtomPtr *) xmlMalloc(ctxt->maxAtoms * in xmlRegAtomPush()
1297 if (ctxt->atoms == NULL) { in xmlRegAtomPush()
1298 xmlRegexpErrMemory(ctxt, "pushing atom"); in xmlRegAtomPush()
1299 ctxt->maxAtoms = 0; in xmlRegAtomPush()
1302 } else if (ctxt->nbAtoms >= ctxt->maxAtoms) { in xmlRegAtomPush()
1304 ctxt->maxAtoms *= 2; in xmlRegAtomPush()
1305 tmp = (xmlRegAtomPtr *) xmlRealloc(ctxt->atoms, ctxt->maxAtoms * in xmlRegAtomPush()
1308 xmlRegexpErrMemory(ctxt, "allocating counter"); in xmlRegAtomPush()
1309 ctxt->maxAtoms /= 2; in xmlRegAtomPush()
1312 ctxt->atoms = tmp; in xmlRegAtomPush()
1314 atom->no = ctxt->nbAtoms; in xmlRegAtomPush()
1315 ctxt->atoms[ctxt->nbAtoms++] = atom; in xmlRegAtomPush()
1320 xmlRegStateAddTransTo(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr target, in xmlRegStateAddTransTo() argument
1327 xmlRegexpErrMemory(ctxt, "adding transition"); in xmlRegStateAddTransTo()
1337 xmlRegexpErrMemory(ctxt, "adding transition"); in xmlRegStateAddTransTo()
1348 xmlRegStateAddTrans(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state, in xmlRegStateAddTrans() argument
1387 xmlRegexpErrMemory(ctxt, "adding transition"); in xmlRegStateAddTrans()
1397 xmlRegexpErrMemory(ctxt, "adding transition"); in xmlRegStateAddTrans()
1423 xmlRegStateAddTransTo(ctxt, target, state->no); in xmlRegStateAddTrans()
1427 xmlRegStatePush(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state) { in xmlRegStatePush() argument
1429 if (ctxt->maxStates == 0) { in xmlRegStatePush()
1430 ctxt->maxStates = 4; in xmlRegStatePush()
1431 ctxt->states = (xmlRegStatePtr *) xmlMalloc(ctxt->maxStates * in xmlRegStatePush()
1433 if (ctxt->states == NULL) { in xmlRegStatePush()
1434 xmlRegexpErrMemory(ctxt, "adding state"); in xmlRegStatePush()
1435 ctxt->maxStates = 0; in xmlRegStatePush()
1438 } else if (ctxt->nbStates >= ctxt->maxStates) { in xmlRegStatePush()
1440 ctxt->maxStates *= 2; in xmlRegStatePush()
1441 tmp = (xmlRegStatePtr *) xmlRealloc(ctxt->states, ctxt->maxStates * in xmlRegStatePush()
1444 xmlRegexpErrMemory(ctxt, "adding state"); in xmlRegStatePush()
1445 ctxt->maxStates /= 2; in xmlRegStatePush()
1448 ctxt->states = tmp; in xmlRegStatePush()
1450 state->no = ctxt->nbStates; in xmlRegStatePush()
1451 ctxt->states[ctxt->nbStates++] = state; in xmlRegStatePush()
1464 xmlFAGenerateAllTransition(xmlRegParserCtxtPtr ctxt, in xmlFAGenerateAllTransition() argument
1468 to = xmlRegNewState(ctxt); in xmlFAGenerateAllTransition()
1469 xmlRegStatePush(ctxt, to); in xmlFAGenerateAllTransition()
1470 ctxt->state = to; in xmlFAGenerateAllTransition()
1473 xmlRegStateAddTrans(ctxt, from, NULL, to, -1, REGEXP_ALL_LAX_COUNTER); in xmlFAGenerateAllTransition()
1475 xmlRegStateAddTrans(ctxt, from, NULL, to, -1, REGEXP_ALL_COUNTER); in xmlFAGenerateAllTransition()
1486 xmlFAGenerateEpsilonTransition(xmlRegParserCtxtPtr ctxt, in xmlFAGenerateEpsilonTransition() argument
1489 to = xmlRegNewState(ctxt); in xmlFAGenerateEpsilonTransition()
1490 xmlRegStatePush(ctxt, to); in xmlFAGenerateEpsilonTransition()
1491 ctxt->state = to; in xmlFAGenerateEpsilonTransition()
1493 xmlRegStateAddTrans(ctxt, from, NULL, to, -1, -1); in xmlFAGenerateEpsilonTransition()
1505 xmlFAGenerateCountedEpsilonTransition(xmlRegParserCtxtPtr ctxt, in xmlFAGenerateCountedEpsilonTransition() argument
1508 to = xmlRegNewState(ctxt); in xmlFAGenerateCountedEpsilonTransition()
1509 xmlRegStatePush(ctxt, to); in xmlFAGenerateCountedEpsilonTransition()
1510 ctxt->state = to; in xmlFAGenerateCountedEpsilonTransition()
1512 xmlRegStateAddTrans(ctxt, from, NULL, to, counter, -1); in xmlFAGenerateCountedEpsilonTransition()
1524 xmlFAGenerateCountedTransition(xmlRegParserCtxtPtr ctxt, in xmlFAGenerateCountedTransition() argument
1527 to = xmlRegNewState(ctxt); in xmlFAGenerateCountedTransition()
1528 xmlRegStatePush(ctxt, to); in xmlFAGenerateCountedTransition()
1529 ctxt->state = to; in xmlFAGenerateCountedTransition()
1531 xmlRegStateAddTrans(ctxt, from, NULL, to, -1, counter); in xmlFAGenerateCountedTransition()
1544 xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from, in xmlFAGenerateTransitions() argument
1557 if (xmlRegAtomPush(ctxt, atom) < 0) { in xmlFAGenerateTransitions()
1565 xmlFAGenerateEpsilonTransition(ctxt, atom->stop, to); in xmlFAGenerateTransitions()
1569 to = xmlRegNewState(ctxt); in xmlFAGenerateTransitions()
1570 xmlRegStatePush(ctxt, to); in xmlFAGenerateTransitions()
1571 ctxt->state = to; in xmlFAGenerateTransitions()
1572 xmlFAGenerateEpsilonTransition(ctxt, atom->stop, to); in xmlFAGenerateTransitions()
1584 xmlFAGenerateEpsilonTransition(ctxt, atom->start, 0); in xmlFAGenerateTransitions()
1585 xmlFAGenerateEpsilonTransition(ctxt, atom->stop, in xmlFAGenerateTransitions()
1586 ctxt->state); in xmlFAGenerateTransitions()
1588 xmlFAGenerateEpsilonTransition(ctxt, atom->start, to); in xmlFAGenerateTransitions()
1593 xmlFAGenerateEpsilonTransition(ctxt, atom->start, atom->stop); in xmlFAGenerateTransitions()
1594 xmlFAGenerateEpsilonTransition(ctxt, atom->stop, atom->start); in xmlFAGenerateTransitions()
1598 xmlFAGenerateEpsilonTransition(ctxt, atom->stop, atom->start); in xmlFAGenerateTransitions()
1610 newstate = xmlRegNewState(ctxt); in xmlFAGenerateTransitions()
1611 xmlRegStatePush(ctxt, newstate); in xmlFAGenerateTransitions()
1631 copy = xmlRegCopyAtom(ctxt, atom); in xmlFAGenerateTransitions()
1638 if (xmlFAGenerateTransitions(ctxt, atom->start, NULL, copy) in xmlFAGenerateTransitions()
1641 inter = ctxt->state; in xmlFAGenerateTransitions()
1642 counter = xmlRegGetCounter(ctxt); in xmlFAGenerateTransitions()
1643 ctxt->counters[counter].min = atom->min - 1; in xmlFAGenerateTransitions()
1644 ctxt->counters[counter].max = atom->max - 1; in xmlFAGenerateTransitions()
1646 xmlFAGenerateCountedEpsilonTransition(ctxt, inter, in xmlFAGenerateTransitions()
1649 xmlFAGenerateCountedTransition(ctxt, inter, in xmlFAGenerateTransitions()
1652 xmlFAGenerateEpsilonTransition(ctxt, atom->start, in xmlFAGenerateTransitions()
1660 counter = xmlRegGetCounter(ctxt); in xmlFAGenerateTransitions()
1661 ctxt->counters[counter].min = atom->min - 1; in xmlFAGenerateTransitions()
1662 ctxt->counters[counter].max = atom->max - 1; in xmlFAGenerateTransitions()
1664 xmlFAGenerateCountedEpsilonTransition(ctxt, atom->stop, in xmlFAGenerateTransitions()
1667 xmlFAGenerateCountedTransition(ctxt, atom->stop, in xmlFAGenerateTransitions()
1671 xmlFAGenerateEpsilonTransition(ctxt, atom->start0, in xmlFAGenerateTransitions()
1678 ctxt->state = newstate; in xmlFAGenerateTransitions()
1691 to = xmlRegNewState(ctxt); in xmlFAGenerateTransitions()
1693 xmlRegStatePush(ctxt, to); in xmlFAGenerateTransitions()
1698 xmlFAGenerateEpsilonTransition(ctxt, from, to); in xmlFAGenerateTransitions()
1699 ctxt->state = to; in xmlFAGenerateTransitions()
1704 to = xmlRegNewState(ctxt); in xmlFAGenerateTransitions()
1706 xmlRegStatePush(ctxt, to); in xmlFAGenerateTransitions()
1721 tmp = xmlRegNewState(ctxt); in xmlFAGenerateTransitions()
1723 xmlRegStatePush(ctxt, tmp); in xmlFAGenerateTransitions()
1727 xmlFAGenerateEpsilonTransition(ctxt, tmp, to); in xmlFAGenerateTransitions()
1730 if (xmlRegAtomPush(ctxt, atom) < 0) { in xmlFAGenerateTransitions()
1733 xmlRegStateAddTrans(ctxt, from, atom, to, -1, -1); in xmlFAGenerateTransitions()
1734 ctxt->state = end; in xmlFAGenerateTransitions()
1738 xmlFAGenerateEpsilonTransition(ctxt, from, to); in xmlFAGenerateTransitions()
1742 xmlFAGenerateEpsilonTransition(ctxt, from, to); in xmlFAGenerateTransitions()
1743 xmlRegStateAddTrans(ctxt, to, atom, to, -1, -1); in xmlFAGenerateTransitions()
1747 xmlRegStateAddTrans(ctxt, to, atom, to, -1, -1); in xmlFAGenerateTransitions()
1752 xmlFAGenerateEpsilonTransition(ctxt, from, to); in xmlFAGenerateTransitions()
1771 xmlFAReduceEpsilonTransitions(xmlRegParserCtxtPtr ctxt, int fromnr, in xmlFAReduceEpsilonTransitions() argument
1780 from = ctxt->states[fromnr]; in xmlFAReduceEpsilonTransitions()
1783 to = ctxt->states[tonr]; in xmlFAReduceEpsilonTransitions()
1809 xmlRegStateAddTrans(ctxt, from, NULL, in xmlFAReduceEpsilonTransitions()
1810 ctxt->states[newto], in xmlFAReduceEpsilonTransitions()
1818 xmlFAReduceEpsilonTransitions(ctxt, fromnr, in xmlFAReduceEpsilonTransitions()
1822 xmlFAReduceEpsilonTransitions(ctxt, fromnr, in xmlFAReduceEpsilonTransitions()
1832 xmlRegStateAddTrans(ctxt, from, to->trans[transnr].atom, in xmlFAReduceEpsilonTransitions()
1833 ctxt->states[newto], in xmlFAReduceEpsilonTransitions()
1836 xmlRegStateAddTrans(ctxt, from, to->trans[transnr].atom, in xmlFAReduceEpsilonTransitions()
1837 ctxt->states[newto], counter, -1); in xmlFAReduceEpsilonTransitions()
1860 xmlFAEliminateSimpleEpsilonTransitions(xmlRegParserCtxtPtr ctxt) { in xmlFAEliminateSimpleEpsilonTransitions() argument
1864 for (statenr = 0;statenr < ctxt->nbStates;statenr++) { in xmlFAEliminateSimpleEpsilonTransitions()
1865 state = ctxt->states[statenr]; in xmlFAEliminateSimpleEpsilonTransitions()
1891 tmp = ctxt->states[state->transTo[i]]; in xmlFAEliminateSimpleEpsilonTransitions()
1899 xmlRegStateAddTrans(ctxt, tmp, tmp->trans[j].atom, in xmlFAEliminateSimpleEpsilonTransitions()
1900 ctxt->states[newto], in xmlFAEliminateSimpleEpsilonTransitions()
1907 ctxt->states[newto]->type = XML_REGEXP_FINAL_STATE; in xmlFAEliminateSimpleEpsilonTransitions()
1924 xmlFAEliminateEpsilonTransitions(xmlRegParserCtxtPtr ctxt) { in xmlFAEliminateEpsilonTransitions() argument
1929 if (ctxt->states == NULL) return; in xmlFAEliminateEpsilonTransitions()
1935 xmlFAEliminateSimpleEpsilonTransitions(ctxt); in xmlFAEliminateEpsilonTransitions()
1936 for (statenr = 0;statenr < ctxt->nbStates;statenr++) { in xmlFAEliminateEpsilonTransitions()
1937 state = ctxt->states[statenr]; in xmlFAEliminateEpsilonTransitions()
1943 ctxt->states[statenr] = NULL; in xmlFAEliminateEpsilonTransitions()
1957 for (statenr = ctxt->nbStates - 1;statenr >= 0;statenr--) { in xmlFAEliminateEpsilonTransitions()
1958 state = ctxt->states[statenr]; in xmlFAEliminateEpsilonTransitions()
1984 xmlFAReduceEpsilonTransitions(ctxt, statenr, in xmlFAEliminateEpsilonTransitions()
2000 for (statenr = 0;statenr < ctxt->nbStates;statenr++) { in xmlFAEliminateEpsilonTransitions()
2001 state = ctxt->states[statenr]; in xmlFAEliminateEpsilonTransitions()
2018 for (statenr = 0;statenr < ctxt->nbStates;statenr++) { in xmlFAEliminateEpsilonTransitions()
2019 state = ctxt->states[statenr]; in xmlFAEliminateEpsilonTransitions()
2023 state = ctxt->states[0]; in xmlFAEliminateEpsilonTransitions()
2038 if (ctxt->states[newto] == NULL) in xmlFAEliminateEpsilonTransitions()
2040 if (ctxt->states[newto]->reached == XML_REGEXP_MARK_NORMAL) { in xmlFAEliminateEpsilonTransitions()
2041 ctxt->states[newto]->reached = XML_REGEXP_MARK_START; in xmlFAEliminateEpsilonTransitions()
2042 target = ctxt->states[newto]; in xmlFAEliminateEpsilonTransitions()
2051 for (statenr = 1;statenr < ctxt->nbStates;statenr++) { in xmlFAEliminateEpsilonTransitions()
2052 state = ctxt->states[statenr]; in xmlFAEliminateEpsilonTransitions()
2062 for (statenr = 0;statenr < ctxt->nbStates;statenr++) { in xmlFAEliminateEpsilonTransitions()
2063 state = ctxt->states[statenr]; in xmlFAEliminateEpsilonTransitions()
2069 ctxt->states[statenr] = NULL; in xmlFAEliminateEpsilonTransitions()
2583 xmlFARecurseDeterminism(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state, in xmlFARecurseDeterminism() argument
2596 if (ctxt->flags & AM_AUTOMATA_RNG) in xmlFARecurseDeterminism()
2613 res = xmlFARecurseDeterminism(ctxt, ctxt->states[t1->to], in xmlFARecurseDeterminism()
2642 xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt) { in xmlFAComputesDeterminism() argument
2652 xmlRegPrintCtxt(stdout, ctxt); in xmlFAComputesDeterminism()
2654 if (ctxt->determinist != -1) in xmlFAComputesDeterminism()
2655 return(ctxt->determinist); in xmlFAComputesDeterminism()
2657 if (ctxt->flags & AM_AUTOMATA_RNG) in xmlFAComputesDeterminism()
2663 for (statenr = 0;statenr < ctxt->nbStates;statenr++) { in xmlFAComputesDeterminism()
2664 state = ctxt->states[statenr]; in xmlFAComputesDeterminism()
2705 for (statenr = 0;statenr < ctxt->nbStates;statenr++) { in xmlFAComputesDeterminism()
2706 state = ctxt->states[statenr]; in xmlFAComputesDeterminism()
2744 ret = xmlFARecurseDeterminism(ctxt, ctxt->states[t1->to], in xmlFAComputesDeterminism()
2779 ctxt->determinist = ret; in xmlFAComputesDeterminism()
4591 xmlFAIsChar(xmlRegParserCtxtPtr ctxt) { in xmlFAIsChar() argument
4595 cur = CUR_SCHAR(ctxt->cur, len); in xmlFAIsChar()
4621 xmlFAParseCharProp(xmlRegParserCtxtPtr ctxt) { in xmlFAParseCharProp() argument
4795 start = ctxt->cur; in xmlFAParseCharProp()
4812 blockName = xmlStrndup(start, ctxt->cur - start); in xmlFAParseCharProp()
4817 if (ctxt->atom == NULL) { in xmlFAParseCharProp()
4818 ctxt->atom = xmlRegNewAtom(ctxt, type); in xmlFAParseCharProp()
4819 if (ctxt->atom != NULL) in xmlFAParseCharProp()
4820 ctxt->atom->valuep = blockName; in xmlFAParseCharProp()
4821 } else if (ctxt->atom->type == XML_REGEXP_RANGES) { in xmlFAParseCharProp()
4822 xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg, in xmlFAParseCharProp()
4838 xmlFAParseCharClassEsc(xmlRegParserCtxtPtr ctxt) { in xmlFAParseCharClassEsc() argument
4842 if (ctxt->atom == NULL) { in xmlFAParseCharClassEsc()
4843 ctxt->atom = xmlRegNewAtom(ctxt, XML_REGEXP_ANYCHAR); in xmlFAParseCharClassEsc()
4844 } else if (ctxt->atom->type == XML_REGEXP_RANGES) { in xmlFAParseCharClassEsc()
4845 xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg, in xmlFAParseCharClassEsc()
4864 xmlFAParseCharProp(ctxt); in xmlFAParseCharClassEsc()
4877 xmlFAParseCharProp(ctxt); in xmlFAParseCharClassEsc()
4878 ctxt->atom->neg = 1; in xmlFAParseCharClassEsc()
4889 if (ctxt->atom == NULL) { in xmlFAParseCharClassEsc()
4890 ctxt->atom = xmlRegNewAtom(ctxt, XML_REGEXP_CHARVAL); in xmlFAParseCharClassEsc()
4891 if (ctxt->atom != NULL) { in xmlFAParseCharClassEsc()
4894 ctxt->atom->codepoint = '\n'; in xmlFAParseCharClassEsc()
4897 ctxt->atom->codepoint = '\r'; in xmlFAParseCharClassEsc()
4900 ctxt->atom->codepoint = '\t'; in xmlFAParseCharClassEsc()
4903 ctxt->atom->codepoint = cur; in xmlFAParseCharClassEsc()
4906 } else if (ctxt->atom->type == XML_REGEXP_RANGES) { in xmlFAParseCharClassEsc()
4918 xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg, in xmlFAParseCharClassEsc()
4960 if (ctxt->atom == NULL) { in xmlFAParseCharClassEsc()
4961 ctxt->atom = xmlRegNewAtom(ctxt, type); in xmlFAParseCharClassEsc()
4962 } else if (ctxt->atom->type == XML_REGEXP_RANGES) { in xmlFAParseCharClassEsc()
4963 xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg, in xmlFAParseCharClassEsc()
4982 xmlFAParseCharRange(xmlRegParserCtxtPtr ctxt) { in xmlFAParseCharRange() argument
5011 end = start = CUR_SCHAR(ctxt->cur, len); in xmlFAParseCharRange()
5027 xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg, in xmlFAParseCharRange()
5050 end = CUR_SCHAR(ctxt->cur, len); in xmlFAParseCharRange()
5060 xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg, in xmlFAParseCharRange()
5073 xmlFAParsePosCharGroup(xmlRegParserCtxtPtr ctxt) { in xmlFAParsePosCharGroup() argument
5076 xmlFAParseCharClassEsc(ctxt); in xmlFAParsePosCharGroup()
5078 xmlFAParseCharRange(ctxt); in xmlFAParsePosCharGroup()
5081 (CUR != 0) && (ctxt->error == 0)); in xmlFAParsePosCharGroup()
5094 xmlFAParseCharGroup(xmlRegParserCtxtPtr ctxt) { in xmlFAParseCharGroup() argument
5095 int n = ctxt->neg; in xmlFAParseCharGroup()
5096 while ((CUR != ']') && (ctxt->error == 0)) { in xmlFAParseCharGroup()
5098 int neg = ctxt->neg; in xmlFAParseCharGroup()
5101 ctxt->neg = !ctxt->neg; in xmlFAParseCharGroup()
5102 xmlFAParsePosCharGroup(ctxt); in xmlFAParseCharGroup()
5103 ctxt->neg = neg; in xmlFAParseCharGroup()
5105 int neg = ctxt->neg; in xmlFAParseCharGroup()
5106 ctxt->neg = 2; in xmlFAParseCharGroup()
5109 xmlFAParseCharGroup(ctxt); in xmlFAParseCharGroup()
5116 ctxt->neg = neg; in xmlFAParseCharGroup()
5119 xmlFAParsePosCharGroup(ctxt); in xmlFAParseCharGroup()
5122 ctxt->neg = n; in xmlFAParseCharGroup()
5133 xmlFAParseCharClass(xmlRegParserCtxtPtr ctxt) { in xmlFAParseCharClass() argument
5136 ctxt->atom = xmlRegNewAtom(ctxt, XML_REGEXP_RANGES); in xmlFAParseCharClass()
5137 if (ctxt->atom == NULL) in xmlFAParseCharClass()
5139 xmlFAParseCharGroup(ctxt); in xmlFAParseCharClass()
5146 xmlFAParseCharClassEsc(ctxt); in xmlFAParseCharClass()
5159 xmlFAParseQuantExact(xmlRegParserCtxtPtr ctxt) { in xmlFAParseQuantExact() argument
5185 xmlFAParseQuantifier(xmlRegParserCtxtPtr ctxt) { in xmlFAParseQuantifier() argument
5190 if (ctxt->atom != NULL) { in xmlFAParseQuantifier()
5192 ctxt->atom->quant = XML_REGEXP_QUANT_OPT; in xmlFAParseQuantifier()
5194 ctxt->atom->quant = XML_REGEXP_QUANT_MULT; in xmlFAParseQuantifier()
5196 ctxt->atom->quant = XML_REGEXP_QUANT_PLUS; in xmlFAParseQuantifier()
5205 cur = xmlFAParseQuantExact(ctxt); in xmlFAParseQuantifier()
5213 cur = xmlFAParseQuantExact(ctxt); in xmlFAParseQuantifier()
5228 if (ctxt->atom != NULL) { in xmlFAParseQuantifier()
5229 ctxt->atom->quant = XML_REGEXP_QUANT_RANGE; in xmlFAParseQuantifier()
5230 ctxt->atom->min = min; in xmlFAParseQuantifier()
5231 ctxt->atom->max = max; in xmlFAParseQuantifier()
5245 xmlFAParseAtom(xmlRegParserCtxtPtr ctxt) { in xmlFAParseAtom() argument
5248 codepoint = xmlFAIsChar(ctxt); in xmlFAParseAtom()
5250 ctxt->atom = xmlRegNewAtom(ctxt, XML_REGEXP_CHARVAL); in xmlFAParseAtom()
5251 if (ctxt->atom == NULL) in xmlFAParseAtom()
5253 codepoint = CUR_SCHAR(ctxt->cur, len); in xmlFAParseAtom()
5254 ctxt->atom->codepoint = codepoint; in xmlFAParseAtom()
5271 xmlFAGenerateEpsilonTransition(ctxt, ctxt->state, NULL); in xmlFAParseAtom()
5272 start0 = ctxt->state; in xmlFAParseAtom()
5273 xmlFAGenerateEpsilonTransition(ctxt, ctxt->state, NULL); in xmlFAParseAtom()
5274 start = ctxt->state; in xmlFAParseAtom()
5275 oldend = ctxt->end; in xmlFAParseAtom()
5276 ctxt->end = NULL; in xmlFAParseAtom()
5277 ctxt->atom = NULL; in xmlFAParseAtom()
5278 xmlFAParseRegExp(ctxt, 0); in xmlFAParseAtom()
5284 ctxt->atom = xmlRegNewAtom(ctxt, XML_REGEXP_SUBREG); in xmlFAParseAtom()
5285 if (ctxt->atom == NULL) in xmlFAParseAtom()
5287 ctxt->atom->start = start; in xmlFAParseAtom()
5288 ctxt->atom->start0 = start0; in xmlFAParseAtom()
5289 ctxt->atom->stop = ctxt->state; in xmlFAParseAtom()
5290 ctxt->end = oldend; in xmlFAParseAtom()
5293 xmlFAParseCharClass(ctxt); in xmlFAParseAtom()
5306 xmlFAParsePiece(xmlRegParserCtxtPtr ctxt) { in xmlFAParsePiece() argument
5309 ctxt->atom = NULL; in xmlFAParsePiece()
5310 ret = xmlFAParseAtom(ctxt); in xmlFAParsePiece()
5313 if (ctxt->atom == NULL) { in xmlFAParsePiece()
5316 xmlFAParseQuantifier(ctxt); in xmlFAParsePiece()
5331 xmlFAParseBranch(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr to) { in xmlFAParseBranch() argument
5335 previous = ctxt->state; in xmlFAParseBranch()
5336 ret = xmlFAParsePiece(ctxt); in xmlFAParseBranch()
5338 if (xmlFAGenerateTransitions(ctxt, previous, in xmlFAParseBranch()
5339 (CUR=='|' || CUR==')') ? to : NULL, ctxt->atom) < 0) in xmlFAParseBranch()
5341 previous = ctxt->state; in xmlFAParseBranch()
5342 ctxt->atom = NULL; in xmlFAParseBranch()
5344 while ((ret != 0) && (ctxt->error == 0)) { in xmlFAParseBranch()
5345 ret = xmlFAParsePiece(ctxt); in xmlFAParseBranch()
5347 if (xmlFAGenerateTransitions(ctxt, previous, in xmlFAParseBranch()
5348 (CUR=='|' || CUR==')') ? to : NULL, ctxt->atom) < 0) in xmlFAParseBranch()
5350 previous = ctxt->state; in xmlFAParseBranch()
5351 ctxt->atom = NULL; in xmlFAParseBranch()
5365 xmlFAParseRegExp(xmlRegParserCtxtPtr ctxt, int top) { in xmlFAParseRegExp() argument
5369 start = ctxt->state; in xmlFAParseRegExp()
5370 ctxt->end = NULL; in xmlFAParseRegExp()
5371 xmlFAParseBranch(ctxt, NULL); in xmlFAParseRegExp()
5374 printf("State %d is final\n", ctxt->state->no); in xmlFAParseRegExp()
5376 ctxt->state->type = XML_REGEXP_FINAL_STATE; in xmlFAParseRegExp()
5379 ctxt->end = ctxt->state; in xmlFAParseRegExp()
5382 end = ctxt->state; in xmlFAParseRegExp()
5383 while ((CUR == '|') && (ctxt->error == 0)) { in xmlFAParseRegExp()
5389 ctxt->state = start; in xmlFAParseRegExp()
5390 ctxt->end = NULL; in xmlFAParseRegExp()
5391 xmlFAParseBranch(ctxt, end); in xmlFAParseRegExp()
5394 ctxt->state = end; in xmlFAParseRegExp()
5395 ctxt->end = end; in xmlFAParseRegExp()
5455 xmlRegParserCtxtPtr ctxt; in xmlRegexpCompile() local
5457 ctxt = xmlRegNewParserCtxt(regexp); in xmlRegexpCompile()
5458 if (ctxt == NULL) in xmlRegexpCompile()
5462 ctxt->end = NULL; in xmlRegexpCompile()
5463 ctxt->start = ctxt->state = xmlRegNewState(ctxt); in xmlRegexpCompile()
5464 xmlRegStatePush(ctxt, ctxt->start); in xmlRegexpCompile()
5467 xmlFAParseRegExp(ctxt, 1); in xmlRegexpCompile()
5471 if (ctxt->error != 0) { in xmlRegexpCompile()
5472 xmlRegFreeParserCtxt(ctxt); in xmlRegexpCompile()
5475 ctxt->end = ctxt->state; in xmlRegexpCompile()
5476 ctxt->start->type = XML_REGEXP_START_STATE; in xmlRegexpCompile()
5477 ctxt->end->type = XML_REGEXP_FINAL_STATE; in xmlRegexpCompile()
5480 xmlFAEliminateEpsilonTransitions(ctxt); in xmlRegexpCompile()
5483 if (ctxt->error != 0) { in xmlRegexpCompile()
5484 xmlRegFreeParserCtxt(ctxt); in xmlRegexpCompile()
5487 ret = xmlRegEpxFromParse(ctxt); in xmlRegexpCompile()
5488 xmlRegFreeParserCtxt(ctxt); in xmlRegexpCompile()
5603 xmlAutomataPtr ctxt; in xmlNewAutomata() local
5605 ctxt = xmlRegNewParserCtxt(NULL); in xmlNewAutomata()
5606 if (ctxt == NULL) in xmlNewAutomata()
5610 ctxt->end = NULL; in xmlNewAutomata()
5611 ctxt->start = ctxt->state = xmlRegNewState(ctxt); in xmlNewAutomata()
5612 if (ctxt->start == NULL) { in xmlNewAutomata()
5613 xmlFreeAutomata(ctxt); in xmlNewAutomata()
5616 ctxt->start->type = XML_REGEXP_START_STATE; in xmlNewAutomata()
5617 if (xmlRegStatePush(ctxt, ctxt->start) < 0) { in xmlNewAutomata()
5618 xmlRegFreeState(ctxt->start); in xmlNewAutomata()
5619 xmlFreeAutomata(ctxt); in xmlNewAutomata()
5622 ctxt->flags = 0; in xmlNewAutomata()
5624 return(ctxt); in xmlNewAutomata()
6396 xmlExpFreeCtxt(xmlExpCtxtPtr ctxt) { in xmlExpFreeCtxt() argument
6397 if (ctxt == NULL) in xmlExpFreeCtxt()
6399 xmlDictFree(ctxt->dict); in xmlExpFreeCtxt()
6400 if (ctxt->table != NULL) in xmlExpFreeCtxt()
6401 xmlFree(ctxt->table); in xmlExpFreeCtxt()
6402 xmlFree(ctxt); in xmlExpFreeCtxt()
6459 static xmlExpNodePtr xmlExpNewNode(xmlExpCtxtPtr ctxt, xmlExpNodeType type);
6529 xmlExpNewNode(xmlExpCtxtPtr ctxt, xmlExpNodeType type) { in xmlExpNewNode() argument
6532 if (ctxt->nb_nodes >= MAX_NODES) in xmlExpNewNode()
6540 ctxt->nb_nodes++; in xmlExpNewNode()
6541 ctxt->nb_cons++; in xmlExpNewNode()
6556 xmlExpHashGetEntry(xmlExpCtxtPtr ctxt, xmlExpNodeType type, in xmlExpHashGetEntry() argument
6563 if (ctxt == NULL) in xmlExpHashGetEntry()
6579 xmlExpFree(ctxt, left); in xmlExpHashGetEntry()
6584 xmlExpFree(ctxt, left); in xmlExpHashGetEntry()
6595 xmlExpFree(ctxt, left); in xmlExpHashGetEntry()
6599 xmlExpFree(ctxt, right); in xmlExpHashGetEntry()
6621 xmlExpFree(ctxt, left); in xmlExpHashGetEntry()
6638 tmp = xmlExpHashGetEntry(ctxt, XML_EXP_OR, left->exp_right, right, in xmlExpHashGetEntry()
6641 tmp = xmlExpHashGetEntry(ctxt, XML_EXP_OR, left->exp_left, tmp, in xmlExpHashGetEntry()
6644 xmlExpFree(ctxt, left); in xmlExpHashGetEntry()
6653 tmp = xmlExpHashGetEntry(ctxt, XML_EXP_OR, right->exp_right, in xmlExpHashGetEntry()
6656 tmp = xmlExpHashGetEntry(ctxt, XML_EXP_OR, right->exp_left, in xmlExpHashGetEntry()
6658 xmlExpFree(ctxt, right); in xmlExpHashGetEntry()
6666 tmp = xmlExpHashGetEntry(ctxt, XML_EXP_OR, left, in xmlExpHashGetEntry()
6669 tmp = xmlExpHashGetEntry(ctxt, XML_EXP_OR, right->exp_left, in xmlExpHashGetEntry()
6671 xmlExpFree(ctxt, right); in xmlExpHashGetEntry()
6685 xmlExpFree(ctxt, right); in xmlExpHashGetEntry()
6689 xmlExpFree(ctxt, left); in xmlExpHashGetEntry()
6703 key = kbase % ctxt->size; in xmlExpHashGetEntry()
6704 if (ctxt->table[key] != NULL) { in xmlExpHashGetEntry()
6705 for (insert = ctxt->table[key]; insert != NULL; in xmlExpHashGetEntry()
6732 entry = xmlExpNewNode(ctxt, type); in xmlExpHashGetEntry()
6773 if (ctxt->table[key] != NULL) in xmlExpHashGetEntry()
6774 entry->next = ctxt->table[key]; in xmlExpHashGetEntry()
6776 ctxt->table[key] = entry; in xmlExpHashGetEntry()
6777 ctxt->nbElems++; in xmlExpHashGetEntry()
6790 xmlExpFree(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp) { in xmlExpFree() argument
6798 key = exp->key % ctxt->size; in xmlExpFree()
6799 if (ctxt->table[key] == exp) { in xmlExpFree()
6800 ctxt->table[key] = exp->next; in xmlExpFree()
6804 tmp = ctxt->table[key]; in xmlExpFree()
6815 xmlExpFree(ctxt, exp->exp_left); in xmlExpFree()
6816 xmlExpFree(ctxt, exp->exp_right); in xmlExpFree()
6818 xmlExpFree(ctxt, exp->exp_left); in xmlExpFree()
6821 ctxt->nb_nodes--; in xmlExpFree()
6848 xmlExpNewAtom(xmlExpCtxtPtr ctxt, const xmlChar *name, int len) { in xmlExpNewAtom() argument
6849 if ((ctxt == NULL) || (name == NULL)) in xmlExpNewAtom()
6851 name = xmlDictLookup(ctxt->dict, name, len); in xmlExpNewAtom()
6854 return(xmlExpHashGetEntry(ctxt, XML_EXP_ATOM, NULL, NULL, name, 0, 0)); in xmlExpNewAtom()
6871 xmlExpNewOr(xmlExpCtxtPtr ctxt, xmlExpNodePtr left, xmlExpNodePtr right) { in xmlExpNewOr() argument
6872 if (ctxt == NULL) in xmlExpNewOr()
6875 xmlExpFree(ctxt, left); in xmlExpNewOr()
6876 xmlExpFree(ctxt, right); in xmlExpNewOr()
6879 return(xmlExpHashGetEntry(ctxt, XML_EXP_OR, left, right, NULL, 0, 0)); in xmlExpNewOr()
6896 xmlExpNewSeq(xmlExpCtxtPtr ctxt, xmlExpNodePtr left, xmlExpNodePtr right) { in xmlExpNewSeq() argument
6897 if (ctxt == NULL) in xmlExpNewSeq()
6900 xmlExpFree(ctxt, left); in xmlExpNewSeq()
6901 xmlExpFree(ctxt, right); in xmlExpNewSeq()
6904 return(xmlExpHashGetEntry(ctxt, XML_EXP_SEQ, left, right, NULL, 0, 0)); in xmlExpNewSeq()
6922 xmlExpNewRange(xmlExpCtxtPtr ctxt, xmlExpNodePtr subset, int min, int max) { in xmlExpNewRange() argument
6923 if (ctxt == NULL) in xmlExpNewRange()
6927 xmlExpFree(ctxt, subset); in xmlExpNewRange()
6930 return(xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, subset, in xmlExpNewRange()
6941 xmlExpGetLanguageInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, in xmlExpGetLanguageInt() argument
6961 tmp = xmlExpGetLanguageInt(ctxt, exp->exp_left, list, len, nb); in xmlExpGetLanguageInt()
6964 tmp2 = xmlExpGetLanguageInt(ctxt, exp->exp_right, list, len, in xmlExpGetLanguageInt()
6986 xmlExpGetLanguage(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, in xmlExpGetLanguage() argument
6988 if ((ctxt == NULL) || (exp == NULL) || (langList == NULL) || (len <= 0)) in xmlExpGetLanguage()
6990 return(xmlExpGetLanguageInt(ctxt, exp, langList, len, 0)); in xmlExpGetLanguage()
6994 xmlExpGetStartInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, in xmlExpGetStartInt() argument
7015 tmp = xmlExpGetStartInt(ctxt, exp->exp_left, list, len, nb); in xmlExpGetStartInt()
7019 tmp2 = xmlExpGetStartInt(ctxt, exp->exp_right, list, len, in xmlExpGetStartInt()
7027 tmp = xmlExpGetStartInt(ctxt, exp->exp_left, list, len, nb); in xmlExpGetStartInt()
7030 tmp2 = xmlExpGetStartInt(ctxt, exp->exp_right, list, len, in xmlExpGetStartInt()
7054 xmlExpGetStart(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, in xmlExpGetStart() argument
7056 if ((ctxt == NULL) || (exp == NULL) || (tokList == NULL) || (len <= 0)) in xmlExpGetStart()
7058 return(xmlExpGetStartInt(ctxt, exp, tokList, len, 0)); in xmlExpGetStart()
7077 xmlExpStringDeriveInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, const xmlChar *str) in xmlExpStringDeriveInt() argument
7106 tmp = xmlExpStringDeriveInt(ctxt, exp->exp_left, str); in xmlExpStringDeriveInt()
7110 ret = xmlExpStringDeriveInt(ctxt, exp->exp_right, str); in xmlExpStringDeriveInt()
7112 xmlExpFree(ctxt, tmp); in xmlExpStringDeriveInt()
7115 ret = xmlExpHashGetEntry(ctxt, XML_EXP_OR, tmp, ret, in xmlExpStringDeriveInt()
7123 ret = xmlExpStringDeriveInt(ctxt, exp->exp_left, str); in xmlExpStringDeriveInt()
7131 ret = xmlExpStringDeriveInt(ctxt, exp->exp_right, str); in xmlExpStringDeriveInt()
7138 ret = xmlExpHashGetEntry(ctxt, XML_EXP_SEQ, ret, exp->exp_right, in xmlExpStringDeriveInt()
7148 ret = xmlExpStringDeriveInt(ctxt, exp->exp_left, str); in xmlExpStringDeriveInt()
7168 tmp = xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, exp->exp_left, NULL, in xmlExpStringDeriveInt()
7179 return(xmlExpHashGetEntry(ctxt, XML_EXP_SEQ, ret, tmp, in xmlExpStringDeriveInt()
7199 xmlExpStringDerive(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, in xmlExpStringDerive() argument
7203 if ((exp == NULL) || (ctxt == NULL) || (str == NULL)) { in xmlExpStringDerive()
7210 input = xmlDictExists(ctxt->dict, str, len); in xmlExpStringDerive()
7214 return(xmlExpStringDeriveInt(ctxt, exp, input)); in xmlExpStringDerive()
7234 static xmlExpNodePtr xmlExpExpDeriveInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp,
7252 xmlExpDivide(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub, in xmlExpDivide() argument
7264 tmp = xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, in xmlExpDivide()
7270 xmlExpFree(ctxt, tmp); in xmlExpDivide()
7273 tmp2 = xmlExpExpDeriveInt(ctxt, tmp, exp); in xmlExpDivide()
7275 xmlExpFree(ctxt, tmp); in xmlExpDivide()
7282 xmlExpFree(ctxt, tmp2); in xmlExpDivide()
7286 xmlExpFree(ctxt, tmp); in xmlExpDivide()
7292 xmlExpFree(ctxt, tmp); in xmlExpDivide()
7293 xmlExpFree(ctxt, tmp2); in xmlExpDivide()
7313 xmlExpExpDeriveInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) { in xmlExpExpDeriveInt() argument
7342 tmp = xmlExpExpDeriveInt(ctxt, exp, sub->exp_left); in xmlExpExpDeriveInt()
7347 ret = xmlExpExpDeriveInt(ctxt, tmp, sub->exp_right); in xmlExpExpDeriveInt()
7348 xmlExpFree(ctxt, tmp); in xmlExpExpDeriveInt()
7355 tmp = xmlExpExpDeriveInt(ctxt, exp, sub->exp_left); in xmlExpExpDeriveInt()
7360 ret = xmlExpExpDeriveInt(ctxt, exp, sub->exp_right); in xmlExpExpDeriveInt()
7362 xmlExpFree(ctxt, tmp); in xmlExpExpDeriveInt()
7365 return(xmlExpHashGetEntry(ctxt, XML_EXP_OR, tmp, ret, NULL, 0, 0)); in xmlExpExpDeriveInt()
7426 ret = xmlExpExpDeriveInt(ctxt, exp->exp_left, sub); in xmlExpExpDeriveInt()
7439 return(xmlExpHashGetEntry(ctxt, XML_EXP_SEQ, ret, in xmlExpExpDeriveInt()
7454 ret = xmlExpExpDeriveInt(ctxt, exp->exp_left, sub->exp_left); in xmlExpExpDeriveInt()
7470 tmp = xmlExpHashGetEntry(ctxt, XML_EXP_SEQ, ret, in xmlExpExpDeriveInt()
7476 tmp2 = xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, in xmlExpExpDeriveInt()
7479 xmlExpFree(ctxt, tmp); in xmlExpExpDeriveInt()
7482 ret = xmlExpExpDeriveInt(ctxt, tmp, tmp2); in xmlExpExpDeriveInt()
7483 xmlExpFree(ctxt, tmp); in xmlExpExpDeriveInt()
7484 xmlExpFree(ctxt, tmp2); in xmlExpExpDeriveInt()
7494 ret = xmlExpExpDeriveInt(ctxt, exp->exp_left, sub); in xmlExpExpDeriveInt()
7497 tmp = xmlExpExpDeriveInt(ctxt, exp->exp_right, sub); in xmlExpExpDeriveInt()
7499 xmlExpFree(ctxt, ret); in xmlExpExpDeriveInt()
7502 return(xmlExpHashGetEntry(ctxt, XML_EXP_OR, ret, tmp, NULL, 0, 0)); in xmlExpExpDeriveInt()
7510 tmp = xmlExpExpDeriveInt(ctxt, exp->exp_left, sub->exp_left); in xmlExpExpDeriveInt()
7519 mult = xmlExpDivide(ctxt, sub->exp_left, exp->exp_left, in xmlExpExpDeriveInt()
7538 xmlExpFree(ctxt, tmp); in xmlExpExpDeriveInt()
7558 xmlExpFree(ctxt, tmp); in xmlExpExpDeriveInt()
7576 xmlExpFree(ctxt, tmp); in xmlExpExpDeriveInt()
7597 xmlExpFree(ctxt, tmp); in xmlExpExpDeriveInt()
7620 xmlExpFree(ctxt, tmp); in xmlExpExpDeriveInt()
7634 tmp2 = xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, exp->exp_left, in xmlExpExpDeriveInt()
7639 ret = xmlExpHashGetEntry(ctxt, XML_EXP_SEQ, tmp, tmp2, in xmlExpExpDeriveInt()
7643 tmp = xmlExpExpDeriveInt(ctxt, exp->exp_left, sub); in xmlExpExpDeriveInt()
7665 tmp2 = xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, exp->exp_left, in xmlExpExpDeriveInt()
7669 ret = xmlExpHashGetEntry(ctxt, XML_EXP_SEQ, tmp, tmp2, in xmlExpExpDeriveInt()
7689 if (ctxt->tabSize == 0) in xmlExpExpDeriveInt()
7690 ctxt->tabSize = 40; in xmlExpExpDeriveInt()
7692 tab = (const xmlChar **) xmlMalloc(ctxt->tabSize * in xmlExpExpDeriveInt()
7701 len = xmlExpGetStartInt(ctxt, sub, tab, ctxt->tabSize, 0); in xmlExpExpDeriveInt()
7704 temp = (const xmlChar **) xmlRealloc((xmlChar **) tab, ctxt->tabSize * 2 * in xmlExpExpDeriveInt()
7711 ctxt->tabSize *= 2; in xmlExpExpDeriveInt()
7712 len = xmlExpGetStartInt(ctxt, sub, tab, ctxt->tabSize, 0); in xmlExpExpDeriveInt()
7715 tmp = xmlExpStringDeriveInt(ctxt, exp, tab[i]); in xmlExpExpDeriveInt()
7717 xmlExpFree(ctxt, ret); in xmlExpExpDeriveInt()
7721 tmp2 = xmlExpStringDeriveInt(ctxt, sub, tab[i]); in xmlExpExpDeriveInt()
7723 xmlExpFree(ctxt, tmp); in xmlExpExpDeriveInt()
7724 xmlExpFree(ctxt, ret); in xmlExpExpDeriveInt()
7728 tmp3 = xmlExpExpDeriveInt(ctxt, tmp, tmp2); in xmlExpExpDeriveInt()
7729 xmlExpFree(ctxt, tmp); in xmlExpExpDeriveInt()
7730 xmlExpFree(ctxt, tmp2); in xmlExpExpDeriveInt()
7733 xmlExpFree(ctxt, ret); in xmlExpExpDeriveInt()
7741 ret = xmlExpHashGetEntry(ctxt, XML_EXP_OR, ret, tmp3, NULL, 0, 0); in xmlExpExpDeriveInt()
7767 xmlExpExpDerive(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) { in xmlExpExpDerive() argument
7768 if ((exp == NULL) || (ctxt == NULL) || (sub == NULL)) in xmlExpExpDerive()
7786 return(xmlExpExpDeriveInt(ctxt, exp, sub)); in xmlExpExpDerive()
7801 xmlExpSubsume(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) { in xmlExpSubsume() argument
7804 if ((exp == NULL) || (ctxt == NULL) || (sub == NULL)) in xmlExpSubsume()
7826 tmp = xmlExpExpDeriveInt(ctxt, exp, sub); in xmlExpSubsume()
7838 xmlExpFree(ctxt, tmp); in xmlExpSubsume()
7841 xmlExpFree(ctxt, tmp); in xmlExpSubsume()
7851 static xmlExpNodePtr xmlExpParseExpr(xmlExpCtxtPtr ctxt);
7854 #define CUR (*ctxt->cur)
7856 #define NEXT ctxt->cur++;
7859 #define SKIP_BLANKS while (IS_BLANK(*ctxt->cur)) ctxt->cur++;
7862 xmlExpParseNumber(xmlExpCtxtPtr ctxt) { in xmlExpParseNumber() argument
7880 xmlExpParseOr(xmlExpCtxtPtr ctxt) { in xmlExpParseOr() argument
7886 base = ctxt->cur; in xmlExpParseOr()
7887 if (*ctxt->cur == '(') { in xmlExpParseOr()
7889 ret = xmlExpParseExpr(ctxt); in xmlExpParseOr()
7891 if (*ctxt->cur != ')') { in xmlExpParseOr()
7893 xmlExpFree(ctxt, ret); in xmlExpParseOr()
7904 val = xmlDictLookup(ctxt->dict, BAD_CAST base, ctxt->cur - base); in xmlExpParseOr()
7907 ret = xmlExpHashGetEntry(ctxt, XML_EXP_ATOM, NULL, NULL, val, 0, 0); in xmlExpParseOr()
7916 min = xmlExpParseNumber(ctxt); in xmlExpParseOr()
7918 xmlExpFree(ctxt, ret); in xmlExpParseOr()
7924 max = xmlExpParseNumber(ctxt); in xmlExpParseOr()
7929 xmlExpFree(ctxt, ret); in xmlExpParseOr()
7933 ret = xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, ret, NULL, NULL, in xmlExpParseOr()
7938 ret = xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, ret, NULL, NULL, in xmlExpParseOr()
7943 ret = xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, ret, NULL, NULL, in xmlExpParseOr()
7948 ret = xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, ret, NULL, NULL, in xmlExpParseOr()
7957 xmlExpParseSeq(xmlExpCtxtPtr ctxt) { in xmlExpParseSeq() argument
7960 ret = xmlExpParseOr(ctxt); in xmlExpParseSeq()
7964 right = xmlExpParseOr(ctxt); in xmlExpParseSeq()
7966 xmlExpFree(ctxt, ret); in xmlExpParseSeq()
7969 ret = xmlExpHashGetEntry(ctxt, XML_EXP_OR, ret, right, NULL, 0, 0); in xmlExpParseSeq()
7977 xmlExpParseExpr(xmlExpCtxtPtr ctxt) { in xmlExpParseExpr() argument
7980 ret = xmlExpParseSeq(ctxt); in xmlExpParseExpr()
7984 right = xmlExpParseSeq(ctxt); in xmlExpParseExpr()
7986 xmlExpFree(ctxt, ret); in xmlExpParseExpr()
7989 ret = xmlExpHashGetEntry(ctxt, XML_EXP_SEQ, ret, right, NULL, 0, 0); in xmlExpParseExpr()
8014 xmlExpParse(xmlExpCtxtPtr ctxt, const char *expr) { in xmlExpParse() argument
8017 ctxt->expr = expr; in xmlExpParse()
8018 ctxt->cur = expr; in xmlExpParse()
8020 ret = xmlExpParseExpr(ctxt); in xmlExpParse()
8022 if (*ctxt->cur != 0) { in xmlExpParse()
8023 xmlExpFree(ctxt, ret); in xmlExpParse()
8143 xmlExpCtxtNbNodes(xmlExpCtxtPtr ctxt) { in xmlExpCtxtNbNodes() argument
8144 if (ctxt == NULL) in xmlExpCtxtNbNodes()
8146 return(ctxt->nb_nodes); in xmlExpCtxtNbNodes()
8158 xmlExpCtxtNbCons(xmlExpCtxtPtr ctxt) { in xmlExpCtxtNbCons() argument
8159 if (ctxt == NULL) in xmlExpCtxtNbCons()
8161 return(ctxt->nb_cons); in xmlExpCtxtNbCons()