err = re_node_set_add_intersect (&state_buf, plog, dfa->inveclosures + prev_node); if (BE (err != REG_NOERROR, 0)) return err; } if (mctx->state_log[str_idx] != NULL && mctx->state_log[str_idx]->has_backref) { err = add_epsilon_backreference (dfa, mctx, plog, str_idx, &state_buf); if (BE (err != REG_NOERROR, 0))
ret = re_node_set_insert (&cur_dest, prev_node); if (BE (ret == -1, 0))
sift_states_backward (preg, mctx, last_node)    const regex_t *preg;    const re_match_context_t *mctx;    int last_node;{  reg_errcode_t err;  re_dfa_t *dfa = (re_dfa_t *)preg->buffer;  re_node_set state_buf;  int str_idx = mctx->match_last;  re_node_set *plog;	/* Points the state_log[str_idx]->nodes  */#ifdef DEBUG  assert (mctx->state_log != NULL && mctx->state_log[str_idx] != NULL);#endif  err = re_node_set_alloc (&state_buf, NUMBER_OF_STATE);  if (BE (err != REG_NOERROR, 0))    return err;  plog = &mctx->state_log[str_idx]->nodes;  /* Build sifted state_log[str_idx].  It has the nodes which can epsilon     transit to the last_node and the last_node itself.  */  err = re_node_set_intersect (&state_buf, plog, dfa->inveclosures + last_node);  if (BE (err != REG_NOERROR, 0))    return err;  if (mctx->state_log[str_idx] != NULL      && mctx->state_log[str_idx]->has_backref)    {      err = add_epsilon_backreference (dfa, mctx, plog, str_idx, &state_buf);      if (BE (err != REG_NOERROR, 0))        return err;    }  /* Update state log.  */  mctx->state_log[str_idx] = re_acquire_state (&err, dfa, &state_buf);  if (BE (mctx->state_log[str_idx] == NULL && err != REG_NOERROR, 0))    return err;  /* Then check each states in the state_log.  */  while (str_idx > 0)    {      int i, j;      /* Update counters.  */      re_node_set_empty (&state_buf);      --str_idx;      plog = ((mctx->state_log[str_idx] == NULL) ? &empty_set              : &mctx->state_log[str_idx]->nodes);      /* Then build the next sifted state.         We build the next sifted state on `state_buf', and update         `state_log[str_idx]' with `state_buf'.         Note:         `state_buf' is the sifted state from `state_log[str_idx + 1]'.         `plog' points the node_set of the old `state_log[str_idx]'.  */      for (i = 0; i < plog->nelem; i++)        {          int prev_node = plog->elems[i];          int entity = prev_node;          int naccepted = 0;          re_token_type_t type = dfa->nodes[prev_node].type;          if (type == OP_CONTEXT_NODE)            {              entity = dfa->nodes[prev_node].opr.ctx_info->entity;              type = dfa->nodes[entity].type;            }#ifdef RE_ENABLE_I18N          /* If the node may accept `multi byte'.  */          if (ACCEPT_MB_NODE (type))            naccepted = sift_states_iter_mb (preg, mctx, entity, str_idx,                                             mctx->match_last);          /* If the node is a back reference.  */          else#endif /* RE_ENABLE_I18N */          if (type == OP_BACK_REF)            for (j = 0; j < mctx->nbkref_ents; ++j)              {                naccepted = sift_states_iter_bkref (dfa, mctx->state_log,                                                    mctx->bkref_ents + j,                                                    prev_node, str_idx,                                                    mctx->match_last);                if (naccepted)                  break;              }          if (!naccepted              && check_node_accept (preg, dfa->nodes + prev_node, mctx,                                    str_idx)              && STATE_NODE_CONTAINS (mctx->state_log[str_idx + 1],                                      dfa->nexts[prev_node]))            naccepted = 1;          if (naccepted == 0)            continue;          /* `prev_node' may point the entity of the OP_CONTEXT_NODE,             then we use plog->elems[i] instead.  */          err = re_node_set_add_intersect (&state_buf, plog,                                           dfa->inveclosures + prev_node);          if (BE (err != REG_NOERROR, 0))            return err;        }      if (mctx->state_log[str_idx] != NULL          && mctx->state_log[str_idx]->has_backref)        {          err = add_epsilon_backreference (dfa, mctx, plog, str_idx, &state_buf);          if (BE (err != REG_NOERROR, 0))            return err;        }      /* Update state_log.  */      mctx->state_log[str_idx] = re_acquire_state (&err, dfa, &state_buf);      if (BE (mctx->state_log[str_idx] == NULL && err != REG_NOERROR, 0))        return err;    }  re_node_set_free (&state_buf);  return REG_NOERROR;}