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

Make sure that we invoke all the intended regex patterns in ToktokTokenizer... #3203

Merged
merged 1 commit into from
Nov 9, 2023

Conversation

alexrudnick
Copy link
Member

and do it only once. Also add more tests.

This is for #3202 .

…enizer, and do it only once. Also add more tests.
@tomaarsen
Copy link
Member

Hello!

Looks great - though it's plausible (but unlikely) that the duplicate FINAL_PERIOD_2 was on purpose. What do you think @alexrudnick?

  • Tom Aarsen

@alexrudnick
Copy link
Member Author

Thanks for taking a look, @tomaarsen !

So I considered this possibility, that perhaps FINAL_PERIOD_2 was intended to be called twice, but I think that's unlikely for a few reasons:

  • There's no mention of it in the code; if there was some subtle reason why that regex ought to be called twice, then that seems like it'd be worthy of a comment.
  • It's not called twice in the original Perl! https://github.com/jonsafari/tok-tok/blob/master/tok-tok.pl
  • The only reason why you might need to call it twice would be if some other rule had created a situation where FINAL_PERIOD_2 would need to trigger later on, and I don't see any rules that would create that kind of situation.

Peeking at blame, it looks like @purificant wrote that line, so maybe they could chime in if they like?

Copy link
Member

@tomaarsen tomaarsen left a comment

Choose a reason for hiding this comment

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

Thanks for the analysis! I think that clears it right up, especially the second point. Though @purificant did last affect this line, that was with his #2163 PR that applied black over all code. The only person to meaningfully write/edit this code was @alvations.

This looks ready to merge as far as I'm concerned!

@alexrudnick
Copy link
Member Author

Right on, I just noticed that right after I said it, good catch! Code reformatting patch.

Thanks, merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants