private Token num(String s) {
        int i = 0;
        boolean negative = false;
        if (s.charAt(0) == '-') {
            negative = true;
            s = s.substring(1);
        }
        if (Character.isDigit(s.charAt(i))) {

            while (i < s.length() && (Character.isDigit(s.charAt(i)) || s.charAt(i) == '.')) {
                i++;
            }
            double number = Double.parseDouble(s.substring(0, i));
            if (negative) {
                number = -number;
            }
            String restPart = s.substring(i);

            return new Token(new Const(number), restPart);
        } else {
            String var = "";
            while (i < s.length() && Character.isAlphabetic(s.charAt(i))) {
                var += s.charAt(i);
                i++;
            }
            if (negative) {
                return new Token(new Minus(new Const(0), new Variable(var)), s.substring(i));
            }
            return new Token(new Variable(var), s.substring(i));
        }
    }