mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
Indented seq parsing for imports
This commit is contained in:
parent
2163b28390
commit
5c387857ff
5 changed files with 77 additions and 2 deletions
|
@ -2723,9 +2723,9 @@ fn try_kw<'a>() -> impl Parser<'a, Expr<'a>, EExpr<'a>> {
|
||||||
|
|
||||||
fn import<'a>() -> impl Parser<'a, ValueDef<'a>, EImport<'a>> {
|
fn import<'a>() -> impl Parser<'a, ValueDef<'a>, EImport<'a>> {
|
||||||
skip_second(
|
skip_second(
|
||||||
skip_first(
|
indented_seq_skip_first(
|
||||||
parser::keyword(keyword::IMPORT, EImport::Import),
|
parser::keyword(keyword::IMPORT, EImport::Import),
|
||||||
increment_min_indent(one_of!(import_body(), import_ingested_file_body())),
|
one_of!(import_body(), import_ingested_file_body()),
|
||||||
),
|
),
|
||||||
require_newline_or_eof(EImport::EndNewline),
|
require_newline_or_eof(EImport::EndNewline),
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
\L ->
|
||||||
|
import U
|
||||||
|
{} e
|
|
@ -0,0 +1,68 @@
|
||||||
|
SpaceAfter(
|
||||||
|
Closure(
|
||||||
|
[
|
||||||
|
@1-2 Tag(
|
||||||
|
"L",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
@6-19 SpaceBefore(
|
||||||
|
Defs(
|
||||||
|
Defs {
|
||||||
|
tags: [
|
||||||
|
EitherIndex(2147483648),
|
||||||
|
],
|
||||||
|
regions: [
|
||||||
|
@6-14,
|
||||||
|
],
|
||||||
|
space_before: [
|
||||||
|
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
|
||||||
|
],
|
||||||
|
space_after: [
|
||||||
|
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
|
||||||
|
],
|
||||||
|
spaces: [],
|
||||||
|
type_defs: [],
|
||||||
|
value_defs: [
|
||||||
|
ModuleImport(
|
||||||
|
ModuleImport {
|
||||||
|
before_name: [],
|
||||||
|
name: @13-14 ImportedModuleName {
|
||||||
|
package: None,
|
||||||
|
name: ModuleName(
|
||||||
|
"U",
|
||||||
|
),
|
||||||
|
},
|
||||||
|
params: None,
|
||||||
|
alias: None,
|
||||||
|
exposed: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
@16-19 SpaceBefore(
|
||||||
|
Apply(
|
||||||
|
@16-18 Record(
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
[
|
||||||
|
@18-19 Var {
|
||||||
|
module_name: "",
|
||||||
|
ident: "e",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
Space,
|
||||||
|
),
|
||||||
|
[
|
||||||
|
Newline,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
[
|
||||||
|
Newline,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
[
|
||||||
|
Newline,
|
||||||
|
],
|
||||||
|
)
|
|
@ -0,0 +1,3 @@
|
||||||
|
\L->
|
||||||
|
import U
|
||||||
|
{}e
|
|
@ -415,6 +415,7 @@ mod test_snapshots {
|
||||||
pass/implements_newlines_comments.expr,
|
pass/implements_newlines_comments.expr,
|
||||||
pass/import.moduledefs,
|
pass/import.moduledefs,
|
||||||
pass/import_from_package.moduledefs,
|
pass/import_from_package.moduledefs,
|
||||||
|
pass/import_in_closure_with_curlies_after.expr,
|
||||||
pass/import_with_alias.moduledefs,
|
pass/import_with_alias.moduledefs,
|
||||||
pass/import_with_comments.moduledefs,
|
pass/import_with_comments.moduledefs,
|
||||||
pass/import_with_exposed.moduledefs,
|
pass/import_with_exposed.moduledefs,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue