 ; 1.a  (and move the special handling of zipping terminals up on :eof from default-handler to default-maker ?)
 ; 2. correctly handle clojure specificities : #{} #^ #"" ' ` @ #^ ^ #' #_ #() ~ ~@ foo# #!
 ; 3. correctly handle the premature :eof on non closed structures (a cause of error)
-; 4. correctly handle parsetree errors (wrong closing of bracket, ... TODO finish the exhaustive list)
+; 4. correctly handle parsetree errors (wrong closing of bracket (this one done), ... TODO finish the exhaustive list)
 ; 5. make the parser restartable
 ; 6. make the parser incremental 
 ; 7. refactor the code so that the handling of advancing offset, line, column ... is mutualized (be aware of not introducing regressions in the handling of atoms and spaces terminals)

(def *closing-brackets* (set (vals *brackets*)))
(def *spaces* #{\space \tab \newline \return})
(def *atoms* #{ \a \space})
      
(defn zip-one [#^String text offset line col parents parser-state accumulated-state]
  (let [level (-> accumulated-state peek (assoc :end-offset offset))
        parent-level (-> accumulated-state pop peek)
        brothers (get parent-level :content [])
        parent-level (assoc parent-level :content (conj brothers level))]


; bugs:
; \newlinb should be an error, not \n + symbol ewlinb

; miscellaneous TODO
; * add an explicit error message to :parser-state :ko (unbalanced parens)

(ns paredit.parser
	(:use clojure.test))
