private int readNumberToken(char current, int offset, String formula, List<Token> parts) {
        int end = offset + 1;
        boolean pointSeen = current == '.';

        while (end < formula.length()) {
            char next = formula.charAt(end);
            if (Character.isDigit(next)) {
                end++;
            } else if (next == '.' && !pointSeen) {
                pointSeen = true;
                end++;
            } else {
                break;
            }
        }
        BigDecimal result = null;
        try {
            result = new BigDecimal(formula.substring(offset, end));
        } catch (NumberFormatException ex) {
            throw new ParseException("Couldn't tokenize number " + formula.substring(offset, end), ex);
        }
        parts.add(new NumberToken(result));
        return end;
    }