Almost working; rule editor doesn't save.
This commit is contained in:
parent
28da9555ba
commit
77cfb32bb2
7 changed files with 94 additions and 13 deletions
|
|
@ -3053,7 +3053,7 @@ objective is to parse rules out of a block of text from a textarea</p>
|
|||
function, and return the sequence of such functions.</p>
|
||||
</td><td class="codes"><pre class="brush: clojure">(defn compile-string
|
||||
[string]
|
||||
(map compile-rule (split string #"\n")))</pre></td></tr><tr><td class="docs"><p>Compile each non-comment line of the file indicated by this <code>filename</code> into
|
||||
(map compile-rule (remove comment? (split string #"\n"))))</pre></td></tr><tr><td class="docs"><p>Compile each non-comment line of the file indicated by this <code>filename</code> into
|
||||
an executable anonymous function, and return the sequence of such functions.</p>
|
||||
</td><td class="codes"><pre class="brush: clojure">(defn compile-file
|
||||
[filename]
|
||||
|
|
@ -3224,16 +3224,16 @@ front of the sequence of tokens it returns nil.</p>
|
|||
(= have-or-are "have")
|
||||
(let [[property comp1 comp2 value & remainder] rest]
|
||||
(cond (and (= comp1 "equal") (= comp2 "to"))
|
||||
(gen-neighbours-condition comparator quantity property value remainder =)
|
||||
(gen-neighbours-condition comparator quantity property value remainder '=)
|
||||
(and (= comp1 "more") (= comp2 "than"))
|
||||
(gen-neighbours-condition '> quantity property value remainder >)
|
||||
(gen-neighbours-condition '> quantity property value remainder '>)
|
||||
(and (= comp1 "less") (= comp2 "than"))
|
||||
(gen-neighbours-condition '< quantity property value remainder <)))))))</pre></td></tr><tr><td class="docs">
|
||||
(gen-neighbours-condition '< quantity property value remainder '<)))))))</pre></td></tr><tr><td class="docs">
|
||||
</td><td class="codes"><pre class="brush: clojure">(defn parse-some-neighbours-condition
|
||||
[[SOME NEIGHBOURS & rest]]
|
||||
(cond
|
||||
(and (= SOME "some") (= NEIGHBOURS "neighbours"))
|
||||
(parse-comparator-neighbours-condition (concat '("more" "than" "0" "neighbours") rest))))</pre></td></tr><tr><td class="docs"><p>Parse conditions of the form '...6 neighbours are condition'</p>
|
||||
(parse-comparator-neighbours-condition (concat '("more" "than" "0" "neighbours") rest))))</pre></td></tr><tr><td class="docs"><p>Parse conditions of the form '...6 neighbours are [condition]'</p>
|
||||
</td><td class="codes"><pre class="brush: clojure">(defn parse-simple-neighbours-condition
|
||||
[[n NEIGHBOURS have-or-are & rest]]
|
||||
(let [quantity (first (parse-numeric-value (list n)))]
|
||||
|
|
@ -3247,10 +3247,10 @@ front of the sequence of tokens it returns nil.</p>
|
|||
(let [[property comp1 comp2 value & remainder] rest]
|
||||
(cond (and (= comp1 "equal") (= comp2 "to"))
|
||||
(gen-neighbours-condition '= quantity property value remainder)
|
||||
;; (and (= comp1 "more") (= comp2 "than"))
|
||||
;; (gen-neighbours-condition '> quantity property value remainder)
|
||||
;; (and (= comp1 "less") (= comp2 "than"))
|
||||
;; (gen-neighbours-condition '< quantity property value remainder)))))))</pre></td></tr><tr><td class="docs"><p>Parse conditions referring to neighbours</p>
|
||||
(and (= comp1 "more") (= comp2 "than"))
|
||||
(gen-neighbours-condition '> quantity property value remainder '>)
|
||||
(and (= comp1 "less") (= comp2 "than"))
|
||||
(gen-neighbours-condition '< quantity property value remainder '<)))))))</pre></td></tr><tr><td class="docs"><p>Parse conditions referring to neighbours</p>
|
||||
</td><td class="codes"><pre class="brush: clojure">(defn parse-neighbours-condition
|
||||
[tokens]
|
||||
(or
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue