Add serde dependency and derive serialization and deserialization for relevant structs

This commit is contained in:
Moritz Hölting 2024-04-06 14:40:44 +02:00
parent 34076f9842
commit 3c3c9e5b24
10 changed files with 44 additions and 4 deletions

View File

@ -8,6 +8,7 @@ edition = "2021"
[features] [features]
default = ["shulkerbox"] default = ["shulkerbox"]
shulkerbox = ["dep:shulkerbox"] shulkerbox = ["dep:shulkerbox"]
serde = ["dep:serde"]
[dependencies] [dependencies]
chksum-md5 = "0.0.0" chksum-md5 = "0.0.0"
@ -15,6 +16,7 @@ colored = "2.1.0"
derive_more = { version = "0.99.17", default-features = false, features = ["deref", "from", "deref_mut"] } derive_more = { version = "0.99.17", default-features = false, features = ["deref", "from", "deref_mut"] }
enum-as-inner = "0.6.0" enum-as-inner = "0.6.0"
getset = "0.1.2" getset = "0.1.2"
serde = { version = "1.0.197", features = ["derive", "rc"], optional = true }
shulkerbox = { path = "../shulkerbox", optional = true} shulkerbox = { path = "../shulkerbox", optional = true}
strum = { version = "0.26.2", features = ["derive"] } strum = { version = "0.26.2", features = ["derive"] }
strum_macros = "0.26.2" strum_macros = "0.26.2"

View File

@ -16,6 +16,7 @@ use getset::{CopyGetters, Getters};
use super::Error; use super::Error;
/// Represents a source file that contains the source code. /// Represents a source file that contains the source code.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone)] #[derive(Clone)]
pub struct SourceFile { pub struct SourceFile {
path: PathBuf, path: PathBuf,
@ -129,6 +130,7 @@ impl SourceFile {
} }
/// Represents a range of characters in a source file. /// Represents a range of characters in a source file.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Getters, CopyGetters)] #[derive(Clone, Getters, CopyGetters)]
pub struct Span { pub struct Span {
/// Get the start byte index of the span. /// Get the start byte index of the span.

View File

@ -14,6 +14,7 @@ use strum_macros::EnumIter;
use super::{error::UnterminatedDelimitedComment, Error}; use super::{error::UnterminatedDelimitedComment, Error};
/// Is an enumeration representing keywords in shulkerscript. /// Is an enumeration representing keywords in shulkerscript.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, EnumIter)] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, EnumIter)]
#[allow(missing_docs)] #[allow(missing_docs)]
pub enum KeywordKind { pub enum KeywordKind {
@ -68,6 +69,7 @@ impl KeywordKind {
} }
/// Is an enumeration containing all kinds of tokens in the Shulkerscript programming language. /// Is an enumeration containing all kinds of tokens in the Shulkerscript programming language.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, From, EnumAsInner)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, From, EnumAsInner)]
#[allow(missing_docs)] #[allow(missing_docs)]
pub enum Token { pub enum Token {
@ -117,6 +119,7 @@ impl SourceElement for Token {
} }
/// Represents a contiguous sequence of whitespace characters. /// Represents a contiguous sequence of whitespace characters.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct WhiteSpaces { pub struct WhiteSpaces {
/// Is the span that makes up the token. /// Is the span that makes up the token.
@ -129,6 +132,7 @@ impl SourceElement for WhiteSpaces {
} }
} }
/// Represents a contiguous sequence of characters that are valid in an identifier. /// Represents a contiguous sequence of characters that are valid in an identifier.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Identifier { pub struct Identifier {
/// Is the span that makes up the token. /// Is the span that makes up the token.
@ -142,6 +146,7 @@ impl SourceElement for Identifier {
} }
/// Represents a contiguous sequence of characters that are reserved for a keyword. /// Represents a contiguous sequence of characters that are reserved for a keyword.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Keyword { pub struct Keyword {
/// Is the span that makes up the token. /// Is the span that makes up the token.
@ -158,6 +163,7 @@ impl SourceElement for Keyword {
} }
/// Represents a single ASCII punctuation character. /// Represents a single ASCII punctuation character.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Punctuation { pub struct Punctuation {
/// Is the span that makes up the token. /// Is the span that makes up the token.
@ -174,6 +180,7 @@ impl SourceElement for Punctuation {
} }
/// Represents a hardcoded numeric literal value in the source code. /// Represents a hardcoded numeric literal value in the source code.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Numeric { pub struct Numeric {
/// Is the span that makes up the token. /// Is the span that makes up the token.
@ -187,6 +194,7 @@ impl SourceElement for Numeric {
} }
/// Represents a hardcoded string literal value in the source code. /// Represents a hardcoded string literal value in the source code.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct StringLiteral { pub struct StringLiteral {
/// Is the span that makes up the token. /// Is the span that makes up the token.
@ -209,6 +217,7 @@ impl SourceElement for StringLiteral {
} }
/// Is an enumeration representing the two kinds of comments in the Shulkerscript programming language. /// Is an enumeration representing the two kinds of comments in the Shulkerscript programming language.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum CommentKind { pub enum CommentKind {
/// A comment that starts with `//` and ends at the end of the line. /// A comment that starts with `//` and ends at the end of the line.
@ -219,6 +228,7 @@ pub enum CommentKind {
} }
/// Represents a portion of the source code that is ignored by the interpreter. /// Represents a portion of the source code that is ignored by the interpreter.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Comment { pub struct Comment {
/// Is the span that makes up the token. /// Is the span that makes up the token.
@ -235,6 +245,7 @@ impl SourceElement for Comment {
} }
/// Represents a documentation comment in the source code. /// Represents a documentation comment in the source code.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct DocComment { pub struct DocComment {
/// Is the span that makes up the token. /// Is the span that makes up the token.
@ -256,6 +267,7 @@ impl DocComment {
} }
/// Represents a hardcoded literal command in the source code. /// Represents a hardcoded literal command in the source code.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct CommandLiteral { pub struct CommandLiteral {
/// Span that makes up the token. /// Span that makes up the token.

View File

@ -15,6 +15,7 @@ use super::{
/// ///
/// This struct is the final output of the lexical analysis phase and is meant to be used by the /// This struct is the final output of the lexical analysis phase and is meant to be used by the
/// next stage of the compilation process. /// next stage of the compilation process.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Deref)] #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Deref)]
pub struct TokenStream { pub struct TokenStream {
#[deref] #[deref]
@ -162,6 +163,7 @@ impl TokenStream {
} }
/// Is an enumeration of either a [`Token`] or a [`Delimited`]. /// Is an enumeration of either a [`Token`] or a [`Delimited`].
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, From)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, From)]
#[allow(missing_docs)] #[allow(missing_docs)]
pub enum TokenTree { pub enum TokenTree {
@ -170,8 +172,8 @@ pub enum TokenTree {
} }
/// Is an enumeration of the different types of delimiters in the [`Delimited`]. /// Is an enumeration of the different types of delimiters in the [`Delimited`].
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[allow(missing_docs)]
pub enum Delimiter { pub enum Delimiter {
/// () /// ()
Parenthesis, Parenthesis,
@ -182,6 +184,7 @@ pub enum Delimiter {
} }
/// Represents a list of tokens enclosed by a pair of delimiters. /// Represents a list of tokens enclosed by a pair of delimiters.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Delimited { pub struct Delimited {
/// The opening delimiter. /// The opening delimiter.

View File

@ -29,6 +29,7 @@ use crate::{
/// | StringLiteral /// | StringLiteral
/// ``` /// ```
#[allow(missing_docs)] #[allow(missing_docs)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, EnumAsInner)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, EnumAsInner)]
pub enum PrimaryCondition { pub enum PrimaryCondition {
Prefix(ConditionalPrefix), Prefix(ConditionalPrefix),
@ -53,6 +54,7 @@ impl SourceElement for PrimaryCondition {
/// Condition ConditionalBinaryOperator Condition /// Condition ConditionalBinaryOperator Condition
/// ; /// ;
/// ``` /// ```
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Getters)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Getters)]
pub struct BinaryCondition { pub struct BinaryCondition {
/// The left operand of the binary condition. /// The left operand of the binary condition.
@ -91,8 +93,9 @@ impl BinaryCondition {
/// | '||' /// | '||'
/// ; /// ;
/// ``` /// ```
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, EnumAsInner)]
#[allow(missing_docs)] #[allow(missing_docs)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, EnumAsInner)]
pub enum ConditionalBinaryOperator { pub enum ConditionalBinaryOperator {
LogicalAnd(Punctuation, Punctuation), LogicalAnd(Punctuation, Punctuation),
LogicalOr(Punctuation, Punctuation), LogicalOr(Punctuation, Punctuation),
@ -128,6 +131,7 @@ impl SourceElement for ConditionalBinaryOperator {
/// ParenthesizedCondition: /// ParenthesizedCondition:
/// '(' Condition ')'; /// '(' Condition ')';
/// ``` /// ```
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Getters)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Getters)]
pub struct ParenthesizedCondition { pub struct ParenthesizedCondition {
/// The opening parenthesis. /// The opening parenthesis.
@ -164,6 +168,7 @@ impl SourceElement for ParenthesizedCondition {
/// PrefixOperator: '!'; /// PrefixOperator: '!';
/// ``` /// ```
#[allow(missing_docs)] #[allow(missing_docs)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, EnumAsInner)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, EnumAsInner)]
pub enum ConditionalPrefixOperator { pub enum ConditionalPrefixOperator {
LogicalNot(Punctuation), LogicalNot(Punctuation),
@ -184,6 +189,7 @@ impl SourceElement for ConditionalPrefixOperator {
/// ConditionalPrefixOperator StringLiteral /// ConditionalPrefixOperator StringLiteral
/// ; /// ;
/// ``` /// ```
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Getters)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Getters)]
pub struct ConditionalPrefix { pub struct ConditionalPrefix {
/// The operator of the prefix. /// The operator of the prefix.
@ -213,6 +219,7 @@ impl ConditionalPrefix {
/// Condition: PrimaryCondition; /// Condition: PrimaryCondition;
/// ``` /// ```
#[allow(missing_docs)] #[allow(missing_docs)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, EnumAsInner)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, EnumAsInner)]
pub enum Condition { pub enum Condition {
Primary(PrimaryCondition), Primary(PrimaryCondition),

View File

@ -21,6 +21,7 @@ use crate::{
use super::{statement::Block, ConnectedList}; use super::{statement::Block, ConnectedList};
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum Declaration { pub enum Declaration {
Function(Function), Function(Function),
@ -40,6 +41,7 @@ impl SourceElement for Declaration {
/// '#[' Identifier ('=' StringLiteral)? ']' /// '#[' Identifier ('=' StringLiteral)? ']'
/// ; /// ;
/// ``` /// ```
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Getters)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Getters)]
pub struct Annotation { pub struct Annotation {
#[get = "pub"] #[get = "pub"]
@ -95,6 +97,7 @@ impl SourceElement for Annotation {
/// Identifier (',' Identifier)* ','? /// Identifier (',' Identifier)* ','?
/// ; /// ;
/// ``` /// ```
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Getters)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Getters)]
pub struct Function { pub struct Function {
#[get = "pub"] #[get = "pub"]

View File

@ -26,8 +26,9 @@ use super::ConnectedList;
/// Expression: /// Expression:
/// Primary /// Primary
/// ``` /// ```
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, EnumAsInner)]
#[allow(missing_docs)] #[allow(missing_docs)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, EnumAsInner)]
pub enum Expression { pub enum Expression {
Primary(Primary), Primary(Primary),
} }
@ -46,8 +47,9 @@ impl SourceElement for Expression {
/// Primary: /// Primary:
/// FunctionCall /// FunctionCall
/// ``` /// ```
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, EnumAsInner)]
#[allow(missing_docs)] #[allow(missing_docs)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, EnumAsInner)]
pub enum Primary { pub enum Primary {
FunctionCall(FunctionCall), FunctionCall(FunctionCall),
} }
@ -67,6 +69,7 @@ impl SourceElement for Primary {
/// Identifier '(' (Expression (',' Expression)*)? ')' /// Identifier '(' (Expression (',' Expression)*)? ')'
/// ; /// ;
/// ``` /// ```
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Getters)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Getters)]
pub struct FunctionCall { pub struct FunctionCall {
/// The identifier of the function. /// The identifier of the function.

View File

@ -27,6 +27,7 @@ pub mod statement;
/// This struct is useful for representing syntax tree nodes that are separated by a separator. /// This struct is useful for representing syntax tree nodes that are separated by a separator.
/// For example, a comma separated list of expressions such as `1, 2, 3` can be represented by a /// For example, a comma separated list of expressions such as `1, 2, 3` can be represented by a
/// [`ConnectedList`] with the separator being a comma token and the elements being the expressions. /// [`ConnectedList`] with the separator being a comma token and the elements being the expressions.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Getters)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Getters)]
pub struct ConnectedList<Element, Separator> { pub struct ConnectedList<Element, Separator> {
/// The first element of the list. /// The first element of the list.

View File

@ -13,6 +13,7 @@ use crate::{
use super::declaration::Declaration; use super::declaration::Declaration;
/// Program is a collection of declarations. /// Program is a collection of declarations.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Getters)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Getters)]
pub struct Program { pub struct Program {
/// The declarations within the program. /// The declarations within the program.

View File

@ -31,6 +31,7 @@ use super::{condition::ParenthesizedCondition, expression::Expression};
/// ; /// ;
/// ``` /// ```
#[allow(missing_docs)] #[allow(missing_docs)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum Statement { pub enum Statement {
Block(Block), Block(Block),
@ -61,6 +62,7 @@ impl SourceElement for Statement {
/// '{' Statement* '}' /// '{' Statement* '}'
/// ; /// ;
/// ``` /// ```
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Getters)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Getters)]
pub struct Block { pub struct Block {
/// The opening brace of the block. /// The opening brace of the block.
@ -98,6 +100,7 @@ impl SourceElement for Block {
/// 'if' ParenthizedCondition Block ('else' Block)? /// 'if' ParenthizedCondition Block ('else' Block)?
/// ; /// ;
/// ```` /// ````
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Getters)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Getters)]
pub struct Conditional { pub struct Conditional {
/// The `if` keyword. /// The `if` keyword.
@ -148,6 +151,7 @@ impl SourceElement for Conditional {
/// 'else' Block /// 'else' Block
/// ; /// ;
/// ``` /// ```
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Getters)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Getters)]
pub struct Else { pub struct Else {
/// The `else` keyword. /// The `else` keyword.
@ -179,6 +183,7 @@ impl SourceElement for Else {
/// 'group' Block /// 'group' Block
/// ; /// ;
/// ```` /// ````
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Getters)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Getters)]
pub struct Grouping { pub struct Grouping {
/// The `group` keyword. /// The `group` keyword.
@ -212,6 +217,7 @@ impl SourceElement for Grouping {
/// Expression ';' /// Expression ';'
/// ; /// ;
/// ``` /// ```
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Getters)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Getters)]
pub struct Semicolon { pub struct Semicolon {
/// The expression of the semicolon statement. /// The expression of the semicolon statement.