-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
1016 leading whitespaces after indentation are not parsed correctly #1023
base: main
Are you sure you want to change the base?
1016 leading whitespaces after indentation are not parsed correctly #1023
Conversation
…ed-correctly' of https://github.com/candy-lang/candy into 1016-leading-whitespaces-after-indentation-are-not-parsed-correctly
Bencher
Bencher - Continuous Benchmarking View Public Perf Page Docs | Repo | Chat | Help |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really sorry for the long delay! I somehow missed this PR
assert_rich_ir_snapshot!( | ||
whitespaces_and_newlines("\n foo", 0, true), | ||
@r###" | ||
Remaining input: " foo" | ||
Remaining input: "foo" | ||
Parsed: Newline "\n" | ||
Whitespace " " | ||
"### | ||
); | ||
assert_rich_ir_snapshot!( | ||
whitespaces_and_newlines(" \n foo", 0, true), | ||
@r###" | ||
Remaining input: " foo" | ||
Remaining input: "foo" | ||
Parsed: Whitespace " " | ||
Newline "\n" | ||
Whitespace " " | ||
"### | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the Whitespace
here be wrapped in CstError::TooMuchWhitespace
in the general case? (For parsed text, the output looks fine)
Closes: #1016
The problem was, that after parsing indentation whitespace-parsing was postponed. When the whitespaces consisted of two spaces, we first checked if you could parse indentation from the remaining input. Because of the two spaces you could, so more indentation was parsed. The solution was to not postpone whitespace-parsing and instead do it immediately after parsing indentation.
I am more or less sure the test cases look okay. If I were to choose, however, I would pick less. So, I would appreciate feedback.
Checklist