Lines Matching refs:exp
6269 * Compile the automata into a Reg Exp ready for being executed.
6771 * @exp: the expression
6776 xmlExpFree(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp) {
6777 if ((exp == NULL) || (exp == forbiddenExp) || (exp == emptyExp))
6779 exp->ref--;
6780 if (exp->ref == 0) {
6784 key = exp->key % ctxt->size;
6785 if (ctxt->table[key] == exp) {
6786 ctxt->table[key] = exp->next;
6792 if (tmp->next == exp) {
6793 tmp->next = exp->next;
6800 if ((exp->type == XML_EXP_SEQ) || (exp->type == XML_EXP_OR)) {
6801 xmlExpFree(ctxt, exp->exp_left);
6802 xmlExpFree(ctxt, exp->exp_right);
6803 } else if (exp->type == XML_EXP_COUNT) {
6804 xmlExpFree(ctxt, exp->exp_left);
6806 xmlFree(exp);
6813 * @exp: the expression
6818 xmlExpRef(xmlExpNodePtr exp) {
6819 if (exp != NULL)
6820 exp->ref++;
6927 xmlExpGetLanguageInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp,
6931 switch (exp->type) {
6936 if (list[tmp] == exp->exp_str)
6940 list[nb] = exp->exp_str;
6943 exp = exp->exp_left;
6947 tmp = xmlExpGetLanguageInt(ctxt, exp->exp_left, list, len, nb);
6950 tmp2 = xmlExpGetLanguageInt(ctxt, exp->exp_right, list, len,
6962 * @exp: the expression
6966 * Find all the strings used in @exp and store them in @list
6972 xmlExpGetLanguage(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp,
6974 if ((ctxt == NULL) || (exp == NULL) || (langList == NULL) || (len <= 0))
6976 return(xmlExpGetLanguageInt(ctxt, exp, langList, len, 0));
6980 xmlExpGetStartInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp,
6984 switch (exp->type) {
6991 if (list[tmp] == exp->exp_str)
6995 list[nb] = exp->exp_str;
6998 exp = exp->exp_left;
7001 tmp = xmlExpGetStartInt(ctxt, exp->exp_left, list, len, nb);
7004 if (IS_NILLABLE(exp->exp_left)) {
7005 tmp2 = xmlExpGetStartInt(ctxt, exp->exp_right, list, len,
7013 tmp = xmlExpGetStartInt(ctxt, exp->exp_left, list, len, nb);
7016 tmp2 = xmlExpGetStartInt(ctxt, exp->exp_right, list, len,
7028 * @exp: the expression
7033 * accepted by @exp and store them in @list. E.g. for (a, b) | c
7040 xmlExpGetStart(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp,
7042 if ((ctxt == NULL) || (exp == NULL) || (tokList == NULL) || (len <= 0))
7044 return(xmlExpGetStartInt(ctxt, exp, tokList, len, 0));
7049 * @exp: the expression
7056 xmlExpIsNillable(xmlExpNodePtr exp) {
7057 if (exp == NULL)
7059 return(IS_NILLABLE(exp) != 0);
7063 xmlExpStringDeriveInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, const xmlChar *str)
7067 switch (exp->type) {
7073 if (exp->exp_str == str) {
7092 tmp = xmlExpStringDeriveInt(ctxt, exp->exp_left, str);
7096 ret = xmlExpStringDeriveInt(ctxt, exp->exp_right, str);
7109 ret = xmlExpStringDeriveInt(ctxt, exp->exp_left, str);
7113 if (IS_NILLABLE(exp->exp_left)) {
7117 ret = xmlExpStringDeriveInt(ctxt, exp->exp_right, str);
7123 exp->exp_right->ref++;
7124 ret = xmlExpHashGetEntry(ctxt, XML_EXP_SEQ, ret, exp->exp_right,
7132 if (exp->exp_max == 0)
7134 ret = xmlExpStringDeriveInt(ctxt, exp->exp_left, str);
7143 if (exp->exp_max == 1)
7145 if (exp->exp_max < 0) /* unbounded */
7148 max = exp->exp_max - 1;
7149 if (exp->exp_min > 0)
7150 min = exp->exp_min - 1;
7153 exp->exp_left->ref++;
7154 tmp = xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, exp->exp_left, NULL,
7175 * @exp: the expression
7179 * Do one step of Brzozowski derivation of the expression @exp with
7185 xmlExpStringDerive(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp,
7189 if ((exp == NULL) || (ctxt == NULL) || (str == NULL)) {
7200 return(xmlExpStringDeriveInt(ctxt, exp, input));
7204 xmlExpCheckCard(xmlExpNodePtr exp, xmlExpNodePtr sub) {
7208 if (exp->c_max != -1)
7210 } else if ((exp->c_max >= 0) && (exp->c_max < sub->c_max)) {
7214 if ((IS_NILLABLE(sub)) && (!IS_NILLABLE(exp)))
7220 static xmlExpNodePtr xmlExpExpDeriveInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp,
7225 * @exp: the englobing expression
7230 * Check if exp is a multiple of sub, i.e. if there is a finite number n
7231 * so that sub{n} subsume exp
7238 xmlExpDivide(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub,
7245 exp->c_max == -1) return(0);
7246 if (IS_NILLABLE(exp) && (!IS_NILLABLE(sub))) return(0);
7248 for (i = 1;i <= exp->c_max;i++) {
7255 if (!xmlExpCheckCard(tmp, exp)) {
7259 tmp2 = xmlExpExpDeriveInt(ctxt, tmp, exp);
7290 * @exp: the englobing expression
7299 xmlExpExpDeriveInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) {
7308 if ((exp == sub) && (exp->c_max >= 0)) {
7310 printf("Equal(exp, sub) and finite -> Empty\n");
7321 exp->ref++;
7322 return(exp);
7328 tmp = xmlExpExpDeriveInt(ctxt, exp, sub->exp_left);
7341 tmp = xmlExpExpDeriveInt(ctxt, exp, sub->exp_left);
7346 ret = xmlExpExpDeriveInt(ctxt, exp, sub->exp_right);
7353 if (!xmlExpCheckCard(exp, sub)) {
7355 printf("CheckCard(exp, sub) failed -> Forbid\n");
7359 switch (exp->type) {
7364 printf("Empty(exp) -> Forbid\n");
7369 printf("Forbid(exp) -> Forbid\n");
7375 if (exp->exp_str == sub->exp_str) {
7390 if (exp->exp_str == sub->exp_left->exp_str) {
7402 printf("Compex exp vs Atom -> Forbid\n");
7407 if (xmlExpCheckCard(exp->exp_left, sub)) {
7412 ret = xmlExpExpDeriveInt(ctxt, exp->exp_left, sub);
7419 * i.e. we won't get to a nillable exp left
7424 exp->exp_right->ref++;
7426 exp->exp_right, NULL, 0, 0));
7440 ret = xmlExpExpDeriveInt(ctxt, exp->exp_left, sub->exp_left);
7455 exp->exp_right->ref++;
7457 exp->exp_right, NULL, 0, 0);
7480 ret = xmlExpExpDeriveInt(ctxt, exp->exp_left, sub);
7483 tmp = xmlExpExpDeriveInt(ctxt, exp->exp_right, sub);
7496 tmp = xmlExpExpDeriveInt(ctxt, exp->exp_left, sub->exp_left);
7505 mult = xmlExpDivide(ctxt, sub->exp_left, exp->exp_left,
7515 if (exp->exp_max == -1) {
7516 if (exp->exp_min <= sub->exp_min * mult)
7519 min = exp->exp_min - sub->exp_min * mult;
7528 if (exp->exp_max == -1) {
7532 if (exp->exp_min > sub->exp_min * mult) {
7534 min = exp->exp_min - sub->exp_min * mult;
7540 if (exp->exp_max < sub->exp_max * mult) {
7547 if (sub->exp_max * mult > exp->exp_min)
7550 min = exp->exp_min - sub->exp_max * mult;
7551 max = exp->exp_max - sub->exp_max * mult;
7565 if (exp->exp_max == -1) {
7566 if (exp->exp_min <= sub->exp_min) {
7577 min = exp->exp_min - sub->exp_min;
7579 } else if (exp->exp_min > sub->exp_min) {
7590 if (exp->exp_max == -1) {
7594 if (exp->exp_min > sub->exp_min) {
7596 min = exp->exp_min - sub->exp_min;
7602 if (exp->exp_max < sub->exp_max) {
7609 if (sub->exp_max > exp->exp_min)
7612 min = exp->exp_min - sub->exp_max;
7613 max = exp->exp_max - sub->exp_max;
7619 exp->exp_left->ref++;
7620 tmp2 = xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, exp->exp_left,
7629 tmp = xmlExpExpDeriveInt(ctxt, exp->exp_left, sub);
7638 if (exp->exp_min > 0)
7639 min = exp->exp_min - 1;
7642 if (exp->exp_max < 0)
7645 max = exp->exp_max - 1;
7650 exp->exp_left->ref++;
7651 tmp2 = xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, exp->exp_left,
7665 if (!(IS_NILLABLE(exp)))
7701 tmp = xmlExpStringDeriveInt(ctxt, exp, tab[i]);
7741 * @exp: the englobing expression
7744 * Evaluates the expression resulting from @exp consuming a sub expression @sub
7753 xmlExpExpDerive(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) {
7754 if ((exp == NULL) || (ctxt == NULL) || (sub == NULL))
7760 if (IS_NILLABLE(sub) && (!IS_NILLABLE(exp))) {
7762 printf("Sub nillable and not exp : can't subsume\n");
7766 if (xmlExpCheckCard(exp, sub) == 0) {
7768 printf("sub generate longuer sequances than exp : can't subsume\n");
7772 return(xmlExpExpDeriveInt(ctxt, exp, sub));
7778 * @exp: the englobing expression
7781 * Check whether @exp accepts all the languages accexpted by @sub
7787 xmlExpSubsume(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) {
7790 if ((exp == NULL) || (ctxt == NULL) || (sub == NULL))
7795 * language of exp
7800 if (IS_NILLABLE(sub) && (!IS_NILLABLE(exp))) {
7802 printf("Sub nillable and not exp : can't subsume\n");
7806 if (xmlExpCheckCard(exp, sub) == 0) {
7808 printf("sub generate longuer sequances than exp : can't subsume\n");
7812 tmp = xmlExpExpDeriveInt(ctxt, exp, sub);