Search the given character, If it was found, then mark the current cursor and the cursor point to next character.
(char c, Mark mark)
| 177 | * Search the given character, If it was found, then mark the current cursor and the cursor point to next character. |
| 178 | */ |
| 179 | private Boolean indexOf(char c, Mark mark) { |
| 180 | if (!hasMoreInput()) { |
| 181 | return null; |
| 182 | } |
| 183 | |
| 184 | int end = current.stream.length; |
| 185 | int ch; |
| 186 | int line = current.line; |
| 187 | int col = current.col; |
| 188 | int i = current.cursor; |
| 189 | for (; i < end; i++) { |
| 190 | ch = current.stream[i]; |
| 191 | |
| 192 | if (ch == c) { |
| 193 | mark.update(i, line, col); |
| 194 | } |
| 195 | if (ch == '\n') { |
| 196 | line++; |
| 197 | col = 0; |
| 198 | } else { |
| 199 | col++; |
| 200 | } |
| 201 | if (ch == c) { |
| 202 | current.update(i + 1, line, col); |
| 203 | return Boolean.TRUE; |
| 204 | } |
| 205 | } |
| 206 | current.update(i, line, col); |
| 207 | return Boolean.FALSE; |
| 208 | } |
| 209 | |
| 210 | /** |
| 211 | * Back up the current cursor by one char, assumes current.cursor > 0, and that the char to be pushed back is not |
no test coverage detected