New package header syntax

Implements the new package header syntax as discussed in Zulip [1].

package [Csv] {
    parser: "../parser/main.roc"
}

Old headers still parse and are automatically upgraded to the new
syntax by the formatter.

[1] 418444862
This commit is contained in:
Agus Zubiaga 2024-03-04 19:58:22 -03:00
parent 8dedd9f03c
commit e3b600c282
No known key found for this signature in database
16 changed files with 169 additions and 132 deletions

View file

@ -244,15 +244,14 @@ impl IterTokens for AppHeader<'_> {
impl IterTokens for PackageHeader<'_> {
fn iter_tokens<'a>(&self, arena: &'a Bump) -> BumpVec<'a, Loc<Token>> {
let Self {
before_name: _,
name,
before_exposes: _,
exposes,
before_packages: _,
packages,
} = self;
(name.iter_tokens(arena).into_iter())
.chain(exposes.item.iter_tokens(arena))
.chain(packages.item.iter_tokens(arena))
(exposes.iter_tokens(arena).into_iter())
.chain(packages.value.iter_tokens(arena))
.collect_in(arena)
}
}