cleanup on reading predicates, add get_char/{1,2}

This commit is contained in:
Mark Thom
2020-05-05 16:54:40 -06:00
parent bfced59949
commit 573df892bc
6 changed files with 196 additions and 78 deletions

View File

@@ -49,10 +49,10 @@ user:term_expansion((:- op(Pred, Spec, [Op | OtherOps])), OpResults) :-
current_prolog_flag/2, expand_goal/2,
expand_term/2, fail/0, false/0, findall/3,
findall/4, flush_output/0, flush_output/1,
get_byte/1, get_byte/2, get_char/1, halt/0,
max_arity/1, number_chars/2, number_codes/2,
once/1, op/3, open/3, open/4, read_term/2,
read_term/3, repeat/0, retract/1,
get_byte/1, get_byte/2, get_char/1, get_char/2,
halt/0, max_arity/1, number_chars/2,
number_codes/2, once/1, op/3, open/3, open/4,
read_term/2, read_term/3, repeat/0, retract/1,
set_prolog_flag/2, set_input/1, set_output/1,
setof/3, sub_atom/5, subsumes_term/2,
term_variables/2, throw/1, true/0,
@@ -1000,11 +1000,11 @@ char_code(Char, Code) :-
).
get_char(C) :-
( var(C) -> '$get_char'(C)
; C == end_of_file -> '$get_char'(C)
; atom_length(C, 1) -> '$get_char'(C)
; throw(error(type_error(in_character, C), get_char/1))
).
current_input(S),
'$get_char'(S, C).
get_char(S, C) :-
'$get_char'(S, C).
can_be_number(N, PI) :-
( var(N) -> true