Convert exposes_values to ccollection_trailing_sep_e

This commit is contained in:
Joshua Warner 2021-11-12 11:12:17 -08:00
parent 71cc8d4c4b
commit c4e70ca7aa
6 changed files with 12 additions and 9 deletions

View file

@ -60,7 +60,7 @@ impl<'a> ModuleName<'a> {
#[derive(Clone, Debug, PartialEq)]
pub struct InterfaceHeader<'a> {
pub name: Loc<ModuleName<'a>>,
pub exposes: Vec<'a, Loc<ExposesEntry<'a, &'a str>>>,
pub exposes: Collection<'a, Loc<ExposesEntry<'a, &'a str>>>,
pub imports: Collection<'a, Loc<ImportsEntry<'a>>>,
// Potential comments and newlines - these will typically all be empty.

View file

@ -491,7 +491,7 @@ fn exposes_values<'a>() -> impl Parser<
'a,
(
(&'a [CommentOrNewline<'a>], &'a [CommentOrNewline<'a>]),
Vec<'a, Located<ExposesEntry<'a, &'a str>>>,
Collection<'a, Located<ExposesEntry<'a, &'a str>>>,
),
EExposes,
> {
@ -506,14 +506,16 @@ fn exposes_values<'a>() -> impl Parser<
EExposes::IndentExposes,
EExposes::IndentListStart
),
collection_e!(
collection_trailing_sep_e!(
word1(b'[', EExposes::ListStart),
exposes_entry(EExposes::Identifier),
word1(b',', EExposes::ListEnd),
word1(b']', EExposes::ListEnd),
min_indent,
EExposes::Open,
EExposes::Space,
EExposes::IndentListEnd
EExposes::IndentListEnd,
ExposesEntry::SpaceBefore
)
)
}

View file

@ -231,6 +231,7 @@ pub enum EProvides<'a> {
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum EExposes {
Exposes(Row, Col),
Open(Row, Col),
IndentExposes(Row, Col),
IndentListStart(Row, Col),
IndentListEnd(Row, Col),