update readline.rs version
This commit is contained in:
8
Cargo.lock
generated
8
Cargo.lock
generated
@@ -98,7 +98,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "readline-rs"
|
||||
version = "0.1.0"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
@@ -115,13 +116,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "scryer-prolog"
|
||||
version = "0.8.4"
|
||||
version = "0.8.5"
|
||||
dependencies = [
|
||||
"downcast 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ordered-float 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"prolog_parser 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"readline-rs 0.1.0",
|
||||
"readline-rs 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@@ -161,6 +162,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1"
|
||||
"checksum ordered-float 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7eb5259643245d3f292c7a146b2df53bba24d7eab159410e648eb73dc164669d"
|
||||
"checksum prolog_parser 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6da85e0cfa5a604edf65f753e629db37bfd04af93a09a1df5576d2197a2f7af3"
|
||||
"checksum readline-rs 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f35410ab92501753b66a269387df7a8162daeaf816f6528ba8b07b34f0d80c99"
|
||||
"checksum redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)" = "423e376fffca3dfa06c9e9790a9ccd282fafb3cc6e6397d01dbf64f9bacc6b85"
|
||||
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
|
||||
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "scryer-prolog"
|
||||
version = "0.8.5"
|
||||
version = "0.8.6"
|
||||
authors = ["Mark Thom <markjordanthom@gmail.com>"]
|
||||
repository = "https://github.com/mthom/scryer-prolog"
|
||||
description = "A modern Prolog implementation written mostly in Rust."
|
||||
@@ -11,7 +11,7 @@ downcast = "0.9.1"
|
||||
num = "0.2"
|
||||
ordered-float = "0.5.0"
|
||||
prolog_parser = "0.8.1"
|
||||
readline_rs = { package = "readline-rs", version = "0.1.0" }
|
||||
readline_rs = { package = "readline-rs", version = "0.1.2" }
|
||||
|
||||
[dependencies.termion]
|
||||
version = "1.4.0"
|
||||
@@ -24,7 +24,7 @@ fn prolog_repl() {
|
||||
|
||||
match toplevel_read_line() {
|
||||
Ok(Input::TermString(buffer)) => {
|
||||
let result = match string_to_toplevel(buffer, &mut wam) {
|
||||
let result = match string_to_toplevel(buffer.as_bytes(), &mut wam) {
|
||||
Ok(packet) => compile_term(&mut wam, packet),
|
||||
Err(e) => EvalSession::from(e)
|
||||
};
|
||||
|
||||
@@ -761,9 +761,9 @@ fn term_to_toplevel<'a, R>(term_stream: &mut TermStream<'a, R>, code_dir: &mut C
|
||||
}
|
||||
|
||||
pub
|
||||
fn string_to_toplevel(buffer: String, wam: &mut Machine) -> Result<TopLevelPacket, SessionError>
|
||||
fn string_to_toplevel<R: Read>(buffer: R, wam: &mut Machine) -> Result<TopLevelPacket, SessionError>
|
||||
{
|
||||
let mut term_stream = TermStream::new(buffer.as_bytes(), wam.indices.atom_tbl(),
|
||||
let mut term_stream = TermStream::new(buffer, wam.indices.atom_tbl(),
|
||||
wam.machine_flags(), &mut wam.indices,
|
||||
&mut wam.policies, &mut wam.code_repo);
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ pub enum Input {
|
||||
Quit,
|
||||
Clear,
|
||||
Batch,
|
||||
TermString(String)
|
||||
TermString(&'static str)
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
@@ -107,9 +107,9 @@ pub fn readline_initialize() {
|
||||
bind_keyseq_rl("\\C-d", bind_end_chord);
|
||||
}
|
||||
|
||||
pub fn read_line(prompt: &str) -> Result<String, SessionError> {
|
||||
pub fn read_line(prompt: &str) -> Result<&'static str, SessionError> {
|
||||
match readline_rl(prompt) {
|
||||
Some(input) => Ok(input.to_string()),
|
||||
Some(input) => Ok(input),
|
||||
None => Err(SessionError::UserPrompt)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ pub fn submit_query(wam: &mut Machine, buffer: &str, result: Vec<HashSet<String>
|
||||
{
|
||||
wam.reset();
|
||||
|
||||
match string_to_toplevel(String::from(buffer), wam) {
|
||||
match string_to_toplevel(buffer.as_bytes(), wam) {
|
||||
Ok(term) =>
|
||||
match compile_term(wam, term) {
|
||||
EvalSession::InitialQuerySuccess(alloc_locs, heap_locs) =>
|
||||
@@ -164,7 +164,7 @@ pub fn submit_query_without_results(wam: &mut Machine, buffer: &str) -> bool
|
||||
{
|
||||
wam.reset();
|
||||
|
||||
match string_to_toplevel(String::from(buffer), wam) {
|
||||
match string_to_toplevel(buffer.as_bytes(), wam) {
|
||||
Ok(term) =>
|
||||
match compile_term(wam, term) {
|
||||
EvalSession::InitialQuerySuccess(..)
|
||||
@@ -182,7 +182,7 @@ pub fn submit_query_with_limit(wam: &mut Machine, buffer: &str,
|
||||
{
|
||||
wam.reset();
|
||||
|
||||
match string_to_toplevel(String::from(buffer), wam) {
|
||||
match string_to_toplevel(buffer.as_bytes(), wam) {
|
||||
Ok(term) =>
|
||||
match compile_term(wam, term) {
|
||||
EvalSession::InitialQuerySuccess(alloc_locs, heap_locs) =>
|
||||
|
||||
Reference in New Issue
Block a user