pawarser: require/derive PartialEq + Eq for NodeKind and its contents

This commit is contained in:
Schrottkatze 2024-10-21 15:15:06 +02:00
parent 91f766c18e
commit fed8cf2466
No known key found for this signature in database
4 changed files with 4 additions and 4 deletions

View file

@ -1,6 +1,6 @@
use crate::syntax_kind::SyntaxKind;
#[derive(Clone)]
#[derive(Clone, PartialEq, Eq)]
pub enum SyntaxError {
DisallowedKeyType(SyntaxKind),
MemberMissingValue,

View file

@ -13,7 +13,7 @@ pub mod marker;
/// this is used to define some required SyntaxKinds like an EOF token or an error token
pub trait SyntaxElement
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.
const EOF: Self;

View file

@ -2,6 +2,6 @@
// TODO: constrain that conversion to `NodeKind::Error` is enforced to be possible
pub trait SyntaxError
where
Self: Clone,
Self: Clone + PartialEq + Eq,
{
}

View file

@ -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> {
Tombstone,
Syntax(SyntaxKind),