And once you know where the bug is, fixing it is easy.
This commit is contained in:
parent
aad3cd6b58
commit
5141419efa
|
@ -23,15 +23,7 @@
|
||||||
rules: a rule tree (i.e. a recursively nested map token => rule-tree);
|
rules: a rule tree (i.e. a recursively nested map token => rule-tree);
|
||||||
path: a flat sequence of tokens."
|
path: a flat sequence of tokens."
|
||||||
[rules path]
|
[rules path]
|
||||||
(cond
|
(merge-rules rules (compose-rule path)))
|
||||||
;; if we have no more path, we're done.
|
|
||||||
(empty? path) nil
|
|
||||||
;; if we have no more rules, compose a rule from what's left of the path
|
|
||||||
(empty? rules) (compose-rule path)
|
|
||||||
;; replace in the rules the rule for the first of the path, with this new
|
|
||||||
;; rule generated from the rest of the path and the old rule for the first
|
|
||||||
;; of the path.
|
|
||||||
true (merge-rules rules (add-rule (rules (first path)) (rest path)))))
|
|
||||||
|
|
||||||
(defn analyse-tokens
|
(defn analyse-tokens
|
||||||
"Read this sequence of tokens and process it into rules.
|
"Read this sequence of tokens and process it into rules.
|
||||||
|
|
Loading…
Reference in a new issue