private String consumeNumber() throws JsonException {
        StringBuilder partial = new StringBuilder();

        while (textIx < textLen) {
            char character = text.charAt(textIx);
            if (Character.isDigit(character)
                    || character == '.'
                    || character == '+'
                    || character == '-'
                    || character == 'e'
                    || character == 'E') {
                partial.append(character);
                advanceTextCursor();
            } else {
                break;
            }
        }

        String result = partial.toString();

        try {
            Double.parseDouble(result);
        } catch (NumberFormatException e) {
            throw new JsonException("Misformatted number", lineNum, colNum);
        }

        return result;
    }