File: append.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 (21 lines) | stat: -rw-r--r-- 492 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "charclass.ih"

void CharClass::append(vector<string> const &strings)
{
    for (auto &str: strings)
    {
        if (str[0] == 'p')
        {
            if (d_type.back().second != PREDEF)
               d_type.push_back({d_str.length(), PREDEF});
        }
        else
        {
            if (d_type.back().second != CHAR)
                d_type.push_back({d_str.length(), CHAR});
        }
        d_str.append(str.begin() + 1, str.end());   // add all but the 1st
    }
}