Regenerated documentation
This commit is contained in:
parent
18233ca0f5
commit
707f93d7a3
2 changed files with 42 additions and 11 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 (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
|
||||
(map #(compile-rule % true) (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]
|
||||
|
|
@ -3393,18 +3393,26 @@ front of the sequence of tokens it returns nil.</p>
|
|||
true
|
||||
(let [[left remainder] (parse-left-hand-side line)
|
||||
[right junk] (parse-right-hand-side remainder)]
|
||||
;; TODO: there shouldn't be any junk (should be null)
|
||||
(cond
|
||||
(and left right (nil? junk))
|
||||
;; there should be a valide left hand side and a valid right hand side
|
||||
;; there shouldn't be anything left over (junk should be empty)
|
||||
(and left right (empty? junk))
|
||||
(list 'fn ['cell 'world] (list 'if left right))))))</pre></td></tr><tr><td class="docs"><p>Parse this <code>rule-text</code>, a string conforming to the grammar of MicroWorld rules,
|
||||
into Clojure source, and then compile it into an anonymous
|
||||
function object, getting round the problem of binding mw-engine.utils in
|
||||
the compiling environment.</p>
|
||||
the compiling environment. If <code>return-tuple?</code> is present and true, return
|
||||
a list comprising the anonymous function compiled, and the function from
|
||||
which it was compiled.</p>
|
||||
|
||||
<p> Throws an exception if parsing fails.</p>
|
||||
</td><td class="codes"><pre class="brush: clojure">(defn compile-rule
|
||||
[rule-text]
|
||||
(do
|
||||
(use 'mw-engine.utils)
|
||||
(eval (parse-rule rule-text)))) </pre></td></tr><tr><td class="spacer docs"> </td><td class="codes" /></tr></table><div class="footer">Generated by <a href="https://github.com/fogus/marginalia">Marginalia</a>. Syntax highlighting provided by Alex Gorbatchev's <a href="http://alexgorbatchev.com/SyntaxHighlighter/">SyntaxHighlighter</a></div><script type="text/javascript">SyntaxHighlighter.defaults['gutter'] = false;
|
||||
([rule-text return-tuple?]
|
||||
(do
|
||||
(use 'mw-engine.utils)
|
||||
(let [afn (eval (parse-rule rule-text))]
|
||||
(cond
|
||||
(and afn return-tuple?)(list afn rule-text)
|
||||
true afn))))
|
||||
([rule-text]
|
||||
(compile-rule rule-text false)))</pre></td></tr><tr><td class="spacer docs"> </td><td class="codes" /></tr></table><div class="footer">Generated by <a href="https://github.com/fogus/marginalia">Marginalia</a>. Syntax highlighting provided by Alex Gorbatchev's <a href="http://alexgorbatchev.com/SyntaxHighlighter/">SyntaxHighlighter</a></div><script type="text/javascript">SyntaxHighlighter.defaults['gutter'] = false;
|
||||
SyntaxHighlighter.all()</script></body></html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue