Branch data Line data Source code
1 : : // $Id: CCL.cc 6219 2008-10-01 05:39:07Z vern $
2 : : //
3 : : // See the file "COPYING" in the main distribution directory for copyright.
4 : :
5 : : #include "config.h"
6 : :
7 : : #include "CCL.h"
8 : : #include "RE.h"
9 : : #include "DFA.h"
10 : :
11 : 1069 : CCL::CCL()
12 : : {
13 : 1069 : syms = new int_list;
14 : 1069 : index = -(rem->InsertCCL(this) + 1);
15 : 1069 : negated = 0;
16 : 1069 : }
17 : :
18 : 44 : CCL::~CCL()
19 : : {
20 [ + - ][ # # ]: 44 : delete syms;
21 : 44 : }
22 : :
23 : 327 : void CCL::Negate()
24 : : {
25 : 327 : negated = 1;
26 : 327 : Add(SYM_BOL);
27 : 327 : Add(SYM_EOL);
28 : 327 : }
29 : :
30 : 6673 : void CCL::Add(int sym)
31 : : {
32 : 6673 : ptr_compat_int sym_p = ptr_compat_int(sym);
33 : :
34 : : // Check to see if the character is already in the ccl.
35 [ + + ]: 131290 : for ( int i = 0; i < syms->length(); ++i )
36 [ + + ]: 124619 : if ( (*syms)[i] == sym_p )
37 : 2 : return;
38 : :
39 : 6673 : syms->append(sym_p);
40 : : }
41 : :
42 : 764 : void CCL::Sort()
43 : : {
44 : 764 : syms->sort(int_list_cmp);
45 [ + - ][ + - ]: 770 : }
|