16 lines
8.7 KiB
HTML
16 lines
8.7 KiB
HTML
<!DOCTYPE html PUBLIC ""
|
||
"">
|
||
<html><head><meta charset="UTF-8" /><title>beowulf.reader.char-reader documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><link rel="icon" type="image/x-icon" href="../img/beowulf_logo_favicon.png" /></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">Beowulf</span> <span class="project-version">0.3.1-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="further_reading.html"><div class="inner"><span>Further Reading</span></div></a></li><li class="depth-1 "><a href="intro.html"><div class="inner"><span>beowulf</span></div></a></li><li class="depth-1 "><a href="mexpr.html"><div class="inner"><span>Interpreting M-Expressions</span></div></a></li><li class="depth-1 "><a href="values.html"><div class="inner"><span>The properties of the system, and their values</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>beowulf</span></div></div></li><li class="depth-2 branch"><a href="beowulf.bootstrap.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>bootstrap</span></div></a></li><li class="depth-2 branch"><a href="beowulf.cons-cell.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>cons-cell</span></div></a></li><li class="depth-2 branch"><a href="beowulf.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"><a href="beowulf.gendoc.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>gendoc</span></div></a></li><li class="depth-2 branch"><a href="beowulf.host.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>host</span></div></a></li><li class="depth-2 branch"><a href="beowulf.interop.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>interop</span></div></a></li><li class="depth-2 branch"><a href="beowulf.io.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>io</span></div></a></li><li class="depth-2 branch"><a href="beowulf.manual.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>manual</span></div></a></li><li class="depth-2 branch"><a href="beowulf.oblist.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>oblist</span></div></a></li><li class="depth-2 branch"><a href="beowulf.read.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>read</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>reader</span></div></div></li><li class="depth-3 branch current"><a href="beowulf.reader.char-reader.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>char-reader</span></div></a></li><li class="depth-3 branch"><a href="beowulf.reader.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-3 branch"><a href="beowulf.reader.macros.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>macros</span></div></a></li><li class="depth-3 branch"><a href="beowulf.reader.parser.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>parser</span></div></a></li><li class="depth-3"><a href="beowulf.reader.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="beowulf.scratch.html"><div class="inner"><span class="tree" style="top: -176px;"><span class="top" style="height: 185px;"></span><span class="bottom"></span></span><span>scratch</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="beowulf.reader.char-reader.html#var-build-completer"><div class="inner"><span>build-completer</span></div></a></li><li class="depth-1"><a href="beowulf.reader.char-reader.html#var-get-reader"><div class="inner"><span>get-reader</span></div></a></li><li class="depth-1"><a href="beowulf.reader.char-reader.html#var-read-chars"><div class="inner"><span>read-chars</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">beowulf.reader.char-reader</h1><div class="doc"><div class="markdown"><p>Provide sensible line editing, auto completion, and history recall.</p>
|
||
<p>None of what’s needed here is really working yet, and a pull request with a working implementation would be greatly welcomed.</p>
|
||
<h2><a href="#whats-needed-rough-specification-" name="whats-needed-rough-specification-"></a>What’s needed (rough specification)</h2>
|
||
<ol>
|
||
<li>Carriage return <strong>does not</strong> cause input to be returned, <strong>unless</strong> a. the number of open brackets <code>(</code> and closing brackets <code>)</code> match; and b. the number of open square brackets <code>[</code> and closing square brackets <code>]</code> also match;</li>
|
||
<li><ctrl-d> aborts editing and returns the string <code>STOP</code>;</ctrl-d></li>
|
||
<li><up-arrow> and <down-arrow> scroll back and forward through history, but ideally I’d like this to be the Lisp history (i.e. the history of S-Expressions actually read by <code>READ</code>, rather than the strings which were supplied to <code>READ</code>);</down-arrow></up-arrow></li>
|
||
<li><tab> offers potential auto-completions taken from the value of <code>(OBLIST)</code>, ideally the current value, not the value at the time the session started;</tab></li>
|
||
<li><back-arrow> and <forward-arrow> offer movement and editing within the line.</forward-arrow></back-arrow></li>
|
||
</ol>
|
||
<p>TODO: There are multiple problems with JLine; a better solution might be to start from here: <a href="https://stackoverflow.com/questions/7931988/how-to-manipulate-control-characters">https://stackoverflow.com/questions/7931988/how-to-manipulate-control-characters</a></p></div></div><div class="public anchor" id="var-build-completer"><h3>build-completer</h3><div class="usage"><code>(build-completer)</code></div><div class="doc"><div class="markdown"><p>Build a completer which takes tokens from the oblist.</p>
|
||
<p>This is sort-of working, in as much as hitting <tab> on a blank line will show a table of values from the oblist, but hitting <tab> after you’ve started input does not show potential completions for tokens you’ve started.</tab></tab></p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/beowulf/blob/master/src/beowulf/reader/char_reader.clj#L54">view source</a></div></div><div class="public anchor" id="var-get-reader"><h3>get-reader</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>Return a reader, first constructing it if necessary.</p>
|
||
<p><strong>NOTE THAT</strong> this is not settled API. The existence and call signature of this function is not guaranteed in future versions.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/beowulf/blob/master/src/beowulf/reader/char_reader.clj#L74">view source</a></div></div><div class="public anchor" id="var-read-chars"><h3>read-chars</h3><div class="usage"><code>(read-chars)</code></div><div class="doc"><div class="markdown"><p>A drop-in replacement for <code>clojure.core/read-line</code>, except that line editing and history should be enabled.</p>
|
||
<p><strong>NOTE THAT</strong> this does not fully work yet, but it is in the API because I hope that it will work later!</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/beowulf/blob/master/src/beowulf/reader/char_reader.clj#L92">view source</a></div></div></div></body></html> |