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

Add optional offset argument to StringScanner.peekCodePoint() #69

Closed
wants to merge 1 commit into from

Conversation

tamcy
Copy link

@tamcy tamcy commented Mar 25, 2024

Currently StringScanner.peekChar() accepts an optional argument of offset, but the new StringScanner.peekCodePoint() method doesn't. This PR aims to make StringScanner.peekCodePoint()'s behavior align more with that of StringScanner.peekChar().

This is required if the yaml library is to migrate to string_scanner ^1.2.0 to take advantage from the new codepoint related APIs.


  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

@tamcy tamcy mentioned this pull request Mar 25, 2024
CHANGELOG.md Show resolved Hide resolved
@tamcy
Copy link
Author

tamcy commented Mar 25, 2024

Hello, I recommend pausing this pull request. I need to refine my thoughts and will provide an update later.

@tamcy
Copy link
Author

tamcy commented Mar 26, 2024

Sorry for the late follow up. The reason I asked to pause processing this pull request is that it may bring confusion when an offset
of the peekCodePoint method actually acts upon a code unit, not a code point.

@kevmoo
Copy link
Member

kevmoo commented Mar 27, 2024

Is this needed now?

@lrhn
Copy link
Member

lrhn commented Mar 27, 2024

I have no problem allowing an offset for peekCodePoint. If you peek ahead and see a non-BMP code point, you should know to increment by two instead of one before doing the next peek.
(That said, I'm not a great fan of the general API here. I'd rather have multiple "cursor objects" on the same input, which can be incremented individually, instead of needing to keep track of integer offsets manually.)

@tamcy
Copy link
Author

tamcy commented Apr 5, 2024

I am closing it because it isn't needed, at least for now. Thanks for the comment!

@tamcy tamcy closed this Apr 5, 2024
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.

3 participants