Mercurial > pub > ImplabNet
comparison Implab/Automaton/DFATable.cs @ 178:d5c5db0335ee ref20160224
working on JSON parser
| author | cin |
|---|---|
| date | Wed, 23 Mar 2016 19:51:45 +0300 |
| parents | 0c3c69fe225b |
| children | c32688129f14 |
comparison
equal
deleted
inserted
replaced
| 177:a0ff6a0e9c44 | 178:d5c5db0335ee |
|---|---|
| 103 public int[,] CreateTransitionTable() { | 103 public int[,] CreateTransitionTable() { |
| 104 var table = new int[StateCount,AlphabetSize]; | 104 var table = new int[StateCount,AlphabetSize]; |
| 105 | 105 |
| 106 for (int i = 0; i < StateCount; i++) | 106 for (int i = 0; i < StateCount; i++) |
| 107 for (int j = 0; i < AlphabetSize; j++) | 107 for (int j = 0; i < AlphabetSize; j++) |
| 108 table[i, j] = DFAConst.UNREACHABLE_STATE; | 108 table[i, j] = AutomatonConst.UNREACHABLE_STATE; |
| 109 | 109 |
| 110 foreach (var t in this) | 110 foreach (var t in this) |
| 111 table[t.s1,t.edge] = t.s2; | 111 table[t.s1,t.edge] = t.s2; |
| 112 | 112 |
| 113 return table; | 113 return table; |
| 271 // специальное значение, тогда сохраним минимальный класс, | 271 // специальное значение, тогда сохраним минимальный класс, |
| 272 // содержащий этот символ на томже месте. | 272 // содержащий этот символ на томже месте. |
| 273 | 273 |
| 274 var nextCls = 0; | 274 var nextCls = 0; |
| 275 foreach (var item in minClasses) { | 275 foreach (var item in minClasses) { |
| 276 if (nextCls == DFAConst.UNCLASSIFIED_INPUT) | 276 if (nextCls == AutomatonConst.UNCLASSIFIED_INPUT) |
| 277 nextCls++; | 277 nextCls++; |
| 278 | 278 |
| 279 // сохраняем DFAConst.UNCLASSIFIED_INPUT | 279 // сохраняем DFAConst.UNCLASSIFIED_INPUT |
| 280 var cls = item.Contains(DFAConst.UNCLASSIFIED_INPUT) ? DFAConst.UNCLASSIFIED_INPUT : nextCls; | 280 var cls = item.Contains(AutomatonConst.UNCLASSIFIED_INPUT) ? AutomatonConst.UNCLASSIFIED_INPUT : nextCls; |
| 281 | 281 |
| 282 foreach (var a in item) | 282 foreach (var a in item) |
| 283 alphabetMap[a] = cls; | 283 alphabetMap[a] = cls; |
| 284 | 284 |
| 285 nextCls++; | 285 nextCls++; |
