]> Repositorios git - scryer-prolog.git/commitdiff
fix existence_error in atom_chars/2, atom_codes/2 (#504, #506)
authorMark Thom <[email protected]>
Fri, 15 May 2020 04:33:28 +0000 (22:33 -0600)
committerMark Thom <[email protected]>
Fri, 15 May 2020 04:33:28 +0000 (22:33 -0600)
Cargo.lock
src/prolog/lib/builtins.pl

index e6625c818beb7e1ae02f88ab47362ff89dc613d0..71e600dda2ec43b3d89a3160e33269c6f5533a9f 100644 (file)
@@ -62,12 +62,45 @@ dependencies = [
  "constant_time_eq",
 ]
 
+[[package]]
+name = "block-buffer"
+version = "0.7.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b"
+dependencies = [
+ "block-padding",
+ "byte-tools",
+ "byteorder",
+ "generic-array",
+]
+
+[[package]]
+name = "block-padding"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5"
+dependencies = [
+ "byte-tools",
+]
+
 [[package]]
 name = "bumpalo"
 version = "3.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "12ae9db68ad7fac5fe51304d20f016c911539251075a214f8e663babefa35187"
 
+[[package]]
+name = "byte-tools"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7"
+
+[[package]]
+name = "byteorder"
+version = "1.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
+
 [[package]]
 name = "cc"
 version = "1.0.52"
@@ -141,6 +174,15 @@ dependencies = [
  "winapi 0.3.8",
 ]
 
+[[package]]
+name = "digest"
+version = "0.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
+dependencies = [
+ "generic-array",
+]
+
 [[package]]
 name = "dirs"
 version = "2.0.2"
@@ -191,6 +233,15 @@ version = "0.3.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
 
+[[package]]
+name = "generic-array"
+version = "0.12.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec"
+dependencies = [
+ "typenum",
+]
+
 [[package]]
 name = "getrandom"
 version = "0.1.14"
@@ -498,6 +549,12 @@ version = "1.3.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "b1c601810575c99596d4afc46f78a678c80105117c379eb3650cf99b8a21ce5b"
 
+[[package]]
+name = "opaque-debug"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
+
 [[package]]
 name = "ordered-float"
 version = "0.5.2"
@@ -607,6 +664,17 @@ dependencies = [
  "winapi 0.3.8",
 ]
 
+[[package]]
+name = "ripemd160"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ad5112e0dbbb87577bfbc56c42450235e3012ce336e29c5befd7807bd626da4a"
+dependencies = [
+ "block-buffer",
+ "digest",
+ "opaque-debug",
+]
+
 [[package]]
 name = "rug"
 version = "1.8.0"
@@ -690,6 +758,7 @@ dependencies = [
  "prolog_parser",
  "ref_thread_local",
  "ring",
+ "ripemd160",
  "rug",
  "rustyline",
  "unicode_reader",
@@ -775,6 +844,12 @@ dependencies = [
  "unicode-xid",
 ]
 
+[[package]]
+name = "typenum"
+version = "1.12.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33"
+
 [[package]]
 name = "unicode-segmentation"
 version = "1.6.0"
index 76060ca5c5b837a8d24e4e2dd760feef410f787a..9e606bbf1b5106fbbe7f7bafa66e65a178151da4 100644 (file)
@@ -245,7 +245,7 @@ semicolon_compound_selector(';'(G2, G3), G4, B) :-
 ;(G1, G4, B) :-
     ( (  G1 = (_ -> _)
       ;  G1 = (_ , _)
-      ;  G1 = (_ ; _) 
+      ;  G1 = (_ ; _)
       ) ->
       !,
       semicolon_compound_selector(G1, G4, B)
@@ -935,7 +935,7 @@ atom_chars(Atom, List) :-
        ;  ground(List) -> '$atom_chars'(Atom, List)
        ;  throw(error(instantiation_error, atom_chars/2))
        )
-    ;  atom(Atom) -> can_be_chars_or_vars(List, atom_chars/2), '$atom_chars'(Atom, List)
+    ;  atom(Atom) -> '$atom_chars'(Atom, List)
     ;  throw(error(type_error(atom, Atom), atom_chars/2))
     ).
 
@@ -949,7 +949,7 @@ atom_codes(Atom, List) :-
        ;  ground(List), Tail == [] -> '$atom_codes'(Atom, List)
        ;  throw(error(instantiation_error, atom_codes/2))
        )
-    ;  atom(Atom) -> can_be_codes_or_vars(List, atom_codes/2), '$atom_codes'(Atom, List)
+    ;  atom(Atom) -> '$atom_codes'(Atom, List)
     ;  throw(error(type_error(atom, Atom), atom_codes/2))
     ).
 
@@ -1027,45 +1027,6 @@ must_be_number(N, PI) :-
     ;  throw(error(instantiation_error, PI))
     ).
 
-can_be_chars_or_vars(Cs, _)  :- var(Cs), !.
-can_be_chars_or_vars(Cs, PI) :-
-    (  string(Cs) ->
-       current_prolog_flag(double_quotes, chars)
-    ;  chars_or_vars(Cs, PI)
-    ).
-
-chars_or_vars([], _).
-chars_or_vars([C|Cs], PI) :-
-    (  nonvar(C) ->
-       (  catch(atom_length(C, 1), _, false) ->
-         (  nonvar(Cs) -> chars_or_vars(Cs, PI)
-         ;  false
-         )
-       ;  throw(error(type_error(character, C), PI))
-       )
-    ;  chars_or_vars(Cs, PI)
-    ).
-
-can_be_codes_or_vars(Cs, _)  :- var(Cs), !.
-can_be_codes_or_vars(Cs, PI) :-
-    (  string(Cs) ->
-       current_prolog_flag(double_quotes, codes)
-    ;  codes_or_vars(Cs, PI)
-    ).
-
-codes_or_vars([], _).
-codes_or_vars([C|Cs], PI) :-
-    (  nonvar(C) ->
-       (  catch(char_code(_, C), _, false) ->
-         (  nonvar(Cs) -> codes_or_vars(Cs, PI)
-         ;  false
-         )
-       ;  integer(C) -> throw(error(representation_error(character_code), PI))
-       ;  throw(error(type_error(integer, C), PI))
-       )
-    ;  codes_or_vars(Cs, PI)
-    ).
-
 number_chars(N, Chs) :-
    (  ground(Chs)
    -> can_be_number(N, number_chars/2),