scryer-prolog icon indicating copy to clipboard operation
scryer-prolog copied to clipboard

cannot load file on windows

Open cduret opened this issue 4 years ago • 7 comments

Scryer raise error when I try to load a prolog file from repl.

PS C:\DEV\prolog> more .\test.pl
toto(0).

PS C:\DEV\prolog> scryer-prolog
?- [test].
test.pl:0: unexpected_char
caught: error(syntax_error(unexpected_char),use_module/1:0)
?-

cduret avatar May 20 '20 08:05 cduret

Not sure maybe \r isn't handled, could you share the file (through pastebin or print in hexadecimal)?

ghost avatar May 20 '20 09:05 ghost

not sure because my test file has only one line and no carriage return nor line feed :

toto(0).

cduret avatar May 20 '20 09:05 cduret

Maybe it only happens on Windows, I tested with this:

$ hexdump test.pl 
0000000 6f74 6f74 3028 2e29                    
0000008
$ scryer-prolog -v
"v0.8.119-356-g3245261"
$ scryer-prolog
?- [test].
?-

No error.

ghost avatar May 20 '20 09:05 ghost

yes only on windows

PS C:\DEV\prolog> scryer-prolog -v
"cargo:0.8.123"

cduret avatar May 20 '20 09:05 cduret

I think that the problem might be that the file has

no carriage return nor line feed :

toto(0).

I've run into this kind of error when testing the lexer when I needed to add a blank character (newline, or space) after the dot for the content to be parsed correctly. I think we may want to add a test for that :thinking:

matt2xu avatar May 23 '20 19:05 matt2xu

I have just make it work be using :set ff=unix in vim for all my prolog source files and it works OK The problem is 0d0a as line separator

cduret avatar May 23 '20 20:05 cduret

Should be solved by #2040

rujialiu avatar Sep 25 '23 01:09 rujialiu