* xmlRegExecPushStringInternal: * @exec: a regexp execution context or NULL to indicate the end * @value: a string token input * @data: data associated to the token to reuse in callbacks * @compound: value was assembled from 2 strings * * Push one input token in the execution context * * Returns: 1 if the regexp reached a final state, 0 if non-final, and * a negative value in case of
| 3687 | * a negative value in case of error. |
| 3688 | */ |
| 3689 | static int |
| 3690 | xmlRegExecPushStringInternal(xmlRegExecCtxtPtr exec, const xmlChar *value, |
| 3691 | void *data, int compound) { |
| 3692 | xmlRegTransPtr trans; |
| 3693 | xmlRegAtomPtr atom; |
| 3694 | int ret; |
| 3695 | int final = 0; |
| 3696 | int progress = 1; |
| 3697 | |
| 3698 | if (exec == NULL) |
| 3699 | return(-1); |
| 3700 | if (exec->comp == NULL) |
| 3701 | return(-1); |
| 3702 | if (exec->status != XML_REGEXP_OK) |
| 3703 | return(exec->status); |
| 3704 | |
| 3705 | if (exec->comp->compact != NULL) |
| 3706 | return(xmlRegCompactPushString(exec, exec->comp, value, data)); |
| 3707 | |
| 3708 | if (value == NULL) { |
| 3709 | if (exec->state->type == XML_REGEXP_FINAL_STATE) |
| 3710 | return(1); |
| 3711 | final = 1; |
| 3712 | } |
| 3713 | |
| 3714 | /* |
| 3715 | * If we have an active rollback stack push the new value there |
| 3716 | * and get back to where we were left |
| 3717 | */ |
| 3718 | if ((value != NULL) && (exec->inputStackNr > 0)) { |
| 3719 | xmlFARegExecSaveInputString(exec, value, data); |
| 3720 | value = exec->inputStack[exec->index].value; |
| 3721 | data = exec->inputStack[exec->index].data; |
| 3722 | } |
| 3723 | |
| 3724 | while ((exec->status == XML_REGEXP_OK) && |
| 3725 | ((value != NULL) || |
| 3726 | ((final == 1) && |
| 3727 | (exec->state->type != XML_REGEXP_FINAL_STATE)))) { |
| 3728 | |
| 3729 | /* |
| 3730 | * End of input on non-terminal state, rollback, however we may |
| 3731 | * still have epsilon like transition for counted transitions |
| 3732 | * on counters, in that case don't break too early. |
| 3733 | */ |
| 3734 | if ((value == NULL) && (exec->counts == NULL)) |
| 3735 | goto rollback; |
| 3736 | |
| 3737 | exec->transcount = 0; |
| 3738 | for (;exec->transno < exec->state->nbTrans;exec->transno++) { |
| 3739 | trans = &exec->state->trans[exec->transno]; |
| 3740 | if (trans->to < 0) |
| 3741 | continue; |
| 3742 | atom = trans->atom; |
| 3743 | ret = 0; |
| 3744 | if (trans->count == REGEXP_ALL_LAX_COUNTER) { |
| 3745 | int i; |
| 3746 | int count; |
no test coverage detected