Scryer-prolog: cannot load file on windows

Created on 20 May 2020  路  6Comments  路  Source: mthom/scryer-prolog

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)
?-

Most helpful comment

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:

All 6 comments

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

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

toto(0).

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.

yes only on windows

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

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:

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

Was this page helpful?
0 / 5 - 0 ratings