kuroko-lang / kuroko

Dialect of Python with explicit variable declaration and block scoping, with a lightweight and easy-to-embed bytecode compiler and interpreter.
https://kuroko-lang.github.io/
MIT License
427 stars 25 forks source link

Kuroko does not read files with Windows \r\n newlines #13

Closed valoeghese closed 3 years ago

valoeghese commented 3 years ago

I was trying out Kuroko 1.1.1 on Windows 10, and I noticed that in souce files I wrote with multiple lines I would get the error: kuroko: could not read file 'hello.krk': No error

Upon changing my newlines to UNIX (\n), Kuroko could read the file perfectly.

Thus it is safe to assume that kuroko.exe was failing to parse files that use Windows (\r\n) newlines.

klange commented 3 years ago

Odd, that message would suggest an issue with the fread call... is Windows giving a different size when I seek to the end of the file vs. the number of bytes it returns from the read because it’s doing newline conversion underneath? I don’t do much testing directly under Windows beyond the test suite, but I’ll see if removing the exact size check is enough to resolve this.

valoeghese commented 3 years ago

I'll check this again at the next stable release