mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
generalize
This commit is contained in:
parent
845307f94e
commit
8b9804adc2
1 changed files with 10 additions and 3 deletions
|
@ -406,7 +406,7 @@ fn provides_without_to_help<'a>() -> impl Parser<
|
|||
),
|
||||
collection_e!(
|
||||
word1(b'[', EProvides::ListStart),
|
||||
exposes_entry(),
|
||||
exposes_entry(EProvides::Identifier),
|
||||
word1(b',', EProvides::ListEnd),
|
||||
word1(b']', EProvides::ListEnd),
|
||||
min_indent,
|
||||
|
@ -416,9 +416,16 @@ fn provides_without_to_help<'a>() -> impl Parser<
|
|||
)
|
||||
}
|
||||
|
||||
fn exposes_entry<'a>() -> impl Parser<'a, Located<ExposesEntry<'a, &'a str>>, EProvides> {
|
||||
fn exposes_entry<'a, F, E>(
|
||||
to_expectation: F,
|
||||
) -> impl Parser<'a, Located<ExposesEntry<'a, &'a str>>, E>
|
||||
where
|
||||
F: Fn(crate::parser::Row, crate::parser::Col) -> E,
|
||||
F: Copy,
|
||||
E: 'a,
|
||||
{
|
||||
loc!(map!(
|
||||
specialize(|_, r, c| EProvides::Identifier(r, c), unqualified_ident()),
|
||||
specialize(|_, r, c| to_expectation(r, c), unqualified_ident()),
|
||||
ExposesEntry::Exposed
|
||||
))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue