Skip to content

Treat tab as text, not whitespace #312

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

Merged
merged 3 commits into from
Feb 9, 2023
Merged

Conversation

eemeli
Copy link
Member

@eemeli eemeli commented Feb 8, 2023

See projectfluent/python-fluent#173

Tabs were defined to be text, not whitespace, in projectfluent/fluent#167, but this change was not reflected here.

@eemeli eemeli requested a review from gregtatum February 8, 2023 16:50
Copy link
Collaborator

@zbraniecki zbraniecki left a comment

Choose a reason for hiding this comment

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

suggestion: Please, extract the closure to a parser::slice::matches_fluent_ws(c: char): bool and reuse in all three places.

Copy link
Member

@gregtatum gregtatum left a comment

Choose a reason for hiding this comment

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

Looks good to me with Zibi's suggestion.

@eemeli
Copy link
Member Author

eemeli commented Feb 9, 2023

Extracted the closure to a function. Do I understand right that this effectively becomes a part of the public API as well? Or is there a way to make it available from src/parser/slice.rs to src/serializer.rs without doing so?

@zbraniecki
Copy link
Collaborator

As you did it now, yes, because lib.rs has pub mod parser and parser has pub use slice::matches_fluent_ws.

But you can limit it by using pub(crate) fn matches_fluent_ws making this function visible only internally to the crate.
Whether you want to or not is not clear to me.

On one hand, if this is Fluent WS, then having access to a test of it from parser is nice, on the other it is increasing the stable API surface and if someone really needs it they can readd it at very low cost.
My weak lean is to keep it private until someone asks for it.

@eemeli eemeli merged commit c4156bd into projectfluent:main Feb 9, 2023
@eemeli eemeli deleted the tab-is-text branch February 9, 2023 16:41
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