mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 11:52:19 +00:00
get basic parsing and formatting working
This commit is contained in:
parent
99547086ee
commit
8f238046be
2 changed files with 11 additions and 3 deletions
|
@ -510,7 +510,7 @@ fn fmt_imports_entry<'a, 'buf>(buf: &mut Buf<'buf>, entry: &ImportsEntry<'a>, in
|
|||
|
||||
IngestedFile(file_name, typed_ident) => {
|
||||
fmt_str_literal(buf, *file_name, indent);
|
||||
buf.push_str(" as ");
|
||||
buf.push_str_allow_spaces(" as ");
|
||||
typed_ident.format(buf, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -643,7 +643,8 @@ fn imports_entry<'a>() -> impl Parser<'a, Spaced<'a, ImportsEntry<'a>>, EImports
|
|||
|
||||
Spaced::Item(entry)
|
||||
}
|
||||
),
|
||||
)
|
||||
.trace("normal_import"),
|
||||
map!(
|
||||
and!(
|
||||
and!(
|
||||
|
@ -651,7 +652,13 @@ fn imports_entry<'a>() -> impl Parser<'a, Spaced<'a, ImportsEntry<'a>>, EImports
|
|||
// TODO: str literal allows for multiline strings. We probably don't want that for file names.
|
||||
specialize(|_, pos| EImports::StrLiteral(pos), parse_str_literal()),
|
||||
// e.g. as
|
||||
word2(b'a', b's', EImports::AsKeyword)
|
||||
and!(
|
||||
and!(
|
||||
space0_e(EImports::AsKeyword),
|
||||
word2(b'a', b's', EImports::AsKeyword)
|
||||
),
|
||||
space0_e(EImports::AsKeyword)
|
||||
)
|
||||
),
|
||||
// e.g. file : Str
|
||||
specialize(|_, pos| EImports::TypedIdent(pos), typed_ident())
|
||||
|
@ -660,6 +667,7 @@ fn imports_entry<'a>() -> impl Parser<'a, Spaced<'a, ImportsEntry<'a>>, EImports
|
|||
Spaced::Item(ImportsEntry::IngestedFile(file_name, typed_ident))
|
||||
}
|
||||
)
|
||||
.trace("ingest_file_import")
|
||||
)
|
||||
.trace("imports_entry")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue