MysteryBlokHed / databind

Expand the functionality of Minecraft Datapacks.
https://databind.rtfd.io/en/stable
GNU General Public License v3.0
4 stars 0 forks source link

Fix CRLF problems #109

Closed MysteryBlokHed closed 3 years ago

MysteryBlokHed commented 3 years ago

For some reason, files with CRLF line endings are compiled without any newlines. This, of course, causes problems, since mcfunction commands are separated by newlines. There might be some code somewhere that (unsuccessfully) tries to convert CRLF to LF that is failing for some reason, but I'm not sure.

MysteryBlokHed commented 3 years ago

It seems like the problem is caused by NewLine tokens not being created with CRLF line endings. Here is a token list from an LF source file:

[
    DefineFunc,
    FuncName("main"),
    NewLine,
    Tag,
    TagName("load"),
    NewLine,
    NonDatabind("say "),
    NonDatabind("Line1 "),
    NewLine,
    NonDatabind("say "),
    NonDatabind("Line2 "),
    NewLine,
    EndFunc,
    NewLine,
]

And the tokens from a source file with the same contents using CRLF line endings:

[
    DefineFunc,
    FuncName("main"),
    Tag,
    TagName("load"),
    NonDatabind("say "),
    NonDatabind("Line1 "),
    NonDatabind("say "),
    NonDatabind("Line2 "),
    EndFunc
]

The source file used:

func main
tag load
    say Line1
    say Line2
end