MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlRegExecPushStringInternal

Function xmlRegExecPushStringInternal

ThirdParty/libxml2/vtklibxml2/xmlregexp.c:3689–3989  ·  view source on GitHub ↗

* 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

Source from the content-addressed store, hash-verified

3687 * a negative value in case of error.
3688 */
3689static int
3690xmlRegExecPushStringInternal(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;

Callers 2

xmlRegExecPushStringFunction · 0.85
xmlRegExecPushString2Function · 0.85

Calls 9

xmlRegCompactPushStringFunction · 0.85
xmlStrEqualFunction · 0.85
fprintfFunction · 0.85
xmlRegStrEqualWildcardFunction · 0.85
xmlFARegExecSaveFunction · 0.85
xmlRegExecSetErrStringFunction · 0.85
xmlFARegExecRollBackFunction · 0.85
callbackMethod · 0.80

Tested by

no test coverage detected