Lines Matching defs:exp

6744  * @exp: the expression
6749 xmlExpFree(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp) {
6750 if ((exp == NULL) || (exp == forbiddenExp) || (exp == emptyExp))
6752 exp->ref--;
6753 if (exp->ref == 0) {
6757 key = exp->key % ctxt->size;
6758 if (ctxt->table[key] == exp) {
6759 ctxt->table[key] = exp->next;
6765 if (tmp->next == exp) {
6766 tmp->next = exp->next;
6773 if ((exp->type == XML_EXP_SEQ) || (exp->type == XML_EXP_OR)) {
6774 xmlExpFree(ctxt, exp->exp_left);
6775 xmlExpFree(ctxt, exp->exp_right);
6776 } else if (exp->type == XML_EXP_COUNT) {
6777 xmlExpFree(ctxt, exp->exp_left);
6779 xmlFree(exp);
6786 * @exp: the expression
6791 xmlExpRef(xmlExpNodePtr exp) {
6792 if (exp != NULL)
6793 exp->ref++;
6900 xmlExpGetLanguageInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp,
6904 switch (exp->type) {
6909 if (list[tmp] == exp->exp_str)
6913 list[nb++] = exp->exp_str;
6916 exp = exp->exp_left;
6920 tmp = xmlExpGetLanguageInt(ctxt, exp->exp_left, list, len, nb);
6923 tmp2 = xmlExpGetLanguageInt(ctxt, exp->exp_right, list, len,
6935 * @exp: the expression
6939 * Find all the strings used in @exp and store them in @list
6945 xmlExpGetLanguage(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp,
6947 if ((ctxt == NULL) || (exp == NULL) || (langList == NULL) || (len <= 0))
6949 return(xmlExpGetLanguageInt(ctxt, exp, langList, len, 0));
6953 xmlExpGetStartInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp,
6957 switch (exp->type) {
6964 if (list[tmp] == exp->exp_str)
6968 list[nb++] = exp->exp_str;
6971 exp = exp->exp_left;
6974 tmp = xmlExpGetStartInt(ctxt, exp->exp_left, list, len, nb);
6977 if (IS_NILLABLE(exp->exp_left)) {
6978 tmp2 = xmlExpGetStartInt(ctxt, exp->exp_right, list, len,
6986 tmp = xmlExpGetStartInt(ctxt, exp->exp_left, list, len, nb);
6989 tmp2 = xmlExpGetStartInt(ctxt, exp->exp_right, list, len,
7001 * @exp: the expression
7006 * accepted by @exp and store them in @list. E.g. for (a, b) | c
7013 xmlExpGetStart(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp,
7015 if ((ctxt == NULL) || (exp == NULL) || (tokList == NULL) || (len <= 0))
7017 return(xmlExpGetStartInt(ctxt, exp, tokList, len, 0));
7022 * @exp: the expression
7029 xmlExpIsNillable(xmlExpNodePtr exp) {
7030 if (exp == NULL)
7032 return(IS_NILLABLE(exp) != 0);
7036 xmlExpStringDeriveInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, const xmlChar *str)
7040 switch (exp->type) {
7046 if (exp->exp_str == str) {
7065 tmp = xmlExpStringDeriveInt(ctxt, exp->exp_left, str);
7069 ret = xmlExpStringDeriveInt(ctxt, exp->exp_right, str);
7082 ret = xmlExpStringDeriveInt(ctxt, exp->exp_left, str);
7086 if (IS_NILLABLE(exp->exp_left)) {
7090 ret = xmlExpStringDeriveInt(ctxt, exp->exp_right, str);
7096 exp->exp_right->ref++;
7097 ret = xmlExpHashGetEntry(ctxt, XML_EXP_SEQ, ret, exp->exp_right,
7105 if (exp->exp_max == 0)
7107 ret = xmlExpStringDeriveInt(ctxt, exp->exp_left, str);
7116 if (exp->exp_max == 1)
7118 if (exp->exp_max < 0) /* unbounded */
7121 max = exp->exp_max - 1;
7122 if (exp->exp_min > 0)
7123 min = exp->exp_min - 1;
7126 exp->exp_left->ref++;
7127 tmp = xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, exp->exp_left, NULL,
7148 * @exp: the expression
7152 * Do one step of Brzozowski derivation of the expression @exp with
7158 xmlExpStringDerive(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp,
7162 if ((exp == NULL) || (ctxt == NULL) || (str == NULL)) {
7173 return(xmlExpStringDeriveInt(ctxt, exp, input));
7177 xmlExpCheckCard(xmlExpNodePtr exp, xmlExpNodePtr sub) {
7181 if (exp->c_max != -1)
7183 } else if ((exp->c_max >= 0) && (exp->c_max < sub->c_max)) {
7187 if ((IS_NILLABLE(sub)) && (!IS_NILLABLE(exp)))
7193 static xmlExpNodePtr xmlExpExpDeriveInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp,
7198 * @exp: the englobing expression
7203 * Check if exp is a multiple of sub, i.e. if there is a finite number n
7204 * so that sub{n} subsume exp
7211 xmlExpDivide(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub,
7218 if (exp->c_max == -1) return(0);
7219 if (IS_NILLABLE(exp) && (!IS_NILLABLE(sub))) return(0);
7221 for (i = 1;i <= exp->c_max;i++) {
7228 if (!xmlExpCheckCard(tmp, exp)) {
7232 tmp2 = xmlExpExpDeriveInt(ctxt, tmp, exp);
7263 * @exp: the englobing expression
7272 xmlExpExpDeriveInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) {
7281 if ((exp == sub) && (exp->c_max >= 0)) {
7283 printf("Equal(exp, sub) and finite -> Empty\n");
7294 exp->ref++;
7295 return(exp);
7301 tmp = xmlExpExpDeriveInt(ctxt, exp, sub->exp_left);
7314 tmp = xmlExpExpDeriveInt(ctxt, exp, sub->exp_left);
7319 ret = xmlExpExpDeriveInt(ctxt, exp, sub->exp_right);
7326 if (!xmlExpCheckCard(exp, sub)) {
7328 printf("CheckCard(exp, sub) failed -> Forbid\n");
7332 switch (exp->type) {
7337 printf("Empty(exp) -> Forbid\n");
7342 printf("Forbid(exp) -> Forbid\n");
7348 if (exp->exp_str == sub->exp_str) {
7363 if (exp->exp_str == sub->exp_left->exp_str) {
7375 printf("Compex exp vs Atom -> Forbid\n");
7380 if (xmlExpCheckCard(exp->exp_left, sub)) {
7385 ret = xmlExpExpDeriveInt(ctxt, exp->exp_left, sub);
7392 * i.e. we won't get to a nillable exp left
7397 exp->exp_right->ref++;
7399 exp->exp_right, NULL, 0, 0));
7413 ret = xmlExpExpDeriveInt(ctxt, exp->exp_left, sub->exp_left);
7428 exp->exp_right->ref++;
7430 exp->exp_right, NULL, 0, 0);
7453 ret = xmlExpExpDeriveInt(ctxt, exp->exp_left, sub);
7456 tmp = xmlExpExpDeriveInt(ctxt, exp->exp_right, sub);
7469 tmp = xmlExpExpDeriveInt(ctxt, exp->exp_left, sub->exp_left);
7478 mult = xmlExpDivide(ctxt, sub->exp_left, exp->exp_left,
7488 if (exp->exp_max == -1) {
7489 if (exp->exp_min <= sub->exp_min * mult)
7492 min = exp->exp_min - sub->exp_min * mult;
7501 if (exp->exp_max == -1) {
7505 if (exp->exp_min > sub->exp_min * mult) {
7507 min = exp->exp_min - sub->exp_min * mult;
7513 if (exp->exp_max < sub->exp_max * mult) {
7520 if (sub->exp_max * mult > exp->exp_min)
7523 min = exp->exp_min - sub->exp_max * mult;
7524 max = exp->exp_max - sub->exp_max * mult;
7538 if (exp->exp_max == -1) {
7539 if (exp->exp_min <= sub->exp_min) {
7550 min = exp->exp_min - sub->exp_min;
7552 } else if (exp->exp_min > sub->exp_min) {
7563 if (exp->exp_max == -1) {
7567 if (exp->exp_min > sub->exp_min) {
7569 min = exp->exp_min - sub->exp_min;
7575 if (exp->exp_max < sub->exp_max) {
7582 if (sub->exp_max > exp->exp_min)
7585 min = exp->exp_min - sub->exp_max;
7586 max = exp->exp_max - sub->exp_max;
7592 exp->exp_left->ref++;
7593 tmp2 = xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, exp->exp_left,
7602 tmp = xmlExpExpDeriveInt(ctxt, exp->exp_left, sub);
7611 if (exp->exp_min > 0)
7612 min = exp->exp_min - 1;
7615 if (exp->exp_max < 0)
7618 max = exp->exp_max - 1;
7623 exp->exp_left->ref++;
7624 tmp2 = xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, exp->exp_left,
7638 if (!(IS_NILLABLE(exp)))
7674 tmp = xmlExpStringDeriveInt(ctxt, exp, tab[i]);
7714 * @exp: the englobing expression
7717 * Evaluates the expression resulting from @exp consuming a sub expression @sub
7726 xmlExpExpDerive(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) {
7727 if ((exp == NULL) || (ctxt == NULL) || (sub == NULL))
7733 if (IS_NILLABLE(sub) && (!IS_NILLABLE(exp))) {
7735 printf("Sub nillable and not exp : can't subsume\n");
7739 if (xmlExpCheckCard(exp, sub) == 0) {
7741 printf("sub generate longuer sequances than exp : can't subsume\n");
7745 return(xmlExpExpDeriveInt(ctxt, exp, sub));
7751 * @exp: the englobing expression
7754 * Check whether @exp accepts all the languages accexpted by @sub
7760 xmlExpSubsume(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) {
7763 if ((exp == NULL) || (ctxt == NULL) || (sub == NULL))
7768 * language of exp
7773 if (IS_NILLABLE(sub) && (!IS_NILLABLE(exp))) {
7775 printf("Sub nillable and not exp : can't subsume\n");
7779 if (xmlExpCheckCard(exp, sub) == 0) {
7781 printf("sub generate longuer sequances than exp : can't subsume\n");
7785 tmp = xmlExpExpDeriveInt(ctxt, exp, sub);