]> Repositorios git - scryer-prolog.git/commitdiff
unify '[]' with proper [] in atom_chars/2 (#569)
authorMark Thom <[email protected]>
Tue, 4 Aug 2020 01:29:53 +0000 (19:29 -0600)
committerMark Thom <[email protected]>
Tue, 4 Aug 2020 01:29:53 +0000 (19:29 -0600)
Cargo.lock
Cargo.toml
src/machine/system_calls.rs

index 531d0e50016ec972ad40fc76dcf7953b67e3ed96..526b964473788da622da0a4fbe488305fbe9b8c7 100644 (file)
@@ -905,9 +905,9 @@ dependencies = [
 
 [[package]]
 name = "prolog_parser"
-version = "0.8.65"
+version = "0.8.66"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fdcfe8260335a150812e36b171ff985ce88f02de16c05f4a13fe4f10e8c247f8"
+checksum = "e35f5db0eb6725d00be12f3c9550de0dce0a43a1fa25a873f879613d63fcbbd5"
 dependencies = [
  "lexical",
  "num-rug-adapter",
index c359e1bac374bcc89f5ee67fb0a33628dc3a0a88..4b4bc1bf3347e9e9bcd45082654edf4461e4ff74 100644 (file)
@@ -32,7 +32,7 @@ libc = "0.2.62"
 nix = "0.15.0"
 num-rug-adapter = { optional = true, version = "0.1.3" }
 ordered-float = "0.5.0"
-prolog_parser = { version = "0.8.65", default-features = false }
+prolog_parser = { version = "0.8.66", default-features = false }
 ref_thread_local = "0.0.0"
 rug = { version = "1.4.0", optional = true }
 rustyline = "6.0.0"
index 644f8296f0169eb8885963da22c96ad2694d89ad..ada49a0ff9674945f524173e7133b11203cc5d5e 100644 (file)
@@ -1029,20 +1029,24 @@ impl MachineState {
 
                         match iter.focus() {
                             Addr::EmptyList => {
-                                let chars = clause_name!(string, indices.atom_tbl);
-                                let atom  = self.heap.to_unifiable(
-                                    HeapCellValue::Atom(chars, None)
-                                );
+                                if &string == "[]" {
+                                    self.unify(addr, Addr::EmptyList);
+                                } else {
+                                    let chars = clause_name!(string, indices.atom_tbl);
+                                    let atom  = self.heap.to_unifiable(
+                                        HeapCellValue::Atom(chars, None)
+                                    );
 
-                                self.unify(addr, atom);
+                                    self.unify(addr, atom);
+                                }
                             }
                             focus => {
-                                let stub = MachineError::functor_stub(
-                                    clause_name!("atom_chars"),
-                                    2,
-                                );
-
                                 if let Addr::Lis(l) = focus {
+                                    let stub = MachineError::functor_stub(
+                                        clause_name!("atom_chars"),
+                                        2,
+                                    );
+
                                     let err = MachineError::type_error(
                                         self.heap.h(),
                                         ValidType::Character,