mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
New app
header syntax
Implements the new app header syntax as discussed in Zulip [1].
app [main] {
cli: platform "../platform/main.roc",
json: "../json/main.roc"
}
Old headers still parse and are automatically upgraded to the new
syntax by the formatter.
[1] 418444862
This commit is contained in:
parent
057a18573a
commit
8dedd9f03c
90 changed files with 1044 additions and 1056 deletions
|
@ -225,17 +225,18 @@ impl IterTokens for ModuleHeader<'_> {
|
|||
impl IterTokens for AppHeader<'_> {
|
||||
fn iter_tokens<'a>(&self, arena: &'a Bump) -> BumpVec<'a, Loc<Token>> {
|
||||
let Self {
|
||||
before_name: _,
|
||||
name,
|
||||
packages,
|
||||
imports,
|
||||
before_provides: _,
|
||||
provides,
|
||||
before_packages: _,
|
||||
packages,
|
||||
old_imports,
|
||||
old_provides_to_new_package: _,
|
||||
} = self;
|
||||
|
||||
(name.iter_tokens(arena).into_iter())
|
||||
.chain(packages.iter().flat_map(|p| p.item.iter_tokens(arena)))
|
||||
.chain(imports.iter().flat_map(|i| i.item.iter_tokens(arena)))
|
||||
(provides.iter_tokens(arena).into_iter())
|
||||
.chain(packages.value.iter_tokens(arena))
|
||||
.chain(provides.iter_tokens(arena))
|
||||
.chain(old_imports.iter().flat_map(|i| i.item.iter_tokens(arena)))
|
||||
.collect_in(arena)
|
||||
}
|
||||
}
|
||||
|
@ -312,6 +313,7 @@ impl IterTokens for Loc<Spaced<'_, PackageEntry<'_>>> {
|
|||
let PackageEntry {
|
||||
shorthand: _,
|
||||
spaces_after_shorthand: _,
|
||||
platform_marker: _,
|
||||
package_name,
|
||||
} = self.value.item();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue