-
-
Notifications
You must be signed in to change notification settings - Fork 193
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
Sanitize strings that would lead to uneaven quotes in line #1208
Conversation
- Adds two tests based on failing formatting behavior having hash directives
@Smaug123 we sorta went with a dirty hack to solve the problem. I'm going to revisit the solution and try and come up with something better ;) |
Refactor fix for 1205
So I've refactored the code a bit and tried to come up with a better way of detecting all the defines inside a raw string. Lastly, I refactored the code so that the define detection dance is only performed once. |
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.
I don't really understand this fully, but the shape of it certainly makes me think it looks better. (E.g. the fact that we parse out hash-tokens right at the beginning.)
The state machine is big and scary and I don't really feel like I understand it properly!
Thanks for the review @Smaug123, some very good remarks! I'll revisit this PR later this week. |
@Smaug123 I'm ready for round two 😄. |
|
||
let currentLine = | ||
sourceCode | ||
|> Seq.skip skip |
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.
The use of Seq.skip
always terrifies me, because it makes it very easy to write things which are quadratic in complexity; but strings are easy to seek around in, so that's fine.
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.
I can't say I'm 100% convinced of its correctness, but I don't see anything obviously wrong, and if no tests are broken then that's good enough for me!
Sold! |
behavior having hash directives