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

more work on the automata interfaces and debug of counted choices added a

* xmlregexp.c xmlschemas.c include/libxml/xmlautomata.h: more work
  on the automata interfaces and debug of counted choices
* test/schemas/* result/schemas/*: added a number of tests
Daniel
This commit is contained in:
Daniel Veillard
2002-04-17 16:28:10 +00:00
parent 8651f5365c
commit b509f1543d
41 changed files with 733 additions and 21 deletions

View File

@ -2995,12 +2995,43 @@ xmlSchemaBuildAContentModel(xmlSchemaTypePtr type,
* iterate over the subtypes and remerge the end with an
* epsilon transition
*/
subtypes = type->subtypes;
while (subtypes != NULL) {
ctxt->state = start;
xmlSchemaBuildAContentModel(subtypes, ctxt, name);
xmlAutomataNewEpsilon(ctxt->am, ctxt->state, end);
subtypes = subtypes->next;
if (type->maxOccurs == 1) {
subtypes = type->subtypes;
while (subtypes != NULL) {
ctxt->state = start;
xmlSchemaBuildAContentModel(subtypes, ctxt, name);
xmlAutomataNewEpsilon(ctxt->am, ctxt->state, end);
subtypes = subtypes->next;
}
} else {
int counter;
xmlAutomataStatePtr hop;
/*
* use a counter to keep track of the number of transtions
* which went through the choice.
*/
if (type->minOccurs < 1) {
counter = xmlAutomataNewCounter(ctxt->am, 0,
type->maxOccurs - 1);
} else {
counter = xmlAutomataNewCounter(ctxt->am,
type->minOccurs - 1, type->maxOccurs - 1);
}
hop = xmlAutomataNewState(ctxt->am);
subtypes = type->subtypes;
while (subtypes != NULL) {
ctxt->state = start;
xmlSchemaBuildAContentModel(subtypes, ctxt, name);
xmlAutomataNewEpsilon(ctxt->am, ctxt->state, hop);
subtypes = subtypes->next;
}
xmlAutomataNewCountedTrans(ctxt->am, hop, start, counter);
xmlAutomataNewCounterTrans(ctxt->am, hop, end, counter);
}
if (type->minOccurs == 0) {
xmlAutomataNewEpsilon(ctxt->am, start, end);
}
ctxt->state = end;
break;