correct bad atom_length/2, atom_chars/2 error reporting
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "scryer-prolog"
|
||||
version = "0.8.43"
|
||||
version = "0.8.44"
|
||||
authors = ["Mark Thom <markjordanthom@gmail.com>"]
|
||||
repository = "https://github.com/mthom/scryer-prolog"
|
||||
description = "A modern Prolog implementation written mostly in Rust."
|
||||
@@ -14,7 +14,7 @@ cfg-if = "0.1.7"
|
||||
downcast = "0.10.0"
|
||||
num = "0.2"
|
||||
ordered-float = "0.5.0"
|
||||
prolog_parser = "0.8.16"
|
||||
prolog_parser = { version = "0.8.17", path = "../prolog_parser" }
|
||||
readline_rs_compat = { version = "0.1.7", optional = true }
|
||||
ref_thread_local = "0.0.0"
|
||||
|
||||
|
||||
@@ -766,7 +766,7 @@ op(Priority, OpSpec, Op) :-
|
||||
; var(OpSpec) -> throw(error(instantiation_error, op/3)) % 8.14.3.3 b)
|
||||
; var(Op) -> throw(error(instantiation_error, op/3)) % 8.14.3.3 c)
|
||||
; Op == '|' -> ( op_priority(Priority), op_specifier(OpSpec),
|
||||
lists:member(OpSpec, [xfx, xfy, yfx]), Priority >= 1001
|
||||
lists:member(OpSpec, [xfx, xfy, yfx]), ( Priority >= 1001 ; Priority == 0 )
|
||||
-> '$op'(Priority, OpSpec, Op)
|
||||
; throw(error(permission_error(create, operator, (|)), op/3))) % www.complang.tuwien.ac.at/ulrich/iso-prolog/conformity_testing#72
|
||||
; valid_op(Op), op_priority(Priority), op_specifier(OpSpec) ->
|
||||
@@ -800,7 +800,7 @@ atom_length(Atom, Length) :-
|
||||
( var(Atom) -> throw(error(instantiation_error, atom_length/2)) % 8.16.1.3 a)
|
||||
; atom(Atom) -> ( var(Length) -> '$atom_length'(Atom, Length)
|
||||
; integer(Length), Length >= 0 -> '$atom_length'(Atom, Length)
|
||||
; integer(Length) -> throw(domain_error(not_less_than_zero, Length), atom_length/2) % 8.16.1.3 d)
|
||||
; integer(Length) -> throw(error(domain_error(not_less_than_zero, Length), atom_length/2)) % 8.16.1.3 d)
|
||||
; throw(error(type_error(integer, Length), atom_length/2)) % 8.16.1.3 c)
|
||||
)
|
||||
; throw(error(type_error(atom, Atom), atom_length/2)) % 8.16.1.3 b)
|
||||
@@ -811,13 +811,10 @@ no_var_in_list([X|Xs]) :- var(X), !, '$fail'.
|
||||
no_var_in_list([_|Xs]) :- no_var_in_list(Xs).
|
||||
|
||||
atom_chars(Atom, List) :-
|
||||
( var(Atom), '$skip_max_list'(_, -1, List, Xs) ->
|
||||
( var(Xs) -> throw(error(instantiation_error, atom_chars/2))
|
||||
; Xs == [] ->
|
||||
( no_var_in_list(List) -> '$atom_chars'(Atom, List)
|
||||
; throw(error(instantiation_error, atom_chars/2))
|
||||
)
|
||||
; throw(error(type_error(list, List), atom_chars/2))
|
||||
error:can_be(list, List),
|
||||
( var(Atom) ->
|
||||
( var(List) -> throw(error(instantiation_error, atom_chars/2))
|
||||
; no_var_in_list(List) -> '$atom_chars'(Atom, List)
|
||||
)
|
||||
; atom(Atom) -> '$atom_chars'(Atom, List)
|
||||
; Atom == [] -> '$atom_chars'(Atom, List)
|
||||
@@ -825,13 +822,10 @@ atom_chars(Atom, List) :-
|
||||
).
|
||||
|
||||
atom_codes(Atom, List) :-
|
||||
( var(Atom), '$skip_max_list'(_, -1, List, Xs) ->
|
||||
( var(Xs) -> throw(error(instantiation_error, atom_codes/2))
|
||||
; Xs == [] ->
|
||||
( no_var_in_list(List) -> '$atom_codes'(Atom, List)
|
||||
; throw(error(instantiation_error, atom_codes/2))
|
||||
)
|
||||
; throw(error(type_error(list, List), atom_codes/2))
|
||||
error:can_be(list, List),
|
||||
( var(Atom) ->
|
||||
( var(List) -> throw(error(instantiation_error, atom_codes/2))
|
||||
; no_var_in_list(List) -> '$atom_codes'(Atom, List)
|
||||
)
|
||||
; atom(Atom) -> '$atom_codes'(Atom, List)
|
||||
; Atom == [] -> '$atom_codes'(Atom, List)
|
||||
|
||||
Reference in New Issue
Block a user