                (.file parser))] ; "file" is the start rule of the grammar
     (do
       (.walk (ParseTreeWalker.) (listener parser) tree))))
+

(ns org.mobileink.antlr
  (:import [org.mobileink.antlr ClojureLexer ClojureParser ClojureBaseListener]
           [org.antlr.v4.runtime ANTLRInputStream ANTLRFileStream CommonTokenStream]
           [org.antlr.v4.runtime.tree ParseTree ParseTreeWalker]))

;; see also http://www.nickpascucci.com/blog/2014/03/01/using-antlr-from-clojure/

(defn- listener [parser]
    (proxy [ClojureBaseListener] []

    (do
      (.walk (ParseTreeWalker.) (listener parser) tree))))

(defn listen-file [file]
  "Parse file 'file and crawl it using a passive strategy"
  (print (format "parsing %s\n" file))
  (let [input (do ;;(println "getting stream")
                ;; use ANTLRInputStream to read from a string buffer
