 (ns paredit.loc-utils
   (:require [clojure.zip :as zip])
   (:require [clojure.contrib.zip-filter :as zf]))
+
+(defn loc-text [loc]
+  (apply str (map zip/node 
+               (filter (comp string? zip/node) (zf/descendants loc)))))
+
+(defn loc-count [loc]
+  (.length ^String (loc-text loc)))
 
 (defn ^String loc-tag [loc]
   (and loc 

      (string? (zip/node loc))
        (if (.contains (zip/node loc) "\n")
          (+ col (dec (-> (zip/node loc) (.substring (.lastIndexOf (zip/node loc) "\n")) .length)))
          (recur (zip/prev loc) (+ col (.length (zip/node loc)))))
      :else
        (recur (zip/prev loc) col))))

(defn loc-count [loc]
  (.length ^String (loc-text loc)))
    
  
(defn loc-parse-node [loc] ; wrong name, and also, will return (foo) if located at ( or at ) ... so definitely wrong name ...
  (if (string? (zip/node loc))

      (-> loc zip/node :offset)))

(defn end-offset [loc]
  (+ (start-offset loc) (loc-count loc)))

(defn loc-col [loc]
  (loop [loc (zip/prev loc) col 0]
