[[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"
[[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)",
]
"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"
[package]
name = "scryer-prolog"
-version = "0.8.5"
+version = "0.8.6"
repository = "https://github.com/mthom/scryer-prolog"
description = "A modern Prolog implementation written mostly in Rust."
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"
\ No newline at end of file
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)
};
}
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);
Quit,
Clear,
Batch,
- TermString(String)
+ TermString(&'static str)
}
#[derive(Clone, Copy)]
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)
}
}
{
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) =>
{
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(..)
{
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) =>