Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

.

  • Loading branch information...
commit 074a3d89831a9e282f19bc557abf7f9357600058 1 parent 8ba922c
@richard-lyman authored
Showing with 17 additions and 8 deletions.
  1. +17 −8 src/com/lithinos/amotoen/core.clj
View
25 src/com/lithinos/amotoen/core.clj
@@ -91,13 +91,16 @@
nil)))
(defn- peg-vec [n g w]
- (loop [remaining n
- result []]
- (if (empty? remaining)
- result
- (let [temp (pegasus (first remaining) g w)]
- (if temp (recur (rest remaining)
- (conj result temp)))))))
+ (let [p (gp w)]
+ (loop [remaining n
+ result []]
+ (if (empty? remaining)
+ result
+ (let [temp (pegasus (first remaining) g w)]
+ (if temp (recur (rest remaining)
+ (conj result temp))
+ (do (sp w p)
+ nil)))))))
(defn- p [w s n] (debug w s (pr-str n)))
@@ -126,7 +129,13 @@
(println "Pass")))
(dosync (ref-set *debug* false))))
-(defn self-check [] (validate grammar-grammar))
+(defn self-check []
+ (validate grammar-grammar)
+ (let [g {:S [(list '* (list '% (pegs "}}}"))) (pegs "}}}")]}
+ i "a}}b}}}"]
+ (when (not= '{:S [(\a \} \} \b) [\} \} \}]]} (pegasus :S g (gen-ps i)))
+ (throw (Error. "Failed Vectors are not resetting the pos."))))
+ )
; TODO
Please sign in to comment.
Something went wrong with that request. Please try again.