| 182 | // appendNegatedClass() append the negation of the class |x| to this |
| 183 | // CharClass. It assumes |x| is clean. Does not mutate |x|. |
| 184 | CharClass appendNegatedClass(int[] x) { |
| 185 | int nextLo = 0; |
| 186 | for (int i = 0; i < x.length; i += 2) { |
| 187 | int lo = x[i]; |
| 188 | int hi = x[i + 1]; |
| 189 | if (nextLo <= lo - 1) { |
| 190 | appendRange(nextLo, lo - 1); |
| 191 | } |
| 192 | nextLo = hi + 1; |
| 193 | } |
| 194 | if (nextLo <= Unicode.MAX_RUNE) { |
| 195 | appendRange(nextLo, Unicode.MAX_RUNE); |
| 196 | } |
| 197 | return this; |
| 198 | } |
| 199 | |
| 200 | // appendTable() appends the Unicode range table |table| to this CharClass. |
| 201 | // Does not mutate |table|. |