mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
Fix some fmt stuff
This commit is contained in:
parent
74c0bdfd5a
commit
7682e09b0a
9 changed files with 163 additions and 48 deletions
|
@ -88,10 +88,34 @@ pub struct WhenPattern<'a> {
|
|||
pub enum StrSegment<'a> {
|
||||
Plaintext(&'a str), // e.g. "foo"
|
||||
Unicode(Loc<&'a str>), // e.g. "00A0" in "\u(00A0)"
|
||||
EscapedChar(char), // e.g. '\n' in "Hello!\n"
|
||||
EscapedChar(EscapedChar), // e.g. '\n' in "Hello!\n"
|
||||
Interpolated(Loc<&'a Expr<'a>>), // e.g. (name) in "Hi, \(name)!"
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
pub enum EscapedChar {
|
||||
Newline, // \n
|
||||
Tab, // \t
|
||||
Quote, // \"
|
||||
Backslash, // \\
|
||||
CarriageReturn, // \r
|
||||
}
|
||||
|
||||
impl EscapedChar {
|
||||
/// Returns the char that would have been originally parsed to
|
||||
pub fn to_parsed_char(&self) -> char {
|
||||
use EscapedChar::*;
|
||||
|
||||
match self {
|
||||
Backslash => '\\',
|
||||
Quote => '"',
|
||||
CarriageReturn => 'r',
|
||||
Tab => 't',
|
||||
Newline => 'n',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum StrLiteral<'a> {
|
||||
/// The most common case: a plain string with no escapes or interpolations
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue