Reads a number, writing JSON to the output.
| 85 | |
| 86 | // Reads a number, writing JSON to the output. |
| 87 | void parseNumber() { |
| 88 | // TODO: Handle hex numbers |
| 89 | // TODO: Handle Infinity and NaN |
| 90 | char c = get(); |
| 91 | if (c == '.') |
| 92 | _out << "0."; |
| 93 | else if (c != '+') |
| 94 | _out << c; |
| 95 | |
| 96 | while (true) { |
| 97 | // Remember, we don't have to validate that this is a correct JSON number; |
| 98 | // we just have to pass valid numbers through. |
| 99 | c = peek(); |
| 100 | if (isdigit(c) || c == '.' || c == 'e' || c == 'E' || c == '-' || c == '+') |
| 101 | _out << get(); |
| 102 | else |
| 103 | break; |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | // Reads a string, writing JSON to the output. |
| 108 | void parseString() { |
nothing calls this directly
no outgoing calls
no test coverage detected