private boolean isConstant(String token) throws Exception {
    	//check if character constant
        if ( token.startsWith("'")  ) {
            if (token.endsWith("'") && token.length()<=3) {
                return true;
            } else {
                throw new Exception("Wrong chacter constant!");
            }
        }
        
        //check if string constant
        if ( token.startsWith("\"")  ) {
            if (token.endsWith("\"") && !token.substring(1, token.length()-1).contains("\"")) {
                return true;
            } else {
                throw new Exception("Wrong string constant!");
            }
        }
        
        //Integer constant
        try {
            Integer.parseInt(token);
            return true;
        } catch (NumberFormatException exc) {
            return false;
        }
    }