Draft
Conversation
This commit resolves an issue where Flecs scripts would fail to parse if they used CRLF (Carriage Return Line Feed) line endings. The script parser was expecting only LF (Line Feed) as a line ending, leading to parsing errors when an unexpected carriage return character was encountered. The fix involves modifying the function in to normalize line endings. After loading the file content, all carriage return characters () are removed, ensuring that the script parser only receives LF line endings. A new helper function flecs_str_remove_all_occurrences_of_char was added to facilitate this normalization. This change ensures that Flecs scripts can be loaded and executed correctly regardless of their line ending convention.
4357f4b to
0100994
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Repro only; not meant to be merged.
How to reproduce
Input FlecsScript
I have included test.{CRLF|LF}.flecs that are encoded using the different line endings, the contents of which is just the first example snippet on https://www.flecs.dev/flecs/md_docs_2FlecsScript.html.
Note that
gitmay automatically convert the line endings during file check-in. We don't want that to happen during this repro, so it's probably a good idea to rungit config core.autocrlf falseto turn that off.If needed, on Linux & macOS use
unix2dos -vto re-generate the CRLF version of the file. This tool can be installed viabrew install dos2unixon macOS.Reproducing