This commit is contained in:
Folkert 2021-03-10 01:08:49 +01:00
parent 2773639c7b
commit d2482246f2
2 changed files with 8 additions and 7 deletions

View file

@ -377,7 +377,7 @@ pub fn package_name<'a>() -> impl Parser<'a, PackageName<'a>, EPackageName> {
} }
} }
fn chomp_package_part<'a>(buffer: &'a [u8]) -> Result<&'a str, Progress> { fn chomp_package_part(buffer: &[u8]) -> Result<&str, Progress> {
use encode_unicode::CharExt; use encode_unicode::CharExt;
let mut chomped = 0; let mut chomped = 0;

View file

@ -74,7 +74,7 @@ fn interface_header<'a>() -> impl Parser<'a, InterfaceHeader<'a>, EHeader<'a>> {
} }
} }
fn chomp_module_name<'a>(buffer: &'a [u8]) -> Result<&'a str, Progress> { fn chomp_module_name(buffer: &[u8]) -> Result<&str, Progress> {
use encode_unicode::CharExt; use encode_unicode::CharExt;
let mut chomped = 0; let mut chomped = 0;
@ -667,6 +667,11 @@ where
fn imports_entry<'a>() -> impl Parser<'a, ImportsEntry<'a>, EImports> { fn imports_entry<'a>() -> impl Parser<'a, ImportsEntry<'a>, EImports> {
let min_indent = 1; let min_indent = 1;
type Temp<'a> = (
(Option<&'a str>, ModuleName<'a>),
Option<Vec<'a, Located<ExposesEntry<'a, &'a str>>>>,
);
map_with_arena!( map_with_arena!(
and!( and!(
and!( and!(
@ -692,11 +697,7 @@ fn imports_entry<'a>() -> impl Parser<'a, ImportsEntry<'a>, EImports> {
) )
)) ))
), ),
|arena, |arena, ((opt_shortname, module_name), opt_values): Temp<'a>| {
((opt_shortname, module_name), opt_values): (
(Option<&'a str>, ModuleName<'a>),
Option<Vec<'a, Located<ExposesEntry<'a, &'a str>>>>
)| {
let exposed_values = opt_values.unwrap_or_else(|| Vec::new_in(arena)); let exposed_values = opt_values.unwrap_or_else(|| Vec::new_in(arena));
match opt_shortname { match opt_shortname {