Lines Matching refs:atom

215     xmlRegAtomPtr atom;
253 xmlRegAtomPtr atom;
358 static void xmlRegFreeAtom(xmlRegAtomPtr atom);
360 static int xmlRegCheckCharacter(xmlRegAtomPtr atom, int codepoint);
471 * 3/ build a table state x atom for the transitions
574 if ((trans->to == -1) || (trans->atom == NULL))
576 atomno = stringRemap[trans->atom->no];
577 if ((trans->atom->data != NULL) && (transdata == NULL)) {
590 * if the same atom can generate transitions to 2 different
599 printf("Indet: state %d trans %d, atom %d to %d : %d to %d\n",
600 i, j, trans->atom->no, trans->to, atomno, targetno);
615 printf("State %d trans %d: atom %d to %d : %d to %d\n",
616 i, j, trans->atom->no, trans->to, atomno, targetno);
622 trans->atom->data;
780 * @type: the type of atom
782 * Allocate a new atom
784 * Returns the new atom or NULL in case of error
792 xmlRegexpErrMemory(ctxt, "allocating atom");
805 * @atom: the regexp atom
807 * Free a regexp atom
810 xmlRegFreeAtom(xmlRegAtomPtr atom) {
813 if (atom == NULL)
816 for (i = 0;i < atom->nbRanges;i++)
817 xmlRegFreeRange(atom->ranges[i]);
818 if (atom->ranges != NULL)
819 xmlFree(atom->ranges);
820 if ((atom->type == XML_REGEXP_STRING) && (atom->valuep != NULL))
821 xmlFree(atom->valuep);
822 if ((atom->type == XML_REGEXP_STRING) && (atom->valuep2 != NULL))
823 xmlFree(atom->valuep2);
824 if ((atom->type == XML_REGEXP_BLOCK_NAME) && (atom->valuep != NULL))
825 xmlFree(atom->valuep);
826 xmlFree(atom);
832 * @atom: the oiginal atom
836 * Returns the new atom or NULL in case of error
839 xmlRegCopyAtom(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom) {
844 xmlRegexpErrMemory(ctxt, "copying atom");
848 ret->type = atom->type;
849 ret->quant = atom->quant;
850 ret->min = atom->min;
851 ret->max = atom->max;
852 if (atom->nbRanges > 0) {
856 atom->nbRanges);
858 xmlRegexpErrMemory(ctxt, "copying atom");
861 for (i = 0;i < atom->nbRanges;i++) {
862 ret->ranges[i] = xmlRegCopyRange(ctxt, atom->ranges[i]);
1086 xmlRegPrintAtom(FILE *output, xmlRegAtomPtr atom) {
1087 fprintf(output, " atom: ");
1088 if (atom == NULL) {
1092 if (atom->neg)
1094 xmlRegPrintAtomType(output, atom->type);
1095 xmlRegPrintQuantType(output, atom->quant);
1096 if (atom->quant == XML_REGEXP_QUANT_RANGE)
1097 fprintf(output, "%d-%d ", atom->min, atom->max);
1098 if (atom->type == XML_REGEXP_STRING)
1099 fprintf(output, "'%s' ", (char *) atom->valuep);
1100 if (atom->type == XML_REGEXP_CHARVAL)
1101 fprintf(output, "char %c\n", atom->codepoint);
1102 else if (atom->type == XML_REGEXP_RANGES) {
1104 fprintf(output, "%d entries\n", atom->nbRanges);
1105 for (i = 0; i < atom->nbRanges;i++)
1106 xmlRegPrintRange(output, atom->ranges[i]);
1107 } else if (atom->type == XML_REGEXP_SUBREG) {
1108 fprintf(output, "start %d end %d\n", atom->start->no, atom->stop->no);
1139 if (trans->atom == NULL) {
1143 if (trans->atom->type == XML_REGEXP_CHARVAL)
1144 fprintf(output, "char %c ", trans->atom->codepoint);
1145 fprintf(output, "atom %d, to %d\n", trans->atom->no, trans->to);
1189 if (ctxt->atom != NULL) {
1190 fprintf(output, "current atom:\n");
1191 xmlRegPrintAtom(output, ctxt->atom);
1217 xmlRegAtomAddRange(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom,
1222 if (atom == NULL) {
1223 ERROR("add range: atom is NULL");
1226 if (atom->type != XML_REGEXP_RANGES) {
1227 ERROR("add range: atom is not ranges");
1230 if (atom->maxRanges == 0) {
1231 atom->maxRanges = 4;
1232 atom->ranges = (xmlRegRangePtr *) xmlMalloc(atom->maxRanges *
1234 if (atom->ranges == NULL) {
1236 atom->maxRanges = 0;
1239 } else if (atom->nbRanges >= atom->maxRanges) {
1241 atom->maxRanges *= 2;
1242 tmp = (xmlRegRangePtr *) xmlRealloc(atom->ranges, atom->maxRanges *
1246 atom->maxRanges /= 2;
1249 atom->ranges = tmp;
1255 atom->ranges[atom->nbRanges++] = range;
1288 xmlRegAtomPush(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom) {
1289 if (atom == NULL) {
1290 ERROR("atom push: atom is NULL");
1298 xmlRegexpErrMemory(ctxt, "pushing atom");
1314 atom->no = ctxt->nbAtoms;
1315 ctxt->atoms[ctxt->nbAtoms++] = atom;
1349 xmlRegAtomPtr atom, xmlRegStatePtr target,
1370 if ((trans->atom == atom) &&
1411 else if (atom == NULL)
1413 else if (atom != NULL)
1414 xmlRegPrintAtom(stdout, atom);
1417 state->trans[state->nbTrans].atom = atom;
1539 * @atom: the atom generating the transition
1545 xmlRegStatePtr to, xmlRegAtomPtr atom) {
1549 if (atom == NULL) {
1550 ERROR("genrate transition: atom == NULL");
1553 if (atom->type == XML_REGEXP_SUBREG) {
1558 if (xmlRegAtomPush(ctxt, atom) < 0) {
1561 if ((to != NULL) && (atom->stop != to) &&
1562 (atom->quant != XML_REGEXP_QUANT_RANGE)) {
1566 xmlFAGenerateEpsilonTransition(ctxt, atom->stop, to);
1568 } else if ((to == NULL) && (atom->quant != XML_REGEXP_QUANT_RANGE) &&
1569 (atom->quant != XML_REGEXP_QUANT_ONCE)) {
1573 xmlFAGenerateEpsilonTransition(ctxt, atom->stop, to);
1576 switch (atom->quant) {
1578 atom->quant = XML_REGEXP_QUANT_ONCE;
1580 * transition done to the state after end of atom.
1581 * 1. set transition from atom start to new state
1582 * 2. set transition from atom end to this state.
1585 xmlFAGenerateEpsilonTransition(ctxt, atom->start, 0);
1586 xmlFAGenerateEpsilonTransition(ctxt, atom->stop,
1589 xmlFAGenerateEpsilonTransition(ctxt, atom->start, to);
1593 atom->quant = XML_REGEXP_QUANT_ONCE;
1594 xmlFAGenerateEpsilonTransition(ctxt, atom->start, atom->stop);
1595 xmlFAGenerateEpsilonTransition(ctxt, atom->stop, atom->start);
1598 atom->quant = XML_REGEXP_QUANT_ONCE;
1599 xmlFAGenerateEpsilonTransition(ctxt, atom->stop, atom->start);
1621 if ((atom->min == 0) && (atom->start0 == NULL)) {
1624 * duplicate a transition based on atom to count next
1625 * occurences after 1. We cannot loop to atom->start
1632 copy = xmlRegCopyAtom(ctxt, atom);
1639 if (xmlFAGenerateTransitions(ctxt, atom->start, NULL, copy)
1644 ctxt->counters[counter].min = atom->min - 1;
1645 ctxt->counters[counter].max = atom->max - 1;
1648 atom->stop, counter);
1653 xmlFAGenerateEpsilonTransition(ctxt, atom->start,
1657 * either we need the atom at least once or there
1658 * is an atom->start0 allowing to easilly plug the
1662 ctxt->counters[counter].min = atom->min - 1;
1663 ctxt->counters[counter].max = atom->max - 1;
1665 xmlFAGenerateCountedEpsilonTransition(ctxt, atom->stop,
1666 atom->start, counter);
1668 xmlFAGenerateCountedTransition(ctxt, atom->stop,
1671 if (atom->min == 0)
1672 xmlFAGenerateEpsilonTransition(ctxt, atom->start0,
1676 atom->min = 0;
1677 atom->max = 0;
1678 atom->quant = XML_REGEXP_QUANT_ONCE;
1686 if ((atom->min == 0) && (atom->max == 0) &&
1687 (atom->quant == XML_REGEXP_QUANT_RANGE)) {
1689 * we can discard the atom and generate an epsilon transition instead
1701 xmlRegFreeAtom(atom);
1713 if ((atom->quant == XML_REGEXP_QUANT_MULT) ||
1714 (atom->quant == XML_REGEXP_QUANT_PLUS)) {
1731 if (xmlRegAtomPush(ctxt, atom) < 0) {
1734 if ((atom->quant == XML_REGEXP_QUANT_RANGE) &&
1735 (atom->min == 0) && (atom->max > 0)) {
1737 atom->min = 1;
1738 if (atom->max == 1)
1739 atom->quant = XML_REGEXP_QUANT_OPT;
1741 xmlRegStateAddTrans(ctxt, from, atom, to, -1, -1);
1743 switch (atom->quant) {
1745 atom->quant = XML_REGEXP_QUANT_ONCE;
1749 atom->quant = XML_REGEXP_QUANT_ONCE;
1751 xmlRegStateAddTrans(ctxt, to, atom, to, -1, -1);
1754 atom->quant = XML_REGEXP_QUANT_ONCE;
1755 xmlRegStateAddTrans(ctxt, to, atom, to, -1, -1);
1805 if (to->trans[transnr].atom == NULL) {
1837 xmlRegStateAddTrans(ctxt, from, to->trans[transnr].atom,
1841 xmlRegStateAddTrans(ctxt, from, to->trans[transnr].atom,
1878 if ((state->trans[0].atom == NULL) &&
1904 xmlRegStateAddTrans(ctxt, tmp, tmp->trans[j].atom,
1971 if ((state->trans[transnr].atom == NULL) &&
2011 if ((trans->atom == NULL) &&
2039 ((state->trans[transnr].atom != NULL) ||
2245 * @type1: an atom type
2246 * @type2: an atom type
2446 * @atom1: an atom
2447 * @atom2: an atom
2491 * @atom1: an atom
2492 * @atom2: an atom
2589 int to, xmlRegAtomPtr atom) {
2614 if (t1->atom == NULL) {
2619 to, atom);
2629 if (xmlFACompareAtoms(t1->atom, atom, deep)) {
2680 if (t1->atom == NULL) {
2690 if (t2->atom != NULL) {
2696 if (xmlFAEqualAtoms(t1->atom, t2->atom, deep) &&
2708 * with the same atom and a different target.
2723 if (t1->atom == NULL) {
2732 if (t2->atom != NULL) {
2737 if (xmlFACompareAtoms(t1->atom, t2->atom, 1)) {
2750 t2->to, t2->atom);
2965 xmlRegCheckCharacter(xmlRegAtomPtr atom, int codepoint) {
2969 if ((atom == NULL) || (!IS_CHAR(codepoint)))
2972 switch (atom->type) {
2977 return(codepoint == atom->codepoint);
2981 for (i = 0;i < atom->nbRanges;i++) {
2982 range = atom->ranges[i];
3058 ret = xmlRegCheckCharacterRange(atom->type, codepoint, 0, 0, 0,
3059 (const xmlChar *)atom->valuep);
3060 if (atom->neg)
3222 xmlRegAtomPtr atom;
3235 * atom allows minOccurs of 0
3240 atom = trans->atom;
3241 if (!((atom->min == 0) && (atom->max > 0)))
3253 atom = trans->atom;
3277 } else if (atom == NULL) {
3283 ret = xmlRegCheckCharacter(atom, codepoint);
3284 if ((ret == 1) && (atom->min >= 0) && (atom->max > 0)) {
3320 if (exec->transcount == atom->max) {
3331 if (exec->transcount >= atom->min) {
3346 ret = xmlRegCheckCharacter(atom, codepoint);
3349 if (exec->transcount < atom->min)
3371 } else if ((ret == 0) && (atom->min == 0) && (atom->max > 0)) {
3381 } else if ((atom->min == 0) && (atom->max > 0)) {
3393 printf("Saving on nd transition atom %d for %c at %d\n",
3394 trans->atom->no, codepoint, exec->index);
3436 if (trans->atom != NULL) {
3487 * Progressive interface to the verifier one atom at a time *
3781 xmlRegAtomPtr atom;
3836 atom = trans->atom;
3862 (t->atom != NULL) &&
3863 (xmlStrEqual(value, t->atom->valuep))) {
3869 (t->atom != NULL) &&
3870 (xmlStrEqual(value, t->atom->valuep))) {
3916 } else if (atom == NULL) {
3921 ret = xmlRegStrEqualWildcard(atom->valuep, value);
3922 if (atom->neg) {
3937 if ((ret == 1) && (atom->min > 0) && (atom->max > 0)) {
3954 if (exec->transcount == atom->max) {
3971 if (exec->transcount >= atom->min) {
3987 ret = xmlStrEqual(value, atom->valuep);
3990 if (exec->transcount < atom->min)
4005 if ((exec->callback != NULL) && (atom != NULL) &&
4007 exec->callback(exec->data, atom->valuep,
4008 atom->data, data);
4049 if (trans->atom != NULL) {
4266 xmlRegAtomPtr atom;
4289 atom = trans->atom;
4290 if ((atom == NULL) || (atom->valuep == NULL))
4309 if (atom->neg)
4310 values[nb++] = (xmlChar *) atom->valuep2;
4312 values[nb++] = (xmlChar *) atom->valuep;
4319 if (atom->neg)
4320 values[nb++] = (xmlChar *) atom->valuep2;
4322 values[nb++] = (xmlChar *) atom->valuep;
4333 atom = trans->atom;
4334 if ((atom == NULL) || (atom->valuep == NULL))
4346 if (atom->neg)
4347 values[nb++] = (xmlChar *) atom->valuep2;
4349 values[nb++] = (xmlChar *) atom->valuep;
4429 xmlRegAtomPtr atom;
4455 atom = trans->atom;
4472 } else if (atom == NULL) {
4478 ret = xmlRegCheckCharacter(atom, codepoint);
4479 if ((ret == 1) && (atom->min > 0) && (atom->max > 0)) {
4493 if (exec->transcount == atom->max) {
4504 if (exec->transcount >= atom->min) {
4519 ret = xmlRegCheckCharacter(atom, codepoint);
4522 if (exec->transcount < atom->min)
4560 if (trans->atom != NULL) {
4822 if (ctxt->atom == NULL) {
4823 ctxt->atom = xmlRegNewAtom(ctxt, type);
4824 if (ctxt->atom != NULL)
4825 ctxt->atom->valuep = blockName;
4826 } else if (ctxt->atom->type == XML_REGEXP_RANGES) {
4827 xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
4847 if (ctxt->atom == NULL) {
4848 ctxt->atom = xmlRegNewAtom(ctxt, XML_REGEXP_ANYCHAR);
4849 } else if (ctxt->atom->type == XML_REGEXP_RANGES) {
4850 xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
4883 ctxt->atom->neg = 1;
4894 if (ctxt->atom == NULL) {
4895 ctxt->atom = xmlRegNewAtom(ctxt, XML_REGEXP_CHARVAL);
4896 if (ctxt->atom != NULL) {
4899 ctxt->atom->codepoint = '\n';
4902 ctxt->atom->codepoint = '\r';
4905 ctxt->atom->codepoint = '\t';
4908 ctxt->atom->codepoint = cur;
4911 } else if (ctxt->atom->type == XML_REGEXP_RANGES) {
4923 xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
4965 if (ctxt->atom == NULL) {
4966 ctxt->atom = xmlRegNewAtom(ctxt, type);
4967 } else if (ctxt->atom->type == XML_REGEXP_RANGES) {
4968 xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
5032 xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
5066 xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
5142 ctxt->atom = xmlRegNewAtom(ctxt, XML_REGEXP_RANGES);
5143 if (ctxt->atom == NULL)
5196 if (ctxt->atom != NULL) {
5198 ctxt->atom->quant = XML_REGEXP_QUANT_OPT;
5200 ctxt->atom->quant = XML_REGEXP_QUANT_MULT;
5202 ctxt->atom->quant = XML_REGEXP_QUANT_PLUS;
5234 if (ctxt->atom != NULL) {
5235 ctxt->atom->quant = XML_REGEXP_QUANT_RANGE;
5236 ctxt->atom->min = min;
5237 ctxt->atom->max = max;
5248 * [9] atom ::= Char | charClass | ( '(' regExp ')' )
5256 ctxt->atom = xmlRegNewAtom(ctxt, XML_REGEXP_CHARVAL);
5257 if (ctxt->atom == NULL)
5260 ctxt->atom->codepoint = codepoint;
5283 ctxt->atom = NULL;
5290 ctxt->atom = xmlRegNewAtom(ctxt, XML_REGEXP_SUBREG);
5291 if (ctxt->atom == NULL)
5293 ctxt->atom->start = start;
5294 ctxt->atom->start0 = start0;
5295 ctxt->atom->stop = ctxt->state;
5309 * [3] piece ::= atom quantifier?
5315 ctxt->atom = NULL;
5319 if (ctxt->atom == NULL) {
5320 ERROR("internal: no atom generated");
5345 (CUR=='|' || CUR==')') ? to : NULL, ctxt->atom) < 0)
5348 ctxt->atom = NULL;
5354 (CUR=='|' || CUR==')') ? to : NULL, ctxt->atom) < 0)
5357 ctxt->atom = NULL;
5710 xmlRegAtomPtr atom;
5714 atom = xmlRegNewAtom(am, XML_REGEXP_STRING);
5715 if (atom == NULL)
5717 atom->data = data;
5718 atom->valuep = xmlStrdup(token);
5720 if (xmlFAGenerateTransitions(am, from, to, atom) < 0) {
5721 xmlRegFreeAtom(atom);
5748 xmlRegAtomPtr atom;
5752 atom = xmlRegNewAtom(am, XML_REGEXP_STRING);
5753 if (atom == NULL)
5755 atom->data = data;
5757 atom->valuep = xmlStrdup(token);
5767 xmlRegFreeAtom(atom);
5775 atom->valuep = str;
5778 if (xmlFAGenerateTransitions(am, from, to, atom) < 0) {
5779 xmlRegFreeAtom(atom);
5808 xmlRegAtomPtr atom;
5813 atom = xmlRegNewAtom(am, XML_REGEXP_STRING);
5814 if (atom == NULL)
5816 atom->data = data;
5817 atom->neg = 1;
5819 atom->valuep = xmlStrdup(token);
5829 xmlRegFreeAtom(atom);
5837 atom->valuep = str;
5839 snprintf((char *) err_msg, 199, "not %s", (const char *) atom->valuep);
5841 atom->valuep2 = xmlStrdup(err_msg);
5843 if (xmlFAGenerateTransitions(am, from, to, atom) < 0) {
5844 xmlRegFreeAtom(atom);
5876 xmlRegAtomPtr atom;
5885 atom = xmlRegNewAtom(am, XML_REGEXP_STRING);
5886 if (atom == NULL)
5889 atom->valuep = xmlStrdup(token);
5899 xmlRegFreeAtom(atom);
5907 atom->valuep = str;
5909 atom->data = data;
5911 atom->min = 1;
5913 atom->min = min;
5914 atom->max = max;
5923 /* xmlFAGenerateTransitions(am, from, to, atom); */
5928 xmlRegStateAddTrans(am, from, atom, to, counter, -1);
5929 xmlRegAtomPush(am, atom);
5962 xmlRegAtomPtr atom;
5971 atom = xmlRegNewAtom(am, XML_REGEXP_STRING);
5972 if (atom == NULL)
5974 atom->valuep = xmlStrdup(token);
5975 atom->data = data;
5977 atom->min = 1;
5979 atom->min = min;
5980 atom->max = max;
5989 /* xmlFAGenerateTransitions(am, from, to, atom); */
5994 xmlRegStateAddTrans(am, from, atom, to, counter, -1);
5995 xmlRegAtomPush(am, atom);
6031 xmlRegAtomPtr atom;
6040 atom = xmlRegNewAtom(am, XML_REGEXP_STRING);
6041 if (atom == NULL)
6044 atom->valuep = xmlStrdup(token);
6054 xmlRegFreeAtom(atom);
6062 atom->valuep = str;
6064 atom->data = data;
6065 atom->quant = XML_REGEXP_QUANT_ONCEONLY;
6066 atom->min = min;
6067 atom->max = max;
6075 /* xmlFAGenerateTransitions(am, from, to, atom); */
6080 xmlRegStateAddTrans(am, from, atom, to, counter, -1);
6081 xmlRegAtomPush(am, atom);
6110 xmlRegAtomPtr atom;
6119 atom = xmlRegNewAtom(am, XML_REGEXP_STRING);
6120 if (atom == NULL)
6122 atom->valuep = xmlStrdup(token);
6123 atom->data = data;
6124 atom->quant = XML_REGEXP_QUANT_ONCEONLY;
6125 atom->min = min;
6126 atom->max = max;
6134 /* xmlFAGenerateTransitions(am, from, to, atom); */
6139 xmlRegStateAddTrans(am, from, atom, to, counter, -1);
6140 xmlRegAtomPush(am, atom);
6846 * @name: the atom name
6847 * @len: the atom name length in byte (or -1);
6849 * Get the atom associated to this name from that context
6869 * Get the atom associated to the choice @left | @right
6894 * Get the atom associated to the sequence @left , @right
6920 * Get the atom associated to the range (@subset){@min, @max}
7095 printf("deriv atom: equal => Empty\n");
7100 printf("deriv atom: mismatch => forbid\n");