()
| 157 | } |
| 158 | |
| 159 | private void parse() { |
| 160 | index = 0; // position internal index at start |
| 161 | |
| 162 | if (size == 0) // empty line |
| 163 | return; |
| 164 | if (buffer[index] == '+') { // Continuation statement |
| 165 | type |= CONTINUATION; |
| 166 | index += 1; // Position beyond the '+' |
| 167 | return; // return |
| 168 | } else if (buffer[index] == '*') { // Untagged statement |
| 169 | type |= UNTAGGED; |
| 170 | index += 1; // Position beyond the '*' |
| 171 | } else { // Tagged statement |
| 172 | type |= TAGGED; |
| 173 | tag = readAtom(); // read the TAG, index positioned beyond tag |
| 174 | if (tag == null) |
| 175 | tag = ""; // avoid possible NPE |
| 176 | } |
| 177 | |
| 178 | int mark = index; // mark |
| 179 | String s = readAtom(); // updates index |
| 180 | if (s == null) |
| 181 | s = ""; // avoid possible NPE |
| 182 | if (s.equalsIgnoreCase("OK")) |
| 183 | type |= OK; |
| 184 | else if (s.equalsIgnoreCase("NO")) |
| 185 | type |= NO; |
| 186 | else if (s.equalsIgnoreCase("BAD")) |
| 187 | type |= BAD; |
| 188 | else if (s.equalsIgnoreCase("BYE")) |
| 189 | type |= BYE; |
| 190 | else |
| 191 | index = mark; // reset |
| 192 | |
| 193 | pindex = index; |
| 194 | return; |
| 195 | } |
| 196 | |
| 197 | public void skipSpaces() { |
| 198 | while (index < size && buffer[index] == ' ') |
no test coverage detected