mirror of
https://github.com/GNOME/libxml2.git
synced 2025-02-23 18:29:14 +08:00
first implementation of the all particle, this may need to be revisited
* xmlregexp.c: first implementation of the all particle, this may need to be revisited for case where not all transitions must be crossed. Daniel
This commit is contained in:
parent
7646b18d64
commit
8a001f62c1
@ -1,3 +1,9 @@
|
||||
Sat Apr 20 09:22:50 CEST 2002 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* xmlregexp.c: first implementation of the all particle, this
|
||||
may need to be revisited for case where not all transitions
|
||||
must be crossed.
|
||||
|
||||
Fri Apr 19 18:26:04 CEST 2002 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* tree.c: another entity processing update from Markus Henke
|
||||
|
35
xmlregexp.c
35
xmlregexp.c
@ -690,7 +690,9 @@ xmlRegPrintTrans(FILE *output, xmlRegTransPtr trans) {
|
||||
if (trans->counter >= 0) {
|
||||
fprintf(output, "counted %d, ", trans->counter);
|
||||
}
|
||||
if (trans->count >= 0) {
|
||||
if (trans->count == REGEXP_ALL_COUNTER) {
|
||||
fprintf(output, "all transition, ");
|
||||
} else if (trans->count >= 0) {
|
||||
fprintf(output, "count based %d, ", trans->count);
|
||||
}
|
||||
if (trans->atom == NULL) {
|
||||
@ -907,7 +909,9 @@ xmlRegStateAddTrans(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state,
|
||||
}
|
||||
#ifdef DEBUG_REGEXP_GRAPH
|
||||
printf("Add trans from %d to %d ", state->no, target->no);
|
||||
if (count >= 0)
|
||||
if (count == REGEXP_ALL_COUNTER)
|
||||
printf("all transition");
|
||||
else (count >= 0)
|
||||
printf("count based %d", count);
|
||||
else if (counter >= 0)
|
||||
printf("counted %d", counter);
|
||||
@ -2023,7 +2027,32 @@ xmlRegExecPushString(xmlRegExecCtxtPtr exec, const xmlChar *value,
|
||||
continue;
|
||||
atom = trans->atom;
|
||||
ret = 0;
|
||||
if (trans->count >= 0) {
|
||||
if (trans->count == REGEXP_ALL_COUNTER) {
|
||||
int i;
|
||||
int count;
|
||||
xmlRegTransPtr t;
|
||||
xmlRegCounterPtr counter;
|
||||
|
||||
ret = 1;
|
||||
|
||||
#ifdef DEBUG_PUSH
|
||||
printf("testing all %d\n", trans->count);
|
||||
#endif
|
||||
/*
|
||||
* Check all counted transitions from the current state
|
||||
*/
|
||||
for (i = 0;i < exec->state->nbTrans;i++) {
|
||||
t = &exec->state->trans[i];
|
||||
if ((t->counter < 0) || (t == trans))
|
||||
continue;
|
||||
counter = &exec->comp->counters[t->counter];
|
||||
count = exec->counts[t->counter];
|
||||
if ((count < counter->min) || (count > counter->max)) {
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (trans->count >= 0) {
|
||||
int count;
|
||||
xmlRegCounterPtr counter;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user