Skip to content

get_char/2 must not produce a syntax error #3064

@UWN

Description

@UWN
?- open(binary,write,S,[type(binary)]),maplist(put_byte(S),[0xff,65]),close(S).
   S = '$dropped_value'.
?- open(binary,read,S),get_char(S,Ch).
   error(syntax_error(invalid_data),get_char/2), unexpected.
   representation_error(character). % qua 8.12.1.3 i
?- phrase_from_file(seq(Xs),binary).
   error(syntax_error(invalid_data),get_n_chars/2), unexpected.
   idem.

Syntax errors are only related to syntax which starts with a PCS (processor character set). Everything below that is not syntax. Also note the different naming, when we are read-ing we use syntax. But if we are only get-ting we just get the next character.

8.12.1.3 i reads:

i) The entity input from the stream is not a character
(7.1.4.1)
representation_error(character).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions