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

Support lines #56

Open
karelispanagiotis opened this issue Jan 19, 2025 · 1 comment
Open

Support lines #56

karelispanagiotis opened this issue Jan 19, 2025 · 1 comment

Comments

@karelispanagiotis
Copy link

How about supporting a marker::Line to read a whole line of the input (including the whitespaces) as a string?

For example I came across a needle in haystack problem where the input was given as:

11
BUBBLE SORT
46
A;KDLJKNF,lMBUBBLE SORTDIHEWN GLM FR &JSALJFLMC

It would be really nice to have something like:

input! {
        n: usize,
        needle: Line,
        m: usize,
        haystack: Line,
}
@statiolake
Copy link
Owner

Thank you for your interest!
Unfortunately, this isn't possible with the current design.

The input text is split by whitespace characters (including newlines) immediately after reading, and the Source trait only provides these split tokens. We cannot restore the original line.

Simply modifying the Source trait definition would be a breaking change. I'll continue to think about ways to support this functionality.

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

No branches or pull requests

2 participants