Parse and format inline ingested file imports

This commit is contained in:
Agus Zubiaga 2023-12-10 01:23:57 -03:00
parent 42e755677c
commit 4d6e641864
No known key found for this signature in database
10 changed files with 165 additions and 12 deletions

View file

@ -0,0 +1,2 @@
import "path/to/file.txt" as file : Str
import "path/to/file.txt" as file : List U8

View file

@ -0,0 +1,74 @@
Defs {
tags: [
Index(2147483648),
Index(2147483649),
],
regions: [
@0-39,
@40-85,
],
space_before: [
Slice(start = 0, length = 0),
Slice(start = 0, length = 1),
],
space_after: [
Slice(start = 0, length = 0),
Slice(start = 1, length = 0),
],
spaces: [
Newline,
],
type_defs: [],
value_defs: [
IngestedFileImport {
before_path: [],
path: @7-25 PlainLine(
"path/to/file.txt",
),
name: KeywordItem {
keyword: Spaces {
before: [],
item: ImportAsKeyword,
after: [],
},
item: @29-39 TypedIdent {
ident: @29-33 "file",
spaces_before_colon: [],
ann: @36-39 Apply(
"",
"Str",
[],
),
},
},
},
IngestedFileImport {
before_path: [],
path: @47-65 PlainLine(
"path/to/file.txt",
),
name: KeywordItem {
keyword: Spaces {
before: [],
item: ImportAsKeyword,
after: [],
},
item: @70-85 TypedIdent {
ident: @70-74 "file",
spaces_before_colon: [],
ann: @78-85 Apply(
"",
"List",
[
@83-85 Apply(
"",
"U8",
[],
),
],
),
},
},
},
],
}

View file

@ -0,0 +1,2 @@
import "path/to/file.txt" as file : Str
import "path/to/file.txt" as file : List U8

View file

@ -329,6 +329,7 @@ mod test_snapshots {
pass/import_with_alias.moduledefs,
pass/import_with_comments.moduledefs,
pass/import_with_exposed.moduledefs,
pass/ingested_file.moduledefs,
pass/int_with_underscore.expr,
pass/interface_with_newline.header,
pass/lambda_in_chain.expr,