1016 leading whitespaces after indentation are not parsed correctly#1023
Open
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
Collaborator
|
| Report | Sun, April 21, 2024 at 13:13:42 UTC |
| Project | Candy |
| Branch | 1016-leading-whitespaces-after-indentation-are-not-parsed-correctly |
| Testbed | GitHub Actions: Ubuntu 22.04 |
| Benchmark | Estimated Cycles | Estimated Cycles Results estimated cycles | Instructions | Instructions Results instructions | L1 Accesses | L1 Accesses Results accesses | L2 Accesses | L2 Accesses Results accesses | RAM Accesses | RAM Accesses Results accesses | Total Accesses | Total Accesses Results total-accesses |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| compile: Examples/fibonacci.candy | ➖ (view plot) | 1791670090.000 | ➖ (view plot) | 1189937665.000 | ➖ (view plot) | 1618812475.000 | ➖ (view plot) | 10751132.000 | ➖ (view plot) | 3402913.000 | ➖ (view plot) | 1632966520.000 |
| compile: Examples/helloWorld.candy | ➖ (view plot) | 284198198.000 | ➖ (view plot) | 176272890.000 | ➖ (view plot) | 248121798.000 | ➖ (view plot) | 1479711.000 | ➖ (view plot) | 819367.000 | ➖ (view plot) | 250420876.000 |
| vm_runtime: Examples/fibonacci.candy 10 | ➖ (view plot) | 181431754.000 | ➖ (view plot) | 106024775.000 | ➖ (view plot) | 149334889.000 | ➖ (view plot) | 795013.000 | ➖ (view plot) | 803480.000 | ➖ (view plot) | 150933382.000 |
| vm_runtime: Examples/helloWorld.candy | ➖ (view plot) | 154535457.000 | ➖ (view plot) | 88645701.000 | ➖ (view plot) | 124969072.000 | ➖ (view plot) | 701441.000 | ➖ (view plot) | 744548.000 | ➖ (view plot) | 126415061.000 |
Bencher - Continuous Benchmarking
View Public Perf Page
Docs | Repo | Chat | Help
JonasWanke
requested changes
Jun 6, 2024
Member
JonasWanke
left a comment
There was a problem hiding this comment.
Really sorry for the long delay! I somehow missed this PR
Comment on lines
231
to
247
| 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 " " | ||
| "### | ||
| ); |
Member
There was a problem hiding this comment.
Shouldn't the Whitespace here be wrapped in CstError::TooMuchWhitespace in the general case? (For parsed text, the output looks fine)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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