mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-10 10:02:38 +03:00
has [abilities] -> implements [abilities]
This commit is contained in:
parent
b1d592ec37
commit
d2fed03cb1
@ -13,7 +13,7 @@ use crate::parser::{
|
|||||||
};
|
};
|
||||||
use crate::parser::{
|
use crate::parser::{
|
||||||
allocated, backtrackable, fail, optional, specialize, specialize_ref, word1, word10, word2,
|
allocated, backtrackable, fail, optional, specialize, specialize_ref, word1, word10, word2,
|
||||||
word3, EType, ETypeApply, ETypeInParens, ETypeInlineAlias, ETypeRecord, ETypeTagUnion, Parser,
|
EType, ETypeApply, ETypeInParens, ETypeInlineAlias, ETypeRecord, ETypeTagUnion, Parser,
|
||||||
Progress::{self, *},
|
Progress::{self, *},
|
||||||
};
|
};
|
||||||
use crate::state::State;
|
use crate::state::State;
|
||||||
@ -520,17 +520,29 @@ fn implements_clause_chain<'a>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parse a has-abilities clause, e.g. `has [Eq, Hash]`.
|
/// Parse a implements-abilities clause, e.g. `implements [Eq, Hash]`.
|
||||||
pub fn has_abilities<'a>() -> impl Parser<'a, Loc<HasAbilities<'a>>, EType<'a>> {
|
pub fn implements_abilities<'a>() -> impl Parser<'a, Loc<HasAbilities<'a>>, EType<'a>> {
|
||||||
increment_min_indent(skip_first!(
|
increment_min_indent(skip_first!(
|
||||||
// Parse "has"; we don't care about this keyword
|
// Parse "implements"; we don't care about this keyword
|
||||||
word3(b'h', b'a', b's', EType::THasClause),
|
word10(
|
||||||
|
b'i',
|
||||||
|
b'm',
|
||||||
|
b'p',
|
||||||
|
b'l',
|
||||||
|
b'e',
|
||||||
|
b'm',
|
||||||
|
b'e',
|
||||||
|
b'n',
|
||||||
|
b't',
|
||||||
|
b's',
|
||||||
|
EType::THasClause
|
||||||
|
),
|
||||||
// Parse "Hash"; this may be qualified from another module like "Hash.Hash"
|
// Parse "Hash"; this may be qualified from another module like "Hash.Hash"
|
||||||
space0_before_e(
|
space0_before_e(
|
||||||
loc!(map!(
|
loc!(map!(
|
||||||
collection_trailing_sep_e!(
|
collection_trailing_sep_e!(
|
||||||
word1(b'[', EType::TStart),
|
word1(b'[', EType::TStart),
|
||||||
loc!(parse_has_ability()),
|
loc!(parse_implements_ability()),
|
||||||
word1(b',', EType::TEnd),
|
word1(b',', EType::TEnd),
|
||||||
word1(b']', EType::TEnd),
|
word1(b']', EType::TEnd),
|
||||||
HasAbility::SpaceBefore
|
HasAbility::SpaceBefore
|
||||||
@ -542,7 +554,7 @@ pub fn has_abilities<'a>() -> impl Parser<'a, Loc<HasAbilities<'a>>, EType<'a>>
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_has_ability<'a>() -> impl Parser<'a, HasAbility<'a>, EType<'a>> {
|
fn parse_implements_ability<'a>() -> impl Parser<'a, HasAbility<'a>, EType<'a>> {
|
||||||
increment_min_indent(record!(HasAbility::HasAbility {
|
increment_min_indent(record!(HasAbility::HasAbility {
|
||||||
ability: loc!(specialize(EType::TApply, concrete_type())),
|
ability: loc!(specialize(EType::TApply, concrete_type())),
|
||||||
impls: optional(backtrackable(space0_before_e(
|
impls: optional(backtrackable(space0_before_e(
|
||||||
|
Loading…
Reference in New Issue
Block a user