Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partially implement translate_newlines config in JVM backend's DecoderInstance #724

Conversation

MasterDuke17
Copy link
Contributor

@MasterDuke17 MasterDuke17 commented May 22, 2021

Add a boolean member for it (defaults to false) and set it based on the
config hash if given.

Currently only takeAllChars uses it, because that's all that was needed
to get both t/nqp/019-file-opt.t and t/nqp/116-streaming-decoder.t to
pass on Windows with the JVM backend.

This will allow us to turn back on the JVM-on-Windows NQP test job in CI, which I accidentally did in #719, so after a rebase that PR should all pass.

Add a boolean member for it (defaults to false) and set it based on the
config hash if given.

Currently only takeAllChars uses it, because that's all that was needed
to get both t/nqp/019-file-opt.t and t/nqp/116-streaming-decoder.t to
pass on Windows.
@MasterDuke17 MasterDuke17 requested review from usev6 and jnthn May 22, 2021 20:22
@MasterDuke17 MasterDuke17 changed the title Partially implement translate_newlines config in DecoderInstance Partially implement translate_newlines config in JVM backend's DecoderInstance May 25, 2021
@@ -156,7 +159,8 @@ public synchronized String takeAllChars(ThreadContext tc) {
decoder.flush(target);
decoder.reset();
}
return Normalizer.normalize(decodedBuffer(target), Normalizer.Form.NFC);
String normalized = Normalizer.normalize(decodedBuffer(target), Normalizer.Form.NFC);
return translate_newlines ? normalized.replace("\r\n", "\n") : normalized;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should happen in takeChars and takeAvailableChars too, probably by factoring out this line into a method. Otherwise it seems to be doing the right thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I'll give that a shot and see what happens.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. No change in tests.

@jnthn jnthn merged commit 38c2065 into Raku:master May 26, 2021
@MasterDuke17 MasterDuke17 deleted the implement_translating_newlines_for_Decoder.takeAllChars_on_jvm branch May 26, 2021 19:34
usev6 added a commit to Raku/roast that referenced this pull request May 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants