1 using System;
 2 using System.Collections;
 3 
 4 // this file has been semiautomatically generated from 'D:/work/soulng-project/soulng/rex/Context.hpp' using cpp2cm version 1.0.0
 5 
 6 // this file has been semiautomatically generated from 'D:/work/soulng-project/soulng/rex/Context.cpp' using cpp2cm version 1.0.0
 7 
 8 namespace System.RegularExpressions
 9 {
10     public class Context
11     {
12         public Context() : 
13             any()epsilon(eps)
14         {
15         }
16         public ~Context()
17         {
18             for (NfaState* state : nfaStates)
19             {
20                 delete state;
21             }
22             for (Symbol* symbol : symbols)
23             {
24                 delete symbol;
25             }
26         }
27         public Symbol* MakeAny()
28         {
29             return &any;
30         }
31         public Symbol* MakeEpsilon()
32         {
33             return ε
34         }
35         public NfaState* MakeNfaState()
36         {
37             NfaState* state = new NfaState();
38             nfaStates.Add(state);
39             return state;
40         }
41         public Symbol* MakeChar(uchar c)
42         {
43             Map<ucharSymbol*>.ConstIterator it = charSymbols.CFind(c);
44             if (it != charSymbols.CEnd())
45             {
46                 return it->second;
47             }
48             else
49             {
50                 Symbol* symbol = new Char(c);
51                 symbols.Add(symbol);
52                 charSymbols[c] = symbol;
53                 return symbol;
54             }
55         }
56         public Symbol* MakeRange(uchar startuchar end)
57         {
58             Range range(startend);
59             Map<RangeSymbol*>.ConstIterator it = rangeSymbols.CFind(range);
60             if (it != rangeSymbols.CEnd())
61             {
62                 return it->second;
63             }
64             else
65             {
66                 Symbol* symbol = new Range(startend);
67                 symbols.Add(symbol);
68                 rangeSymbols[range] = symbol;
69                 return symbol;
70             }
71         }
72         public Class* MakeClass()
73         {
74             Class* cls = new Class();
75             symbols.Add(cls);
76             return cls;
77         }
78         private List<NfaState*> nfaStates;
79         private List<Symbol*> symbols;
80         private Any any;
81         private Char epsilon;
82         private Map<ucharSymbol*> charSymbols;
83         private Map<RangeSymbol*> rangeSymbols;
84     }
85 } // namespace System.RegularExpressions