             (filter (fn [t] (not= nil (t input))) ;; get matching types
                     types))))
 
+(defn pattern-sequence-selector [tokens pattern-sequences]
+  (def alts (alternatives tokens pattern-sequences))
+  (if (> (count alts) 0)
+    (let [{expr :expr left-tokens :left-tokens} (first alts)]
+      {:expr (nnode :expression [expr]) :left-tokens left-tokens}) ;; return alternative
+    nil)) ;; no alternative match - return
+
 (defn pattern-sequence [tokens patterns collected]
   (let [pattern (first patterns)
         token (first tokens)]

        nil ;; pattern match failure - not enough tokens
        (if-let [node (pattern token)] ;; matched token
          (pattern-sequence (rest tokens) (rest patterns) (conj collected node)) ;; round again
          nil))))) ;; pattern match failure - return

;; only one token, for now
(defn pattern [input matcher tag & args]

  (:use [isla.lexer])
  (:require [clojure.string :as str]))

(declare parse alternatives is-type pattern-sequence pattern nnode pattern-sequence-selector
         -root -block -expression -assignment -invocation
         -nl -integer -is -string -assignee -value -identifier)

