forked from katzen-cafe/iowo
pawarser: require/derive PartialEq
+ Eq
for NodeKind and its contents
This commit is contained in:
parent
91f766c18e
commit
fed8cf2466
4 changed files with 4 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
||||||
use crate::syntax_kind::SyntaxKind;
|
use crate::syntax_kind::SyntaxKind;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone, PartialEq, Eq)]
|
||||||
pub enum SyntaxError {
|
pub enum SyntaxError {
|
||||||
DisallowedKeyType(SyntaxKind),
|
DisallowedKeyType(SyntaxKind),
|
||||||
MemberMissingValue,
|
MemberMissingValue,
|
||||||
|
|
|
@ -13,7 +13,7 @@ pub mod marker;
|
||||||
/// this is used to define some required SyntaxKinds like an EOF token or an error token
|
/// this is used to define some required SyntaxKinds like an EOF token or an error token
|
||||||
pub trait SyntaxElement
|
pub trait SyntaxElement
|
||||||
where
|
where
|
||||||
Self: EnumSetType + Into<rowan::SyntaxKind> + Clone,
|
Self: EnumSetType + Into<rowan::SyntaxKind> + Clone + PartialEq + Eq,
|
||||||
{
|
{
|
||||||
/// EOF value. This will be used by the rest of the parser library to represent an EOF.
|
/// EOF value. This will be used by the rest of the parser library to represent an EOF.
|
||||||
const EOF: Self;
|
const EOF: Self;
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
// TODO: constrain that conversion to `NodeKind::Error` is enforced to be possible
|
// TODO: constrain that conversion to `NodeKind::Error` is enforced to be possible
|
||||||
pub trait SyntaxError
|
pub trait SyntaxError
|
||||||
where
|
where
|
||||||
Self: Clone,
|
Self: Clone + PartialEq + Eq,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ impl<SyntaxKind: SyntaxElement, SyntaxErr: SyntaxError> Event<SyntaxKind, Syntax
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone, PartialEq, Eq)]
|
||||||
pub enum NodeKind<SyntaxKind: SyntaxElement, SyntaxErr: SyntaxError> {
|
pub enum NodeKind<SyntaxKind: SyntaxElement, SyntaxErr: SyntaxError> {
|
||||||
Tombstone,
|
Tombstone,
|
||||||
Syntax(SyntaxKind),
|
Syntax(SyntaxKind),
|
||||||
|
|
Loading…
Reference in a new issue