(int r1, int r2)
| 180 | // Passing r2 == -1 indicates that the position is at the end of the text. |
| 181 | // TODO(adonovan): move to Machine. |
| 182 | static int emptyOpContext(int r1, int r2) { |
| 183 | int op = 0; |
| 184 | if (r1 < 0) { |
| 185 | op |= EMPTY_BEGIN_TEXT | EMPTY_BEGIN_LINE; |
| 186 | } |
| 187 | if (r1 == '\n') { |
| 188 | op |= EMPTY_BEGIN_LINE; |
| 189 | } |
| 190 | if (r2 < 0) { |
| 191 | op |= EMPTY_END_TEXT | EMPTY_END_LINE; |
| 192 | } |
| 193 | if (r2 == '\n') { |
| 194 | op |= EMPTY_END_LINE; |
| 195 | } |
| 196 | if (isWordRune(r1) != isWordRune(r2)) { |
| 197 | op |= EMPTY_WORD_BOUNDARY; |
| 198 | } else { |
| 199 | op |= EMPTY_NO_WORD_BOUNDARY; |
| 200 | } |
| 201 | return op; |
| 202 | } |
| 203 | |
| 204 | private Utils() {} // uninstantiable |
| 205 | } |
no test coverage detected