]> Repositorios git - scryer-prolog.git/commitdiff
fix broken conformity tests, quote left paren
authorMark Thom <[email protected]>
Sun, 8 Mar 2020 22:49:47 +0000 (16:49 -0600)
committerMark Thom <[email protected]>
Sun, 8 Mar 2020 22:49:47 +0000 (16:49 -0600)
Cargo.lock
Cargo.toml
src/prolog/clause_types.rs
src/prolog/heap_print.rs
src/prolog/machine/mod.rs
src/prolog/machine/system_calls.rs
src/prolog/toplevel.pl

index 394f4511a956c46cffd9de706bbe87c08e4ea052..3d9f252d23823332bfc8d5658e1a5962700fa63a 100644 (file)
@@ -316,7 +316,7 @@ dependencies = [
 
 [[package]]
 name = "prolog_parser"
-version = "0.8.42"
+version = "0.8.44"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "lexical 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -453,7 +453,7 @@ dependencies = [
  "nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "num-rug-adapter 0.1.1 (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.42 (registry+https://github.com/rust-lang/crates.io-index)",
+ "prolog_parser 0.8.44 (registry+https://github.com/rust-lang/crates.io-index)",
  "ref_thread_local 0.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "rug 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustyline 5.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -614,7 +614,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum num-traits 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "443c53b3c3531dfcbfa499d8893944db78474ad7a1d87fa2d94d1a2231693ac6"
 "checksum ordered-float 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7eb5259643245d3f292c7a146b2df53bba24d7eab159410e648eb73dc164669d"
 "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
-"checksum prolog_parser 0.8.42 (registry+https://github.com/rust-lang/crates.io-index)" = "6e1dc25ecbd80bc9a1636b3c863ae95355b340cf2959f94fe8faeff13c4ad078"
+"checksum prolog_parser 0.8.44 (registry+https://github.com/rust-lang/crates.io-index)" = "c113cce59b3e97ff141e933d09eb1618e44b11cad9fa2ce6eb53ef832c38dc5c"
 "checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
 "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
 "checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
index 85b7c9dc866aaa856df7b55f933cc14fb2613d22..761a51cdda0dff2c36cb6c87a98e4481b7879ad0 100644 (file)
@@ -24,7 +24,7 @@ libc = "0.2.62"
 nix = "0.15.0"
 num-rug-adapter = { optional = true, version = "0.1.1" }
 ordered-float = "0.5.0"
-prolog_parser = { version = "0.8.42", default-features = false }
+prolog_parser = { version = "0.8.44", default-features = false }
 ref_thread_local = "0.0.0"
 rug = { version = "1.4.0", optional = true }
 rustyline = "5.0.3"
index 7851ad03b365d0a922b3ed39e216b7f2246f5963..62604b6da08eb77cd1aa0656abb55fef9737c6fd 100644 (file)
@@ -241,6 +241,7 @@ pub enum SystemClauseType {
     GetDoubleQuotes,
     InstallNewBlock,
     Maybe,
+    QuotedToken,
     RawInputReadChar,
     ResetBlock,
     ReturnFromVerifyAttr,
@@ -359,6 +360,9 @@ impl SystemClauseType {
             &SystemClauseType::PointsToContinuationResetMarker => {
                 clause_name!("$points_to_cont_reset_marker")
             }
+            &SystemClauseType::QuotedToken => {
+                clause_name!("$quoted_token")
+            }
             &SystemClauseType::RawInputReadChar => clause_name!("$raw_input_read_char"),
             &SystemClauseType::RedoAttrVarBinding => clause_name!("$redo_attr_var_binding"),
             &SystemClauseType::RemoveCallPolicyCheck => clause_name!("$remove_call_policy_check"),
@@ -494,6 +498,7 @@ impl SystemClauseType {
             ("$get_current_block", 1) => Some(SystemClauseType::GetCurrentBlock),
             ("$get_cp", 1) => Some(SystemClauseType::GetCutPoint),
             ("$install_new_block", 1) => Some(SystemClauseType::InstallNewBlock),
+            ("$quoted_token", 1) => Some(SystemClauseType::QuotedToken),
             ("$raw_input_read_char", 1) => Some(SystemClauseType::RawInputReadChar),
             ("$nextEP", 3) => Some(SystemClauseType::NextEP),
             ("$read_query_term", 2) => Some(SystemClauseType::ReadQueryTerm),
index 7f8fed170eae5c557988d051d54acdb31453d7df..b7c25ded31cf7c0daa9d5c27fc071ead8f28f5ba 100644 (file)
@@ -396,6 +396,7 @@ fn non_quoted_graphic_token<Iter: Iterator<Item = char>>(mut iter: Iter, c: char
     }
 }
 
+pub(super)
 fn non_quoted_token<Iter: Iterator<Item = char>>(mut iter: Iter) -> bool {
     if let Some(c) = iter.next() {
         if small_letter_char!(c) {
@@ -411,7 +412,7 @@ fn non_quoted_token<Iter: Iterator<Item = char>>(mut iter: Iter) -> bool {
         } else if c == '{' {
             (iter.next() == Some('}') && iter.next().is_none())
         } else if solo_char!(c) {
-            !(c == ')' || c == '}' || c == ']' || c == ',' || c == '%' || c == '|')
+            !(c == '(' || c == ')' || c == '}' || c == ']' || c == ',' || c == '%' || c == '|')
         } else {
             false
         }
index 64eef8f3bf119a1043a0b740535e9e2e95907244..aff02e435e96f2ca56855db9eac2ade39a23ec71 100644 (file)
@@ -194,6 +194,7 @@ impl SubModuleUser for IndexStore {
 #[inline]
 fn current_dir() -> std::path::PathBuf {
     let mut path_buf = std::path::PathBuf::from(PROJECT_DIR);
+    
     // file!() always produces a path relative to PROJECT_DIR.
     path_buf = path_buf.join(std::path::PathBuf::from(file!()));
 
index 4fc92ed8b76a93c8ba70017ba4be10d0695e7a8d..8512c762b3999d0e63f652ca6ea376c786d42a4c 100644 (file)
@@ -2342,6 +2342,31 @@ impl MachineState {
                 self.fail = true;
                 return Ok(());
             }
+            &SystemClauseType::QuotedToken => {
+                let addr = self.store(self.deref(self[temp_v!(1)].clone()));
+
+                match addr {
+                    Addr::Con(Constant::CharCode(c)) => {
+                        self.fail = match std::char::from_u32(c) {
+                            Some(c) => {
+                                non_quoted_token(once(c))
+                            }
+                            None => {
+                                true
+                            }
+                        };
+                    }
+                    Addr::Con(Constant::Char(c)) => {
+                        self.fail = non_quoted_token(once(c));
+                    }
+                    Addr::Con(Constant::Atom(atom, _)) => {
+                        self.fail = non_quoted_token(atom.as_str().chars());
+                    }
+                    _ => {
+                        self.fail = true;
+                    }
+                }
+            }
             &SystemClauseType::ReadQueryTerm => {
                 readline::set_prompt(true);
                 let result = self.read_term(current_input_stream, indices);
index df128c5a9de40aa4c1cdc873da15972feb2636d0..8efc037534c2e04e7711441e874b8b30a389ded0 100644 (file)
@@ -60,6 +60,7 @@
          _,
          false),
     (  EqPrec < FPrec -> true
+    ;  '$quoted_token'(F) -> true
     ;  EqPrec == FPrec,
        memberchk(EqSpec, [fx,xfx,yfx])
     ).