~vcs-imports/gawk/master

« back to all changes in this revision

Viewing changes to support/dfa.c

  • Committer: Arnold D. Robbins
  • Date: 2020-09-18 10:04:27 UTC
  • Revision ID: git-v1:154592f9db7af78cfa31ad6d64134ca89eed13b0
Update support files from GNULIB.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2505
2505
                          : NULL);
2506
2506
 
2507
2507
  for (idx_t i = 0; i < d->tindex; i++)
2508
 
    for (idx_t j = 0; j < d->follows[i].nelem; j++)
2509
 
      if (map[d->follows[i].elems[j].index] < 0)
2510
 
        map[d->follows[i].elems[j].index] = nleaves++;
2511
 
 
2512
 
  for (idx_t i = 0; i < d->tindex; i++)
2513
2508
    {
2514
2509
      if (map[i] < 0)
2515
2510
        {
2527
2522
        multibyte_prop[map[i]] = d->multibyte_prop[i];
2528
2523
 
2529
2524
      for (idx_t j = 0; j < d->follows[i].nelem; j++)
2530
 
        d->follows[i].elems[j].index = map[d->follows[i].elems[j].index];
 
2525
        {
 
2526
          if (map[d->follows[i].elems[j].index] == -1)
 
2527
            map[d->follows[i].elems[j].index] = nleaves++;
 
2528
 
 
2529
          d->follows[i].elems[j].index = map[d->follows[i].elems[j].index];
 
2530
        }
2531
2531
 
2532
2532
      qsort (d->follows[i].elems, d->follows[i].nelem,
2533
2533
             sizeof *d->follows[i].elems, compare);
2700
2700
 
2701
2701
        case STAR:
2702
2702
        case PLUS:
 
2703
          /* Every element in the lastpos of the argument is in the backward
 
2704
             set of every element in the firstpos.  */
 
2705
          if (d->epsilon)
 
2706
            {
 
2707
              tmp.elems = lastpos - stk[-1].nlastpos;
 
2708
              tmp.nelem = stk[-1].nlastpos;
 
2709
              for (position *p = firstpos - stk[-1].nfirstpos;
 
2710
                   p < firstpos; p++)
 
2711
                merge2 (&backward[p->index], &tmp, &merged);
 
2712
            }
 
2713
 
2703
2714
          /* Every element in the firstpos of the argument is in the follow
2704
2715
             of every element in the lastpos.  */
2705
2716
          {