mw-parser/docs/codox/mw-parser.declarative.html

14 lines
7.8 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>mw-parser.declarative documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Mw-parser</span> <span class="project-version">0.2.0-SNAPSHOT</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="intro.html"><div class="inner"><span>Introduction to mw-parser</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>mw-parser</span></div></div></li><li class="depth-2 branch"><a href="mw-parser.bulk.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>bulk</span></div></a></li><li class="depth-2 branch"><a href="mw-parser.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2 branch current"><a href="mw-parser.declarative.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>declarative</span></div></a></li><li class="depth-2 branch"><a href="mw-parser.errors.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>errors</span></div></a></li><li class="depth-2 branch"><a href="mw-parser.flow.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>flow</span></div></a></li><li class="depth-2 branch"><a href="mw-parser.generate.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>generate</span></div></a></li><li class="depth-2 branch"><a href="mw-parser.simplify.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>simplify</span></div></a></li><li class="depth-2"><a href="mw-parser.utils.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>utils</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="mw-parser.declarative.html#var-build-parser"><div class="inner"><span>build-parser</span></div></a></li><li class="depth-1"><a href="mw-parser.declarative.html#var-common-grammar"><div class="inner"><span>common-grammar</span></div></a></li><li class="depth-1"><a href="mw-parser.declarative.html#var-compile-rule"><div class="inner"><span>compile-rule</span></div></a></li><li class="depth-1"><a href="mw-parser.declarative.html#var-keywords-en"><div class="inner"><span>keywords-en</span></div></a></li><li class="depth-1"><a href="mw-parser.declarative.html#var-keywords-for-locale"><div class="inner"><span>keywords-for-locale</span></div></a></li><li class="depth-1"><a href="mw-parser.declarative.html#var-parse-rule"><div class="inner"><span>parse-rule</span></div></a></li><li class="depth-1"><a href="mw-parser.declarative.html#var-rule-grammar"><div class="inner"><span>rule-grammar</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">mw-parser.declarative</h1><div class="doc"><div class="markdown"><p>A very simple parser which parses production rules.</p>
</div></div><div class="public anchor" id="var-build-parser"><h3>build-parser</h3><h4 class="type">macro</h4><div class="usage"><code>(build-parser g)</code></div><div class="doc"><div class="markdown"><p>Compose this grammar fragment <code>g</code> with the common grammar fragments to make a complete grammar, and return a parser for that complete grammar.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-parser/blob/master/src/mw_parser/declarative.clj#L125">view source</a></div></div><div class="public anchor" id="var-common-grammar"><h3>common-grammar</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>Grammar rules used both in the rule grammar and in the flow grammar</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-parser/blob/master/src/mw_parser/declarative.clj#L47">view source</a></div></div><div class="public anchor" id="var-compile-rule"><h3>compile-rule</h3><div class="usage"><code>(compile-rule rule-text return-tuple?)</code><code>(compile-rule rule-text)</code></div><div class="doc"><div class="markdown"><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. 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>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-parser/blob/master/src/mw_parser/declarative.clj#L135">view source</a></div></div><div class="public anchor" id="var-keywords-en"><h3>keywords-en</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>English language keyword literals used in rules - both in production rules (this namespace) and in flow rules (see mw-parser.flow).</p>
<p>Its a long term aim that the rule language should be easy to internationalise; this isnt a full solution but its a step towards a solution.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-parser/blob/master/src/mw_parser/declarative.clj#L77">view source</a></div></div><div class="public anchor" id="var-keywords-for-locale"><h3>keywords-for-locale</h3><div class="usage"><code>(keywords-for-locale)</code><code>(keywords-for-locale _locale)</code></div><div class="doc"><div class="markdown"><p>For now, just return <code>keywords-en</code>; plan is to have resource files of keywords for different languages in a resource directory, but that isnt done yet. Its probably not going to work easily for languages that use non-latin alphabets, anyway.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-parser/blob/master/src/mw_parser/declarative.clj#L115">view source</a></div></div><div class="public anchor" id="var-parse-rule"><h3>parse-rule</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>Parse the argument, assumed to be a string in the correct syntax, and return a parse tree.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-parser/blob/master/src/mw_parser/declarative.clj#L131">view source</a></div></div><div class="public anchor" id="var-rule-grammar"><h3>rule-grammar</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>Basic rule language grammar.</p>
<p>in order to simplify translation into other natural languages, all TOKENS within the parser should be unambiguou.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-parser/blob/master/src/mw_parser/declarative.clj#L36">view source</a></div></div></div></body></html>