mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Merge branch 'to' into packages
This commit is contained in:
commit
ec9cf4efe2
14 changed files with 70 additions and 68 deletions
|
@ -9,7 +9,7 @@ use roc_parse::ast::{Collection, Header, Module, Spaced, Spaces};
|
||||||
use roc_parse::header::{
|
use roc_parse::header::{
|
||||||
AppHeader, ExposedName, ExposesKeyword, GeneratesKeyword, HostedHeader, ImportsEntry,
|
AppHeader, ExposedName, ExposesKeyword, GeneratesKeyword, HostedHeader, ImportsEntry,
|
||||||
ImportsKeyword, InterfaceHeader, Keyword, KeywordItem, ModuleName, PackageEntry, PackageHeader,
|
ImportsKeyword, InterfaceHeader, Keyword, KeywordItem, ModuleName, PackageEntry, PackageHeader,
|
||||||
PackageKeyword, PackageName, PackagesKeyword, PlatformHeader, PlatformRequires,
|
PackageKeyword, PackagePath, PackagesKeyword, PlatformHeader, PlatformRequires,
|
||||||
ProvidesKeyword, ProvidesTo, RequiresKeyword, To, ToKeyword, TypedIdent, WithKeyword,
|
ProvidesKeyword, ProvidesTo, RequiresKeyword, To, ToKeyword, TypedIdent, WithKeyword,
|
||||||
};
|
};
|
||||||
use roc_parse::ident::UppercaseIdent;
|
use roc_parse::ident::UppercaseIdent;
|
||||||
|
@ -293,7 +293,7 @@ impl<'a> Formattable for TypedIdent<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fmt_package_name<'buf>(buf: &mut Buf<'buf>, name: PackageName, _indent: u16) {
|
fn fmt_package_name<'buf>(buf: &mut Buf<'buf>, name: PackagePath, _indent: u16) {
|
||||||
buf.push('"');
|
buf.push('"');
|
||||||
buf.push_str_allow_spaces(name.to_str());
|
buf.push_str_allow_spaces(name.to_str());
|
||||||
buf.push('"');
|
buf.push('"');
|
||||||
|
@ -470,7 +470,7 @@ fn fmt_packages_entry<'a, 'buf>(buf: &mut Buf<'buf>, entry: &PackageEntry<'a>, i
|
||||||
buf.push_str(entry.shorthand);
|
buf.push_str(entry.shorthand);
|
||||||
buf.push(':');
|
buf.push(':');
|
||||||
fmt_default_spaces(buf, entry.spaces_after_shorthand, indent);
|
fmt_default_spaces(buf, entry.spaces_after_shorthand, indent);
|
||||||
fmt_package_name(buf, entry.package_name.value, indent);
|
fmt_package_name(buf, entry.package_path.value, indent);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fmt_imports_entry<'a, 'buf>(buf: &mut Buf<'buf>, entry: &ImportsEntry<'a>, indent: u16) {
|
fn fmt_imports_entry<'a, 'buf>(buf: &mut Buf<'buf>, entry: &ImportsEntry<'a>, indent: u16) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ use roc_parse::{
|
||||||
},
|
},
|
||||||
header::{
|
header::{
|
||||||
AppHeader, ExposedName, HostedHeader, ImportsEntry, InterfaceHeader, KeywordItem,
|
AppHeader, ExposedName, HostedHeader, ImportsEntry, InterfaceHeader, KeywordItem,
|
||||||
ModuleName, PackageEntry, PackageHeader, PackageName, PlatformHeader, PlatformRequires,
|
ModuleName, PackageEntry, PackageHeader, PackagePath, PlatformHeader, PlatformRequires,
|
||||||
ProvidesTo, To, TypedIdent,
|
ProvidesTo, To, TypedIdent,
|
||||||
},
|
},
|
||||||
ident::UppercaseIdent,
|
ident::UppercaseIdent,
|
||||||
|
@ -355,7 +355,7 @@ impl<'a> RemoveSpaces<'a> for ModuleName<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> RemoveSpaces<'a> for PackageName<'a> {
|
impl<'a> RemoveSpaces<'a> for PackagePath<'a> {
|
||||||
fn remove_spaces(&self, _arena: &'a Bump) -> Self {
|
fn remove_spaces(&self, _arena: &'a Bump) -> Self {
|
||||||
*self
|
*self
|
||||||
}
|
}
|
||||||
|
@ -400,7 +400,7 @@ impl<'a> RemoveSpaces<'a> for PackageEntry<'a> {
|
||||||
PackageEntry {
|
PackageEntry {
|
||||||
shorthand: self.shorthand,
|
shorthand: self.shorthand,
|
||||||
spaces_after_shorthand: &[],
|
spaces_after_shorthand: &[],
|
||||||
package_name: self.package_name.remove_spaces(arena),
|
package_path: self.package_path.remove_spaces(arena),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ use roc_packaging::cache::{self, RocCacheDir};
|
||||||
use roc_packaging::https::PackageMetadata;
|
use roc_packaging::https::PackageMetadata;
|
||||||
use roc_parse::ast::{self, Defs, ExtractSpaces, Spaced, StrLiteral, TypeAnnotation};
|
use roc_parse::ast::{self, Defs, ExtractSpaces, Spaced, StrLiteral, TypeAnnotation};
|
||||||
use roc_parse::header::{ExposedName, ImportsEntry, PackageEntry, PlatformHeader, To, TypedIdent};
|
use roc_parse::header::{ExposedName, ImportsEntry, PackageEntry, PlatformHeader, To, TypedIdent};
|
||||||
use roc_parse::header::{HeaderType, PackageName};
|
use roc_parse::header::{HeaderType, PackagePath};
|
||||||
use roc_parse::module::module_defs;
|
use roc_parse::module::module_defs;
|
||||||
use roc_parse::parser::{FileError, Parser, SourceError, SyntaxError};
|
use roc_parse::parser::{FileError, Parser, SourceError, SyntaxError};
|
||||||
use roc_problem::Severity;
|
use roc_problem::Severity;
|
||||||
|
@ -642,7 +642,7 @@ struct ModuleHeader<'a> {
|
||||||
is_root_module: bool,
|
is_root_module: bool,
|
||||||
exposed_ident_ids: IdentIds,
|
exposed_ident_ids: IdentIds,
|
||||||
deps_by_name: MutMap<PQModuleName<'a>, ModuleId>,
|
deps_by_name: MutMap<PQModuleName<'a>, ModuleId>,
|
||||||
packages: MutMap<&'a str, PackageName<'a>>,
|
packages: MutMap<&'a str, PackagePath<'a>>,
|
||||||
imported_modules: MutMap<ModuleId, Region>,
|
imported_modules: MutMap<ModuleId, Region>,
|
||||||
package_qualified_imported_modules: MutSet<PackageQualified<'a, ModuleId>>,
|
package_qualified_imported_modules: MutSet<PackageQualified<'a, ModuleId>>,
|
||||||
exposes: Vec<Symbol>,
|
exposes: Vec<Symbol>,
|
||||||
|
@ -3938,21 +3938,6 @@ fn parse_header<'a>(
|
||||||
module_timing,
|
module_timing,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Look at the app module's `to` keyword to determine which package was the platform.
|
|
||||||
let platform_shorthand = match header.provides.to.value {
|
|
||||||
To::ExistingPackage(shorthand) => {
|
|
||||||
if !packages
|
|
||||||
.iter()
|
|
||||||
.any(|Loc { value, .. }| value.shorthand == shorthand)
|
|
||||||
{
|
|
||||||
todo!("Gracefully handle platform shorthand after `to` that didn't map to a shorthand specified in `packages`");
|
|
||||||
}
|
|
||||||
|
|
||||||
shorthand
|
|
||||||
}
|
|
||||||
To::NewPackage(_package_name) => unreachable!("To::NewPackage is deprecated"),
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut messages = load_packages(
|
let mut messages = load_packages(
|
||||||
packages,
|
packages,
|
||||||
roc_cache_dir,
|
roc_cache_dir,
|
||||||
|
@ -3965,12 +3950,29 @@ fn parse_header<'a>(
|
||||||
|
|
||||||
messages.push(Msg::Header(resolved_header));
|
messages.push(Msg::Header(resolved_header));
|
||||||
|
|
||||||
|
// Look at the app module's `to` keyword to determine which package was the platform.
|
||||||
|
match header.provides.to.value {
|
||||||
|
To::ExistingPackage(shorthand) => {
|
||||||
|
if !packages
|
||||||
|
.iter()
|
||||||
|
.any(|loc_package_entry| loc_package_entry.value.shorthand == shorthand)
|
||||||
|
{
|
||||||
|
todo!("Gracefully handle platform shorthand after `to` that didn't map to a shorthand specified in `packages`");
|
||||||
|
}
|
||||||
|
|
||||||
Ok(HeaderOutput {
|
Ok(HeaderOutput {
|
||||||
module_id,
|
module_id,
|
||||||
msg: Msg::Many(messages),
|
msg: Msg::Many(messages),
|
||||||
opt_platform_shorthand: Some(platform_shorthand),
|
opt_platform_shorthand: Some(shorthand),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
To::NewPackage(_package_name) => Ok(HeaderOutput {
|
||||||
|
module_id,
|
||||||
|
msg: Msg::Many(messages),
|
||||||
|
opt_platform_shorthand: None,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
Ok((
|
Ok((
|
||||||
ast::Module {
|
ast::Module {
|
||||||
header: ast::Header::Package(header),
|
header: ast::Header::Package(header),
|
||||||
|
@ -4016,7 +4018,7 @@ fn parse_header<'a>(
|
||||||
fn load_packages<'a>(
|
fn load_packages<'a>(
|
||||||
packages: &[Loc<PackageEntry<'a>>],
|
packages: &[Loc<PackageEntry<'a>>],
|
||||||
roc_cache_dir: RocCacheDir,
|
roc_cache_dir: RocCacheDir,
|
||||||
app_file_dir: PathBuf,
|
cwd: PathBuf,
|
||||||
arena: &'a Bump,
|
arena: &'a Bump,
|
||||||
module_id: ModuleId,
|
module_id: ModuleId,
|
||||||
module_ids: Arc<Mutex<PackageModuleIds<'a>>>,
|
module_ids: Arc<Mutex<PackageModuleIds<'a>>>,
|
||||||
|
@ -4029,7 +4031,7 @@ fn load_packages<'a>(
|
||||||
for Loc { value: entry, .. } in packages.iter() {
|
for Loc { value: entry, .. } in packages.iter() {
|
||||||
let PackageEntry {
|
let PackageEntry {
|
||||||
shorthand,
|
shorthand,
|
||||||
package_name:
|
package_path:
|
||||||
Loc {
|
Loc {
|
||||||
value: package_path,
|
value: package_path,
|
||||||
..
|
..
|
||||||
|
@ -4069,7 +4071,7 @@ fn load_packages<'a>(
|
||||||
panic!("Specifying packages via URLs is curently unsupported in wasm.");
|
panic!("Specifying packages via URLs is curently unsupported in wasm.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
app_file_dir.join(src)
|
cwd.join(src)
|
||||||
};
|
};
|
||||||
|
|
||||||
match load_package_from_disk(
|
match load_package_from_disk(
|
||||||
|
@ -4412,7 +4414,7 @@ fn build_header<'a>(
|
||||||
|
|
||||||
let package_entries = packages
|
let package_entries = packages
|
||||||
.iter()
|
.iter()
|
||||||
.map(|Loc { value: pkg, .. }| (pkg.shorthand, pkg.package_name.value))
|
.map(|Loc { value: pkg, .. }| (pkg.shorthand, pkg.package_path.value))
|
||||||
.collect::<MutMap<_, _>>();
|
.collect::<MutMap<_, _>>();
|
||||||
|
|
||||||
// Send the deps to the coordinator thread for processing,
|
// Send the deps to the coordinator thread for processing,
|
||||||
|
|
|
@ -2,7 +2,7 @@ use crate::ast::{Collection, CommentOrNewline, Spaced, Spaces, StrLiteral, TypeA
|
||||||
use crate::blankspace::space0_e;
|
use crate::blankspace::space0_e;
|
||||||
use crate::ident::{lowercase_ident, UppercaseIdent};
|
use crate::ident::{lowercase_ident, UppercaseIdent};
|
||||||
use crate::parser::{optional, then};
|
use crate::parser::{optional, then};
|
||||||
use crate::parser::{specialize, word1, EPackageEntry, EPackageName, Parser};
|
use crate::parser::{specialize, word1, EPackageEntry, EPackagePath, Parser};
|
||||||
use crate::string_literal;
|
use crate::string_literal;
|
||||||
use roc_module::symbol::{ModuleId, Symbol};
|
use roc_module::symbol::{ModuleId, Symbol};
|
||||||
use roc_region::all::Loc;
|
use roc_region::all::Loc;
|
||||||
|
@ -58,9 +58,9 @@ pub enum VersionComparison {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||||
pub struct PackageName<'a>(&'a str);
|
pub struct PackagePath<'a>(&'a str);
|
||||||
|
|
||||||
impl<'a> PackageName<'a> {
|
impl<'a> PackagePath<'a> {
|
||||||
pub fn to_str(self) -> &'a str {
|
pub fn to_str(self) -> &'a str {
|
||||||
self.0
|
self.0
|
||||||
}
|
}
|
||||||
|
@ -70,13 +70,13 @@ impl<'a> PackageName<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> From<PackageName<'a>> for &'a str {
|
impl<'a> From<PackagePath<'a>> for &'a str {
|
||||||
fn from(name: PackageName<'a>) -> &'a str {
|
fn from(name: PackagePath<'a>) -> &'a str {
|
||||||
name.0
|
name.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> From<&'a str> for PackageName<'a> {
|
impl<'a> From<&'a str> for PackagePath<'a> {
|
||||||
fn from(string: &'a str) -> Self {
|
fn from(string: &'a str) -> Self {
|
||||||
Self(string)
|
Self(string)
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ pub struct HostedHeader<'a> {
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum To<'a> {
|
pub enum To<'a> {
|
||||||
ExistingPackage(&'a str),
|
ExistingPackage(&'a str),
|
||||||
NewPackage(PackageName<'a>), // TODO is this obsolete? Seems like it should be deleted!
|
NewPackage(PackagePath<'a>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
|
@ -208,7 +208,7 @@ pub struct ProvidesTo<'a> {
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
pub struct PackageHeader<'a> {
|
pub struct PackageHeader<'a> {
|
||||||
pub before_name: &'a [CommentOrNewline<'a>],
|
pub before_name: &'a [CommentOrNewline<'a>],
|
||||||
pub name: Loc<PackageName<'a>>,
|
pub name: Loc<PackagePath<'a>>,
|
||||||
|
|
||||||
pub exposes: KeywordItem<'a, ExposesKeyword, Collection<'a, Loc<Spaced<'a, ModuleName<'a>>>>>,
|
pub exposes: KeywordItem<'a, ExposesKeyword, Collection<'a, Loc<Spaced<'a, ModuleName<'a>>>>>,
|
||||||
pub packages:
|
pub packages:
|
||||||
|
@ -224,7 +224,7 @@ pub struct PlatformRequires<'a> {
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
pub struct PlatformHeader<'a> {
|
pub struct PlatformHeader<'a> {
|
||||||
pub before_name: &'a [CommentOrNewline<'a>],
|
pub before_name: &'a [CommentOrNewline<'a>],
|
||||||
pub name: Loc<PackageName<'a>>,
|
pub name: Loc<PackagePath<'a>>,
|
||||||
|
|
||||||
pub requires: KeywordItem<'a, RequiresKeyword, PlatformRequires<'a>>,
|
pub requires: KeywordItem<'a, RequiresKeyword, PlatformRequires<'a>>,
|
||||||
pub exposes: KeywordItem<'a, ExposesKeyword, Collection<'a, Loc<Spaced<'a, ModuleName<'a>>>>>,
|
pub exposes: KeywordItem<'a, ExposesKeyword, Collection<'a, Loc<Spaced<'a, ModuleName<'a>>>>>,
|
||||||
|
@ -265,7 +265,7 @@ pub struct TypedIdent<'a> {
|
||||||
pub struct PackageEntry<'a> {
|
pub struct PackageEntry<'a> {
|
||||||
pub shorthand: &'a str,
|
pub shorthand: &'a str,
|
||||||
pub spaces_after_shorthand: &'a [CommentOrNewline<'a>],
|
pub spaces_after_shorthand: &'a [CommentOrNewline<'a>],
|
||||||
pub package_name: Loc<PackageName<'a>>,
|
pub package_path: Loc<PackagePath<'a>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn package_entry<'a>() -> impl Parser<'a, Spaced<'a, PackageEntry<'a>>, EPackageEntry<'a>> {
|
pub fn package_entry<'a>() -> impl Parser<'a, Spaced<'a, PackageEntry<'a>>, EPackageEntry<'a>> {
|
||||||
|
@ -282,19 +282,19 @@ pub fn package_entry<'a>() -> impl Parser<'a, Spaced<'a, PackageEntry<'a>>, EPac
|
||||||
),
|
),
|
||||||
space0_e(EPackageEntry::IndentPackage)
|
space0_e(EPackageEntry::IndentPackage)
|
||||||
)),
|
)),
|
||||||
loc!(specialize(EPackageEntry::BadPackage, package_name()))
|
loc!(specialize(EPackageEntry::BadPackage, package_path()))
|
||||||
),
|
),
|
||||||
move |(opt_shorthand, package_or_path)| {
|
move |(opt_shorthand, package_or_path)| {
|
||||||
let entry = match opt_shorthand {
|
let entry = match opt_shorthand {
|
||||||
Some((shorthand, spaces_after_shorthand)) => PackageEntry {
|
Some((shorthand, spaces_after_shorthand)) => PackageEntry {
|
||||||
shorthand,
|
shorthand,
|
||||||
spaces_after_shorthand,
|
spaces_after_shorthand,
|
||||||
package_name: package_or_path,
|
package_path: package_or_path,
|
||||||
},
|
},
|
||||||
None => PackageEntry {
|
None => PackageEntry {
|
||||||
shorthand: "",
|
shorthand: "",
|
||||||
spaces_after_shorthand: &[],
|
spaces_after_shorthand: &[],
|
||||||
package_name: package_or_path,
|
package_path: package_or_path,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -303,13 +303,13 @@ pub fn package_entry<'a>() -> impl Parser<'a, Spaced<'a, PackageEntry<'a>>, EPac
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn package_name<'a>() -> impl Parser<'a, PackageName<'a>, EPackageName<'a>> {
|
pub fn package_path<'a>() -> impl Parser<'a, PackagePath<'a>, EPackagePath<'a>> {
|
||||||
then(
|
then(
|
||||||
loc!(specialize(EPackageName::BadPath, string_literal::parse())),
|
loc!(specialize(EPackagePath::BadPath, string_literal::parse())),
|
||||||
move |_arena, state, progress, text| match text.value {
|
move |_arena, state, progress, text| match text.value {
|
||||||
StrLiteral::PlainLine(text) => Ok((progress, PackageName(text), state)),
|
StrLiteral::PlainLine(text) => Ok((progress, PackagePath(text), state)),
|
||||||
StrLiteral::Line(_) => Err((progress, EPackageName::Escapes(text.region.start()))),
|
StrLiteral::Line(_) => Err((progress, EPackagePath::Escapes(text.region.start()))),
|
||||||
StrLiteral::Block(_) => Err((progress, EPackageName::Multiline(text.region.start()))),
|
StrLiteral::Block(_) => Err((progress, EPackagePath::Multiline(text.region.start()))),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::ast::{Collection, Defs, Header, Module, Spaced, Spaces};
|
use crate::ast::{Collection, Defs, Header, Module, Spaced, Spaces};
|
||||||
use crate::blankspace::{space0_around_ee, space0_before_e, space0_e};
|
use crate::blankspace::{space0_around_ee, space0_before_e, space0_e};
|
||||||
use crate::header::{
|
use crate::header::{
|
||||||
package_entry, package_name, AppHeader, ExposedName, ExposesKeyword, GeneratesKeyword,
|
package_entry, package_path, AppHeader, ExposedName, ExposesKeyword, GeneratesKeyword,
|
||||||
HostedHeader, ImportsEntry, ImportsKeyword, InterfaceHeader, Keyword, KeywordItem, ModuleName,
|
HostedHeader, ImportsEntry, ImportsKeyword, InterfaceHeader, Keyword, KeywordItem, ModuleName,
|
||||||
PackageEntry, PackageHeader, PackagesKeyword, PlatformHeader, PlatformRequires,
|
PackageEntry, PackageHeader, PackagesKeyword, PlatformHeader, PlatformRequires,
|
||||||
ProvidesKeyword, ProvidesTo, RequiresKeyword, To, ToKeyword, TypedIdent, WithKeyword,
|
ProvidesKeyword, ProvidesTo, RequiresKeyword, To, ToKeyword, TypedIdent, WithKeyword,
|
||||||
|
@ -194,7 +194,7 @@ fn app_header<'a>() -> impl Parser<'a, AppHeader<'a>, EHeader<'a>> {
|
||||||
fn package_header<'a>() -> impl Parser<'a, PackageHeader<'a>, EHeader<'a>> {
|
fn package_header<'a>() -> impl Parser<'a, PackageHeader<'a>, EHeader<'a>> {
|
||||||
record!(PackageHeader {
|
record!(PackageHeader {
|
||||||
before_name: space0_e(EHeader::IndentStart),
|
before_name: space0_e(EHeader::IndentStart),
|
||||||
name: loc!(specialize(EHeader::PackageName, package_name())),
|
name: loc!(specialize(EHeader::PackageName, package_path())),
|
||||||
exposes: specialize(EHeader::Exposes, exposes_modules()),
|
exposes: specialize(EHeader::Exposes, exposes_modules()),
|
||||||
packages: specialize(EHeader::Packages, packages()),
|
packages: specialize(EHeader::Packages, packages()),
|
||||||
})
|
})
|
||||||
|
@ -205,7 +205,7 @@ fn package_header<'a>() -> impl Parser<'a, PackageHeader<'a>, EHeader<'a>> {
|
||||||
fn platform_header<'a>() -> impl Parser<'a, PlatformHeader<'a>, EHeader<'a>> {
|
fn platform_header<'a>() -> impl Parser<'a, PlatformHeader<'a>, EHeader<'a>> {
|
||||||
record!(PlatformHeader {
|
record!(PlatformHeader {
|
||||||
before_name: space0_e(EHeader::IndentStart),
|
before_name: space0_e(EHeader::IndentStart),
|
||||||
name: loc!(specialize(EHeader::PlatformName, package_name())),
|
name: loc!(specialize(EHeader::PlatformName, package_path())),
|
||||||
requires: specialize(EHeader::Requires, requires()),
|
requires: specialize(EHeader::Requires, requires()),
|
||||||
exposes: specialize(EHeader::Exposes, exposes_modules()),
|
exposes: specialize(EHeader::Exposes, exposes_modules()),
|
||||||
packages: specialize(EHeader::Packages, packages()),
|
packages: specialize(EHeader::Packages, packages()),
|
||||||
|
@ -221,7 +221,7 @@ fn provides_to_package<'a>() -> impl Parser<'a, To<'a>, EProvides<'a>> {
|
||||||
|_, pos| EProvides::Identifier(pos),
|
|_, pos| EProvides::Identifier(pos),
|
||||||
map!(lowercase_ident(), To::ExistingPackage)
|
map!(lowercase_ident(), To::ExistingPackage)
|
||||||
),
|
),
|
||||||
specialize(EProvides::Package, map!(package_name(), To::NewPackage))
|
specialize(EProvides::Package, map!(package_path(), To::NewPackage))
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,8 +127,8 @@ pub enum EHeader<'a> {
|
||||||
Start(Position),
|
Start(Position),
|
||||||
ModuleName(Position),
|
ModuleName(Position),
|
||||||
AppName(EString<'a>, Position),
|
AppName(EString<'a>, Position),
|
||||||
PackageName(EPackageName<'a>, Position),
|
PackageName(EPackagePath<'a>, Position),
|
||||||
PlatformName(EPackageName<'a>, Position),
|
PlatformName(EPackagePath<'a>, Position),
|
||||||
IndentStart(Position),
|
IndentStart(Position),
|
||||||
|
|
||||||
InconsistentModuleName(Region),
|
InconsistentModuleName(Region),
|
||||||
|
@ -147,7 +147,7 @@ pub enum EProvides<'a> {
|
||||||
ListStart(Position),
|
ListStart(Position),
|
||||||
ListEnd(Position),
|
ListEnd(Position),
|
||||||
Identifier(Position),
|
Identifier(Position),
|
||||||
Package(EPackageName<'a>, Position),
|
Package(EPackagePath<'a>, Position),
|
||||||
Space(BadInputError, Position),
|
Space(BadInputError, Position),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ pub enum EPackages<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub enum EPackageName<'a> {
|
pub enum EPackagePath<'a> {
|
||||||
BadPath(EString<'a>, Position),
|
BadPath(EString<'a>, Position),
|
||||||
Escapes(Position),
|
Escapes(Position),
|
||||||
Multiline(Position),
|
Multiline(Position),
|
||||||
|
@ -211,7 +211,7 @@ pub enum EPackageName<'a> {
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub enum EPackageEntry<'a> {
|
pub enum EPackageEntry<'a> {
|
||||||
BadPackage(EPackageName<'a>, Position),
|
BadPackage(EPackagePath<'a>, Position),
|
||||||
Shorthand(Position),
|
Shorthand(Position),
|
||||||
Colon(Position),
|
Colon(Position),
|
||||||
IndentPackage(Position),
|
IndentPackage(Position),
|
||||||
|
|
|
@ -3,7 +3,7 @@ Module {
|
||||||
header: Platform(
|
header: Platform(
|
||||||
PlatformHeader {
|
PlatformHeader {
|
||||||
before_name: [],
|
before_name: [],
|
||||||
name: @9-25 PackageName(
|
name: @9-25 PackagePath(
|
||||||
"rtfeldman/blah",
|
"rtfeldman/blah",
|
||||||
),
|
),
|
||||||
requires: KeywordItem {
|
requires: KeywordItem {
|
||||||
|
|
|
@ -19,7 +19,7 @@ Module {
|
||||||
@31-47 PackageEntry {
|
@31-47 PackageEntry {
|
||||||
shorthand: "pf",
|
shorthand: "pf",
|
||||||
spaces_after_shorthand: [],
|
spaces_after_shorthand: [],
|
||||||
package_name: @35-47 PackageName(
|
package_path: @35-47 PackagePath(
|
||||||
"./platform",
|
"./platform",
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
|
@ -19,7 +19,7 @@ Module {
|
||||||
@31-47 PackageEntry {
|
@31-47 PackageEntry {
|
||||||
shorthand: "pf",
|
shorthand: "pf",
|
||||||
spaces_after_shorthand: [],
|
spaces_after_shorthand: [],
|
||||||
package_name: @35-47 PackageName(
|
package_path: @35-47 PackagePath(
|
||||||
"./platform",
|
"./platform",
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,7 +3,7 @@ Module {
|
||||||
header: Platform(
|
header: Platform(
|
||||||
PlatformHeader {
|
PlatformHeader {
|
||||||
before_name: [],
|
before_name: [],
|
||||||
name: @9-14 PackageName(
|
name: @9-14 PackagePath(
|
||||||
"cli",
|
"cli",
|
||||||
),
|
),
|
||||||
requires: KeywordItem {
|
requires: KeywordItem {
|
||||||
|
|
|
@ -22,7 +22,7 @@ Module {
|
||||||
after: [],
|
after: [],
|
||||||
},
|
},
|
||||||
to: @30-38 NewPackage(
|
to: @30-38 NewPackage(
|
||||||
PackageName(
|
PackagePath(
|
||||||
"./blah",
|
"./blah",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -3,7 +3,7 @@ Module {
|
||||||
header: Platform(
|
header: Platform(
|
||||||
PlatformHeader {
|
PlatformHeader {
|
||||||
before_name: [],
|
before_name: [],
|
||||||
name: @9-21 PackageName(
|
name: @9-21 PackagePath(
|
||||||
"foo/barbaz",
|
"foo/barbaz",
|
||||||
),
|
),
|
||||||
requires: KeywordItem {
|
requires: KeywordItem {
|
||||||
|
@ -52,7 +52,7 @@ Module {
|
||||||
@87-99 PackageEntry {
|
@87-99 PackageEntry {
|
||||||
shorthand: "foo",
|
shorthand: "foo",
|
||||||
spaces_after_shorthand: [],
|
spaces_after_shorthand: [],
|
||||||
package_name: @92-99 PackageName(
|
package_path: @92-99 PackagePath(
|
||||||
"./foo",
|
"./foo",
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
|
@ -19,7 +19,7 @@ Module {
|
||||||
@26-42 PackageEntry {
|
@26-42 PackageEntry {
|
||||||
shorthand: "pf",
|
shorthand: "pf",
|
||||||
spaces_after_shorthand: [],
|
spaces_after_shorthand: [],
|
||||||
package_name: @30-42 PackageName(
|
package_path: @30-42 PackagePath(
|
||||||
"./platform",
|
"./platform",
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,7 +3,7 @@ Module {
|
||||||
header: Platform(
|
header: Platform(
|
||||||
PlatformHeader {
|
PlatformHeader {
|
||||||
before_name: [],
|
before_name: [],
|
||||||
name: @9-21 PackageName(
|
name: @9-21 PackagePath(
|
||||||
"test/types",
|
"test/types",
|
||||||
),
|
),
|
||||||
requires: KeywordItem {
|
requires: KeywordItem {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue