Lines Matching refs:tags

33   Algorithms to setup tags so that submatch addressing can be done.
143 /* Adds tags to appropriate locations in the parse tree in `tree', so that
153 /* True for first pass (counting number of needed tags) */
156 int num_tags = 0; /* Total number of tags. */
157 int num_minimals = 0; /* Number of special minimal tags. */
481 /* The next two tags are reserved for markers. */
584 /* Add tags after both children, the left child gets a smaller
588 tags which must be seen for every match of that child). */
632 DPRINT(("tre_add_tags: %s complete. Number of tags %d.\n",
909 /* Remove tags from all but the last copy. */
1094 int *tags, int assertions, int *params)
1101 for (num_tags = 0; tags != NULL && tags[num_tags] >= 0; num_tags++);
1117 if (set1[s1].tags == NULL && tags == NULL)
1118 new_set[s1].tags = NULL;
1121 for (i = 0; set1[s1].tags != NULL && set1[s1].tags[i] >= 0; i++);
1127 new_tags[j] = set1[s1].tags[j];
1129 new_tags[j + i] = tags[i];
1131 new_set[s1].tags = new_tags;
1162 if (set2[s2].tags == NULL)
1163 new_set[s1 + s2].tags = NULL;
1166 for (i = 0; set2[s2].tags[i] >= 0; i++);
1171 new_tags[j] = set2[s2].tags[j];
1173 new_set[s1 + s2].tags = new_tags;
1198 taken according to POSIX.2 rules, and adds the tags on that path to
1199 `tags'. `tags' may be NULL. If `num_tags_seen' is not NULL, it is
1200 set to the number of tags seen on the path. */
1202 tre_match_empty(tre_stack_t *stack, tre_ast_node_t *node, int *tags,
1234 if (tags != NULL)
1236 /* Add the tag to `tags'. */
1237 for (i = 0; tags[i] >= 0; i++)
1238 if (tags[i] == lit->code_max)
1240 if (tags[i] < 0)
1242 tags[i] = lit->code_max;
1243 tags[i + 1] = -1;
1455 int num_tags, *tags, assertions, params_seen;
1465 with tre_match_empty() to get the number of tags and
1472 /* Allocate arrays for the tags and parameters. */
1473 tags = xmalloc(sizeof(*tags) * (num_tags + 1));
1474 if (!tags)
1476 tags[0] = -1;
1485 xfree(tags);
1490 tags and parameters. */
1491 status = tre_match_empty(stack, cat->left, tags,
1495 xfree(tags);
1500 tags, assertions, params);
1501 xfree(tags);
1514 with tre_match_empty() to get the number of tags and
1521 /* Allocate arrays for the tags and parameters. */
1522 tags = xmalloc(sizeof(int) * (num_tags + 1));
1523 if (!tags)
1525 tags[0] = -1;
1534 xfree(tags);
1539 tags and parameters. */
1540 status = tre_match_empty(stack, cat->right, tags,
1544 xfree(tags);
1549 tags, assertions, params);
1550 xfree(tags);
1655 /* Find out how many tags this transition has. */
1657 if (p1->tags != NULL)
1658 while(p1->tags[i] >= 0)
1661 if (p2->tags != NULL)
1662 while(p2->tags[j] >= 0)
1666 if (trans->tags != NULL)
1667 xfree(trans->tags);
1668 trans->tags = NULL;
1670 /* If there were any tags, allocate an array and fill it. */
1673 trans->tags = xmalloc(sizeof(*trans->tags) * (i + j + 1));
1674 if (!trans->tags)
1677 if (p1->tags != NULL)
1678 while(p1->tags[i] >= 0)
1680 trans->tags[i] = p1->tags[i];
1685 if (p2->tags != NULL)
1686 while (p2->tags[j] >= 0)
1691 if (trans->tags[k] == p2->tags[j])
1697 trans->tags[l++] = p2->tags[j];
1700 trans->tags[l] = -1;
1731 int *tags;
1737 tags = trans->tags;
1738 if (tags)
1740 DPRINT((", tags ["));
1741 while (*tags >= 0)
1743 DPRINT(("%d", *tags));
1744 tags++;
1745 if (*tags >= 0)
1930 /* Set up tags for submatch addressing. If REG_NOSUB is set and the
1934 DPRINT(("tre_compile: setting up tags\n"));
1936 /* Figure out how many tags we will need. */
2093 int *tags;
2095 tags = p->tags;
2096 if (tags != NULL)
2098 if (*tags >= 0)
2100 while (*tags >= 0)
2102 DPRINT(("%d", *tags));
2103 tags++;
2104 if (*tags >= 0)
2131 initial[i].tags = NULL;
2132 /* Copy the arrays p->tags, and p->params, they are allocated
2134 if (p->tags)
2137 for (j = 0; p->tags[j] >= 0; j++);
2138 initial[i].tags = xmalloc(sizeof(*p->tags) * (j + 1));
2139 if (!initial[i].tags)
2141 memcpy(initial[i].tags, p->tags, sizeof(*p->tags) * (j + 1));
2203 if (tnfa->transitions[i].tags)
2204 xfree(tnfa->transitions[i].tags);
2217 if (trans->tags)
2218 xfree(trans->tags);