mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
Get things compiling
This commit is contained in:
parent
70bef827a7
commit
f35e43768a
18 changed files with 541 additions and 253 deletions
|
@ -28,7 +28,6 @@ impl<'a> Formattable<'a> for Expr<'a> {
|
|||
Float(_)
|
||||
| Num(_)
|
||||
| NonBase10Int { .. }
|
||||
| Str(_)
|
||||
| Access(_, _)
|
||||
| AccessorFunction(_)
|
||||
| Var { .. }
|
||||
|
@ -42,7 +41,13 @@ impl<'a> Formattable<'a> for Expr<'a> {
|
|||
|
||||
List(elems) => elems.iter().any(|loc_expr| loc_expr.is_multiline()),
|
||||
|
||||
BlockStr(lines) => lines.len() > 1,
|
||||
Str(literal) => {
|
||||
todo!(
|
||||
"fmt determine if string literal is multiline: {:?}",
|
||||
literal
|
||||
);
|
||||
// lines.len() > 1
|
||||
}
|
||||
Apply(loc_expr, args, _) => {
|
||||
loc_expr.is_multiline() || args.iter().any(|loc_arg| loc_arg.is_multiline())
|
||||
}
|
||||
|
@ -112,10 +117,19 @@ impl<'a> Formattable<'a> for Expr<'a> {
|
|||
sub_expr.format_with_options(buf, Parens::NotNeeded, Newlines::Yes, indent);
|
||||
buf.push(')');
|
||||
}
|
||||
Str(string) => {
|
||||
buf.push('"');
|
||||
buf.push_str(string);
|
||||
buf.push('"');
|
||||
Str(literal) => {
|
||||
todo!("fmt string literal {:?}", literal);
|
||||
// buf.push('"');
|
||||
// buf.push_str(string);
|
||||
// buf.push('"');
|
||||
//
|
||||
// BlockStr(lines) => {
|
||||
// buf.push_str("\"\"\"");
|
||||
// for line in lines.iter() {
|
||||
// buf.push_str(line);
|
||||
// }
|
||||
// buf.push_str("\"\"\"");
|
||||
// }
|
||||
}
|
||||
Var { module_name, ident } => {
|
||||
if !module_name.is_empty() {
|
||||
|
@ -152,13 +166,6 @@ impl<'a> Formattable<'a> for Expr<'a> {
|
|||
buf.push(')');
|
||||
}
|
||||
}
|
||||
BlockStr(lines) => {
|
||||
buf.push_str("\"\"\"");
|
||||
for line in lines.iter() {
|
||||
buf.push_str(line);
|
||||
}
|
||||
buf.push_str("\"\"\"");
|
||||
}
|
||||
Num(string) | Float(string) | GlobalTag(string) | PrivateTag(string) => {
|
||||
buf.push_str(string)
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ impl<'a> Formattable<'a> for Pattern<'a> {
|
|||
| Pattern::NonBase10Literal { .. }
|
||||
| Pattern::FloatLiteral(_)
|
||||
| Pattern::StrLiteral(_)
|
||||
| Pattern::BlockStrLiteral(_)
|
||||
| Pattern::Underscore
|
||||
| Pattern::Malformed(_)
|
||||
| Pattern::QualifiedIdentifier { .. } => false,
|
||||
|
@ -126,11 +125,8 @@ impl<'a> Formattable<'a> for Pattern<'a> {
|
|||
buf.push_str(string);
|
||||
}
|
||||
FloatLiteral(string) => buf.push_str(string),
|
||||
StrLiteral(string) => buf.push_str(string),
|
||||
BlockStrLiteral(lines) => {
|
||||
for line in *lines {
|
||||
buf.push_str(line)
|
||||
}
|
||||
StrLiteral(literal) => {
|
||||
todo!("Format string literal: {:?}", literal);
|
||||
}
|
||||
Underscore => buf.push('_'),
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue