use new predicates from library(error)

This commit is contained in:
Markus Triska
2020-04-27 17:42:05 +02:00
parent 2b1692a860
commit 8e1ba58551
7 changed files with 23 additions and 33 deletions

View File

@@ -1,11 +1,12 @@
:- module(pio, [phrase_from_file/2]).
:- use_module(library(dcgs)).
:- use_module(library(error)).
phrase_from_file(NT, File) :-
( var(File) -> throw(error(instantiation_error, phrase_from_file/2))
( var(File) -> instantiation_error(phrase_from_file/2)
; (\+ atom(File) ; File = []) ->
throw(error(domain_error(source_sink, File), phrase_from_file/2))
domain_error(source_sink, File, phrase_from_file/2)
; '$file_to_chars'(File, Chars),
phrase(NT, Chars)
).