mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 14:54:47 +00:00
Fix some fmt stuff
This commit is contained in:
parent
74c0bdfd5a
commit
7682e09b0a
9 changed files with 163 additions and 48 deletions
|
@ -15,7 +15,7 @@ use roc_module::ident::{Lowercase, TagName};
|
|||
use roc_module::low_level::LowLevel;
|
||||
use roc_module::operator::CalledVia;
|
||||
use roc_module::symbol::Symbol;
|
||||
use roc_parse::ast::{self, StrLiteral};
|
||||
use roc_parse::ast::{self, EscapedChar, StrLiteral};
|
||||
use roc_parse::pattern::PatternType::*;
|
||||
use roc_problem::can::{PrecedenceProblem, Problem, RuntimeError};
|
||||
use roc_region::all::{Located, Region};
|
||||
|
@ -1393,10 +1393,23 @@ fn flatten_str_lines<'a>(
|
|||
);
|
||||
}
|
||||
}
|
||||
EscapedChar(ch) => buf.push(*ch),
|
||||
EscapedChar(escaped) => buf.push(unescape_char(escaped)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(Expr::Str(interpolations), output)
|
||||
}
|
||||
|
||||
/// Returns the char that would have been originally parsed to
|
||||
pub fn unescape_char(escaped: &EscapedChar) -> char {
|
||||
use EscapedChar::*;
|
||||
|
||||
match escaped {
|
||||
Backslash => '\\',
|
||||
Quote => '"',
|
||||
CarriageReturn => '\r',
|
||||
Tab => '\t',
|
||||
Newline => '\n',
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue