ztellman / automat

better automata through combinators

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Something about all-numerics strings causes failure (?)

eraserhd opened this issue · comments

The automata ["1"] won't accept the input "1":

avi.repl=> (a/advance (a/compile [:1]) nil :1 :error)
#automat.core.CompiledAutomatonState{:accepted? true, :checkpoint nil, :state-index 1, :start-index 0, :stream-index 1, :value nil}
avi.repl=> (a/advance (a/compile ["1"]) nil "1" :error)

ClassCastException java.lang.String cannot be cast to java.lang.Number  automat.stream/to-stream/reify--20992 (stream.clj:70)
avi.repl=> (a/advance (a/compile ["x1"]) nil "x1" :error)
#automat.core.CompiledAutomatonState{:accepted? true, :checkpoint nil, :state-index 1, :start-index 0, :stream-index 1, :value nil}
avi.repl=>

This is Clojure, not ClojureScript (it does seem like a JavaScript coersion, doesn't it?).

Just discovered that this works in 0.2.0-alpha2.