mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
Allow for shorter app headers
This commit is contained in:
parent
ecfdadb5e3
commit
1868051105
6 changed files with 57 additions and 22 deletions
|
@ -76,13 +76,19 @@ pub struct InterfaceHeader<'a> {
|
|||
pub after_imports: &'a [CommentOrNewline<'a>],
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum To<'a> {
|
||||
ExistingPackage(&'a str),
|
||||
NewPackage(PackageOrPath<'a>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct AppHeader<'a> {
|
||||
pub name: Loc<StrLiteral<'a>>,
|
||||
pub packages: Vec<'a, Loc<PackageEntry<'a>>>,
|
||||
pub imports: Vec<'a, Loc<ImportsEntry<'a>>>,
|
||||
pub provides: Vec<'a, Loc<ExposesEntry<'a, &'a str>>>,
|
||||
pub to: Loc<&'a str>,
|
||||
pub to: Loc<To<'a>>,
|
||||
|
||||
// Potential comments and newlines - these will typically all be empty.
|
||||
pub after_app_keyword: &'a [CommentOrNewline<'a>],
|
||||
|
@ -256,7 +262,7 @@ pub fn package_entry<'a>() -> impl Parser<'a, PackageEntry<'a>> {
|
|||
}
|
||||
}
|
||||
|
||||
fn package_or_path<'a>() -> impl Parser<'a, PackageOrPath<'a>> {
|
||||
pub fn package_or_path<'a>() -> impl Parser<'a, PackageOrPath<'a>> {
|
||||
map!(
|
||||
either!(
|
||||
string_literal::parse(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue