]> Repositorios git - scryer-prolog.git/commitdiff
update readline.rs version
authorMark Thom <[email protected]>
Sun, 17 Mar 2019 21:22:31 +0000 (15:22 -0600)
committerMark Thom <[email protected]>
Sun, 17 Mar 2019 21:22:31 +0000 (15:22 -0600)
Cargo.lock
Cargo.toml
src/main.rs
src/prolog/machine/toplevel.rs
src/prolog/read.rs
src/tests.rs

index 0b9198dd04deb2f3d03c6be84b47b08d6ce28d43..d2740a48e47976accaf022cb4d6676ed7560ba3c 100644 (file)
@@ -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"
index 572996cef427f3a9df982588ecd249c69e4f7342..707e7dcd01775776ca23d8b4709fde571d2e0708 100644 (file)
@@ -1,6 +1,6 @@
 [package]
 name = "scryer-prolog"
-version = "0.8.5"
+version = "0.8.6"
 authors = ["Mark Thom <[email protected]>"]
 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"
\ No newline at end of file
index ca214421feb4d40e750f2aae6c66f0ec7ff475be..e1e9a4c1782550107461efb5fd034ce3bbca5e03 100644 (file)
@@ -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)
                 };
index c3656eba2b3f82755c7ed05fc8f73c419ccb9be9..bd56926533a24365ec25683298d11c3ec8a61493 100644 (file)
@@ -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);
 
index da7254f98be0400ed46a421cc90b5b3971832381..a36c9f13c2b48b83958228147135438fdff5eb31 100644 (file)
@@ -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)
     }
 }
index 71e19a80c5007d0d2670627646ab6debaa9872ce..8b6c8407c664eef08eab72e2143b5afd8ced1de6 100644 (file)
@@ -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) =>