File: optionalpatterns.cc

package info (click to toggle)
flexc%2B%2B 2.17.01-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,180 kB
  • sloc: cpp: 6,467; makefile: 148; sh: 130; ansic: 18
file content (27 lines) | stat: -rw-r--r-- 767 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//#define XERR
#include "fpattern.ih"

FPattern FPattern::optionalFPatterns(States &states, FPattern &fpattern,
                                        size_t lower, size_t upper, 
                                        PairVector &beginEnd)
{
        // dup the remaining fpatterns, allowing for intermediate ejects
    Map eject;
    copyFPattern(states, lower, upper, eject, beginEnd);

        // add jumps to the end of the fpattern dupped last
    jumpToEnd(states, beginEnd, lower, upper, eject);

        // join all fpatterns, the first fpattern being `fpattern' (=semval)
    join(states, fpattern, upper, beginEnd);

        // begin/end must be updated to the final indices
    FPattern ret( {fpattern.begin(), fpattern.end()} );

    return ret;
}