mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
Fix a bunch of bugs in parsing/formatting found by fuzzing
This commit is contained in:
parent
acd446f6bd
commit
3fee0d3e8f
43 changed files with 593 additions and 70 deletions
|
@ -106,12 +106,20 @@ impl<'a> Buf<'a> {
|
|||
self.spaces_to_flush += count;
|
||||
}
|
||||
|
||||
pub fn newline(&mut self) {
|
||||
/// Only for use in emitting newlines in block strings, which don't follow the rule of
|
||||
/// having at most two newlines in a row.
|
||||
pub fn push_newline_literal(&mut self) {
|
||||
self.spaces_to_flush = 0;
|
||||
self.newlines_to_flush += 1;
|
||||
self.beginning_of_line = true;
|
||||
}
|
||||
|
||||
pub fn newline(&mut self) {
|
||||
self.spaces_to_flush = 0;
|
||||
self.newlines_to_flush = std::cmp::min(self.newlines_to_flush + 1, 2);
|
||||
self.beginning_of_line = true;
|
||||
}
|
||||
|
||||
/// Ensures the current buffer ends in a newline, if it didn't already.
|
||||
/// Doesn't add a newline if the buffer already ends in one.
|
||||
pub fn ensure_ends_with_newline(&mut self) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue