#[derive(Debug, ::m2_syn::Spanned)]
pub struct Symbol {
pub text: String,
span: ::m2_syn::Span,
}
impl Symbol {
pub fn new(text: impl Into<String>, span: ::m2_syn::Span) -> Self {
Self {
text: text.into(),
span,
}
}
}
impl ::m2_syn::ToTokens for Symbol {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
output.push_ident(::m2_syn::IdentToken::new(
&self.text,
::m2_syn::Spanned::span(self),
));
}
}
impl ::m2_syn::PrettyTree for Symbol {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
::m2_syn::PrettyNode::token(
stringify!(Symbol),
&self.text,
::m2_syn::Spanned::span(self),
)
}
}
impl<N> ::m2_syn::Reconstruct<N> for Symbol
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("symbol", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"symbol",
true,
node.identity(),
));
}
Ok(Self::new(node.text(), node.span()))
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct BlockComment {
pub text: String,
span: ::m2_syn::Span,
}
impl BlockComment {
pub fn new(text: impl Into<String>, span: ::m2_syn::Span) -> Self {
Self {
text: text.into(),
span,
}
}
}
impl ::m2_syn::ToTokens for BlockComment {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
output.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::BlockComment,
&self.text,
::m2_syn::Spanned::span(self),
));
}
}
impl ::m2_syn::PrettyTree for BlockComment {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
::m2_syn::PrettyNode::token(
stringify!(BlockComment),
&self.text,
::m2_syn::Spanned::span(self),
)
}
}
impl<N> ::m2_syn::Reconstruct<N> for BlockComment
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("block_comment", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"block_comment",
true,
node.identity(),
));
}
Ok(Self::new(node.text(), node.span()))
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct LineComment {
pub text: String,
span: ::m2_syn::Span,
}
impl LineComment {
pub fn new(text: impl Into<String>, span: ::m2_syn::Span) -> Self {
Self {
text: text.into(),
span,
}
}
}
impl ::m2_syn::ToTokens for LineComment {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
output.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::LineComment,
&self.text,
::m2_syn::Spanned::span(self),
));
}
}
impl ::m2_syn::PrettyTree for LineComment {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
::m2_syn::PrettyNode::token(
stringify!(LineComment),
&self.text,
::m2_syn::Spanned::span(self),
)
}
}
impl<N> ::m2_syn::Reconstruct<N> for LineComment
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("line_comment", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"line_comment",
true,
node.identity(),
));
}
Ok(Self::new(node.text(), node.span()))
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct EmptyComponent {
pub text: String,
span: ::m2_syn::Span,
}
impl EmptyComponent {
pub fn new(text: impl Into<String>, span: ::m2_syn::Span) -> Self {
Self {
text: text.into(),
span,
}
}
}
impl ::m2_syn::ToTokens for EmptyComponent {
fn to_tokens(&self, _output: &mut ::m2_syn::TokenStream) {}
}
impl ::m2_syn::PrettyTree for EmptyComponent {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
::m2_syn::PrettyNode::token(
stringify!(EmptyComponent),
"∅",
::m2_syn::Spanned::span(self),
)
}
}
impl<N> ::m2_syn::Reconstruct<N> for EmptyComponent
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("empty_component", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"empty_component",
true,
node.identity(),
));
}
Ok(Self::new(node.text(), node.span()))
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct EscapeSequence {
pub text: String,
span: ::m2_syn::Span,
}
impl EscapeSequence {
pub fn new(text: impl Into<String>, span: ::m2_syn::Span) -> Self {
Self {
text: text.into(),
span,
}
}
}
impl ::m2_syn::ToTokens for EscapeSequence {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
output.push_ident(::m2_syn::IdentToken::new(
&self.text,
::m2_syn::Spanned::span(self),
));
}
}
impl ::m2_syn::PrettyTree for EscapeSequence {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
::m2_syn::PrettyNode::token(
stringify!(EscapeSequence),
&self.text,
::m2_syn::Spanned::span(self),
)
}
}
impl<N> ::m2_syn::Reconstruct<N> for EscapeSequence
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("escape_sequence", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"escape_sequence",
true,
node.identity(),
));
}
Ok(Self::new(node.text(), node.span()))
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct FloatLiteral {
pub text: String,
span: ::m2_syn::Span,
}
impl FloatLiteral {
pub fn new(text: impl Into<String>, span: ::m2_syn::Span) -> Self {
Self {
text: text.into(),
span,
}
}
}
impl ::m2_syn::ToTokens for FloatLiteral {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
output.push_literal(::m2_syn::Literal::new(
::m2_syn::LiteralKind::Float,
self.text.clone(),
::m2_syn::Spanned::span(self),
));
}
}
impl ::m2_syn::PrettyTree for FloatLiteral {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
::m2_syn::PrettyNode::token(
stringify!(FloatLiteral),
&self.text,
::m2_syn::Spanned::span(self),
)
}
}
impl<N> ::m2_syn::Reconstruct<N> for FloatLiteral
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("float_literal", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"float_literal",
true,
node.identity(),
));
}
Ok(Self::new(node.text(), node.span()))
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct IntegerLiteral {
pub text: String,
span: ::m2_syn::Span,
}
impl IntegerLiteral {
pub fn new(text: impl Into<String>, span: ::m2_syn::Span) -> Self {
Self {
text: text.into(),
span,
}
}
}
impl ::m2_syn::ToTokens for IntegerLiteral {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
output.push_literal(::m2_syn::Literal::new(
::m2_syn::LiteralKind::Integer,
self.text.clone(),
::m2_syn::Spanned::span(self),
));
}
}
impl ::m2_syn::PrettyTree for IntegerLiteral {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
::m2_syn::PrettyNode::token(
stringify!(IntegerLiteral),
&self.text,
::m2_syn::Spanned::span(self),
)
}
}
impl<N> ::m2_syn::Reconstruct<N> for IntegerLiteral
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("integer_literal", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"integer_literal",
true,
node.identity(),
));
}
Ok(Self::new(node.text(), node.span()))
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct RawStringContent {
pub text: String,
span: ::m2_syn::Span,
}
impl RawStringContent {
pub fn new(text: impl Into<String>, span: ::m2_syn::Span) -> Self {
Self {
text: text.into(),
span,
}
}
}
impl ::m2_syn::ToTokens for RawStringContent {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
output.push_ident(::m2_syn::IdentToken::new(
&self.text,
::m2_syn::Spanned::span(self),
));
}
}
impl ::m2_syn::PrettyTree for RawStringContent {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
::m2_syn::PrettyNode::token(
stringify!(RawStringContent),
&self.text,
::m2_syn::Spanned::span(self),
)
}
}
impl<N> ::m2_syn::Reconstruct<N> for RawStringContent
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("raw_string_content", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"raw_string_content",
true,
node.identity(),
));
}
Ok(Self::new(node.text(), node.span()))
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct StringContent {
pub text: String,
span: ::m2_syn::Span,
}
impl StringContent {
pub fn new(text: impl Into<String>, span: ::m2_syn::Span) -> Self {
Self {
text: text.into(),
span,
}
}
}
impl ::m2_syn::ToTokens for StringContent {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
output.push_ident(::m2_syn::IdentToken::new(
&self.text,
::m2_syn::Spanned::span(self),
));
}
}
impl ::m2_syn::PrettyTree for StringContent {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
::m2_syn::PrettyNode::token(
stringify!(StringContent),
&self.text,
::m2_syn::Spanned::span(self),
)
}
}
impl<N> ::m2_syn::Reconstruct<N> for StringContent
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("string_content", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"string_content",
true,
node.identity(),
));
}
Ok(Self::new(node.text(), node.span()))
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct SourceFile {
pub elements: ::std::vec::Vec<AnyCell>,
}
impl SourceFile {
pub fn new(elements: ::std::vec::Vec<AnyCell>) -> Self {
Self { elements }
}
}
impl ::m2_syn::ToTokens for SourceFile {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
for (index, value) in self.elements.iter().enumerate() {
if index != 0 {
field_output.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
"\n",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(value, &mut field_output);
}
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for SourceFile {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(SourceFile), ::m2_syn::Spanned::span(self));
node.push("elements", &self.elements);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for SourceFile
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("source_file", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"source_file",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let elements = children
.repeated_matching::<AnyCell>()
.into_iter()
.map(|node| {
let value = <AnyCell as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(value)
})
.collect::<Result<::std::vec::Vec<_>, _>>()?;
Ok(Self { elements })
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct ExpressionCell {
pub value: ::std::boxed::Box<Expr>,
}
impl ExpressionCell {
pub fn new(value: Expr) -> Self {
{
let value = ::std::boxed::Box::new(value);
Self { value }
}
}
}
impl ::m2_syn::ToTokens for ExpressionCell {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.value, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for ExpressionCell {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(ExpressionCell), ::m2_syn::Spanned::span(self));
node.push("value", &self.value);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for ExpressionCell
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("cell", true)
&& node.children().any(|child| {
child.field.is_none() && <Expr as ::m2_syn::Reconstruct<N>>::matches(&child.node)
})
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"cell",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let value = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<Expr>()?,
)?);
Ok(Self { value })
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct SequenceCell {
pub value: ::std::boxed::Box<NakedSequence>,
}
impl SequenceCell {
pub fn new(value: NakedSequence) -> Self {
{
let value = ::std::boxed::Box::new(value);
Self { value }
}
}
}
impl ::m2_syn::ToTokens for SequenceCell {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.value, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for SequenceCell {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(SequenceCell), ::m2_syn::Spanned::span(self));
node.push("value", &self.value);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for SequenceCell
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("cell", true)
&& node.children().any(|child| {
child.field.is_none()
&& <NakedSequence as ::m2_syn::Reconstruct<N>>::matches(&child.node)
})
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"cell",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let value =
::std::boxed::Box::new(<NakedSequence as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<NakedSequence>()?,
)?);
Ok(Self { value })
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct NakedSequence {
pub elements: ::m2_syn::Punctuated<Component>,
}
impl NakedSequence {
pub fn new(elements: ::m2_syn::Punctuated<Component>) -> Self {
Self { elements }
}
}
impl ::m2_syn::ToTokens for NakedSequence {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.elements, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for NakedSequence {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(NakedSequence), ::m2_syn::Spanned::span(self));
node.push("elements", &self.elements);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for NakedSequence
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("naked_sequence", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"naked_sequence",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let elements = children
.repeated_matching::<Component>()
.into_iter()
.map(|node| {
let value = <Component as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(value)
})
.collect::<Result<::m2_syn::Punctuated<_>, _>>()?;
Ok(Self { elements })
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct MutedCell {
pub elements: ::m2_syn::Punctuated<Component>,
pub semicolon: Token![;],
}
impl MutedCell {
pub fn new(elements: ::m2_syn::Punctuated<Component>, semicolon: Token![;]) -> Self {
Self {
elements,
semicolon,
}
}
}
impl ::m2_syn::ToTokens for MutedCell {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.elements, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.semicolon, &mut field_output);
if !field_output.is_empty() {
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for MutedCell {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(MutedCell), ::m2_syn::Spanned::span(self));
node.push("elements", &self.elements);
node.push("semicolon", &self.semicolon);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for MutedCell
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("muted", true)
&& node.children().any(|child| {
child.field.is_none()
&& <Token![;] as ::m2_syn::Reconstruct<N>>::matches(&child.node)
})
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"muted",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let elements = children
.repeated_matching::<Component>()
.into_iter()
.map(|node| {
let value = <Component as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(value)
})
.collect::<Result<::m2_syn::Punctuated<_>, _>>()?;
let semicolon = <Token![;] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<Token![;]>()?,
)?;
Ok(Self {
elements,
semicolon,
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct MutedGroup {
pub elements: ::m2_syn::Punctuated<Component>,
pub semicolon: Token![;],
}
impl MutedGroup {
pub fn new(elements: ::m2_syn::Punctuated<Component>, semicolon: Token![;]) -> Self {
Self {
elements,
semicolon,
}
}
}
impl ::m2_syn::ToTokens for MutedGroup {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.elements, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.semicolon, &mut field_output);
if !field_output.is_empty() {
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for MutedGroup {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(MutedGroup), ::m2_syn::Spanned::span(self));
node.push("elements", &self.elements);
node.push("semicolon", &self.semicolon);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for MutedGroup
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("muted", true)
&& node.children().any(|child| {
child.field.is_none()
&& <Token![;] as ::m2_syn::Reconstruct<N>>::matches(&child.node)
})
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"muted",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let elements = children
.repeated_matching::<Component>()
.into_iter()
.map(|node| {
let value = <Component as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(value)
})
.collect::<Result<::m2_syn::Punctuated<_>, _>>()?;
let semicolon = <Token![;] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<Token![;]>()?,
)?;
Ok(Self {
elements,
semicolon,
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct Array {
pub muted: ::std::vec::Vec<MutedGroup>,
pub elements: ::m2_syn::Punctuated<Component>,
pub delimiter: Delimiter![[]],
}
impl Array {
pub fn new(
muted: ::std::vec::Vec<MutedGroup>,
elements: ::m2_syn::Punctuated<Component>,
) -> Self {
let span = ::m2_syn::Span::join_all([
::m2_syn::Spanned::span(&muted),
::m2_syn::Spanned::span(&elements),
]);
{
let delimiter = <Delimiter![[]] as ::m2_syn::DelimiterToken>::new(span);
Self {
muted,
elements,
delimiter,
}
}
}
}
impl ::m2_syn::ToTokens for Array {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
for (index, value) in self.muted.iter().enumerate() {
if index != 0 {
field_output.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(value, &mut field_output);
}
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.elements, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::DelimiterToken::surround(&self.delimiter, output, contents);
}
}
impl ::m2_syn::PrettyTree for Array {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(Array), ::m2_syn::Spanned::span(self));
node.push("muted", &self.muted);
node.push("elements", &self.elements);
node.push("delimiter", self.delimiter);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for Array
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("array", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"array",
true,
node.identity(),
));
}
let span = node.span();
let mut children = ::m2_syn::ChildCursor::new(&node);
let muted = children
.repeated_matching::<MutedGroup>()
.into_iter()
.map(|node| {
let value = <MutedGroup as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(value)
})
.collect::<Result<::std::vec::Vec<_>, _>>()?;
let elements = children
.repeated_matching::<Component>()
.into_iter()
.map(|node| {
let value = <Component as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(value)
})
.collect::<Result<::m2_syn::Punctuated<_>, _>>()?;
Ok({
let delimiter = <Delimiter![[]] as ::m2_syn::DelimiterToken>::new(span);
Self {
muted,
elements,
delimiter,
}
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct List {
pub muted: ::std::vec::Vec<MutedGroup>,
pub elements: ::m2_syn::Punctuated<Component>,
pub delimiter: Delimiter![{}],
}
impl List {
pub fn new(
muted: ::std::vec::Vec<MutedGroup>,
elements: ::m2_syn::Punctuated<Component>,
) -> Self {
let span = ::m2_syn::Span::join_all([
::m2_syn::Spanned::span(&muted),
::m2_syn::Spanned::span(&elements),
]);
{
let delimiter = <Delimiter![{}] as ::m2_syn::DelimiterToken>::new(span);
Self {
muted,
elements,
delimiter,
}
}
}
}
impl ::m2_syn::ToTokens for List {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
for (index, value) in self.muted.iter().enumerate() {
if index != 0 {
field_output.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(value, &mut field_output);
}
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.elements, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::DelimiterToken::surround(&self.delimiter, output, contents);
}
}
impl ::m2_syn::PrettyTree for List {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(List), ::m2_syn::Spanned::span(self));
node.push("muted", &self.muted);
node.push("elements", &self.elements);
node.push("delimiter", self.delimiter);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for List
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("list", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"list",
true,
node.identity(),
));
}
let span = node.span();
let mut children = ::m2_syn::ChildCursor::new(&node);
let muted = children
.repeated_matching::<MutedGroup>()
.into_iter()
.map(|node| {
let value = <MutedGroup as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(value)
})
.collect::<Result<::std::vec::Vec<_>, _>>()?;
let elements = children
.repeated_matching::<Component>()
.into_iter()
.map(|node| {
let value = <Component as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(value)
})
.collect::<Result<::m2_syn::Punctuated<_>, _>>()?;
Ok({
let delimiter = <Delimiter![{}] as ::m2_syn::DelimiterToken>::new(span);
Self {
muted,
elements,
delimiter,
}
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct AngleBarList {
pub muted: ::std::vec::Vec<MutedGroup>,
pub elements: ::m2_syn::Punctuated<Component>,
pub delimiter: Delimiter![<| |>],
}
impl AngleBarList {
pub fn new(
muted: ::std::vec::Vec<MutedGroup>,
elements: ::m2_syn::Punctuated<Component>,
) -> Self {
let span = ::m2_syn::Span::join_all([
::m2_syn::Spanned::span(&muted),
::m2_syn::Spanned::span(&elements),
]);
{
let delimiter = <Delimiter![<| |>] as ::m2_syn::DelimiterToken>::new(span);
Self {
muted,
elements,
delimiter,
}
}
}
}
impl ::m2_syn::ToTokens for AngleBarList {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
for (index, value) in self.muted.iter().enumerate() {
if index != 0 {
field_output.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(value, &mut field_output);
}
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.elements, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::DelimiterToken::surround(&self.delimiter, output, contents);
}
}
impl ::m2_syn::PrettyTree for AngleBarList {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(AngleBarList), ::m2_syn::Spanned::span(self));
node.push("muted", &self.muted);
node.push("elements", &self.elements);
node.push("delimiter", self.delimiter);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for AngleBarList
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("angle_bar_list", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"angle_bar_list",
true,
node.identity(),
));
}
let span = node.span();
let mut children = ::m2_syn::ChildCursor::new(&node);
let muted = children
.repeated_matching::<MutedGroup>()
.into_iter()
.map(|node| {
let value = <MutedGroup as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(value)
})
.collect::<Result<::std::vec::Vec<_>, _>>()?;
let elements = children
.repeated_matching::<Component>()
.into_iter()
.map(|node| {
let value = <Component as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(value)
})
.collect::<Result<::m2_syn::Punctuated<_>, _>>()?;
Ok({
let delimiter = <Delimiter![<| |>] as ::m2_syn::DelimiterToken>::new(span);
Self {
muted,
elements,
delimiter,
}
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct Sequence {
pub muted: ::std::vec::Vec<MutedGroup>,
pub elements: ::m2_syn::Punctuated<Component>,
pub delimiter: Delimiter![()],
}
impl Sequence {
pub fn new(
muted: ::std::vec::Vec<MutedGroup>,
elements: ::m2_syn::Punctuated<Component>,
) -> Self {
let span = ::m2_syn::Span::join_all([
::m2_syn::Spanned::span(&muted),
::m2_syn::Spanned::span(&elements),
]);
{
let delimiter = <Delimiter![()] as ::m2_syn::DelimiterToken>::new(span);
Self {
muted,
elements,
delimiter,
}
}
}
}
impl ::m2_syn::ToTokens for Sequence {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
for (index, value) in self.muted.iter().enumerate() {
if index != 0 {
field_output.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(value, &mut field_output);
}
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.elements, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::DelimiterToken::surround(&self.delimiter, output, contents);
}
}
impl ::m2_syn::PrettyTree for Sequence {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(Sequence), ::m2_syn::Spanned::span(self));
node.push("muted", &self.muted);
node.push("elements", &self.elements);
node.push("delimiter", self.delimiter);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for Sequence
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("sequence", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"sequence",
true,
node.identity(),
));
}
let span = node.span();
let mut children = ::m2_syn::ChildCursor::new(&node);
let muted = children
.repeated_matching::<MutedGroup>()
.into_iter()
.map(|node| {
let value = <MutedGroup as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(value)
})
.collect::<Result<::std::vec::Vec<_>, _>>()?;
let elements = children
.repeated_matching::<Component>()
.into_iter()
.map(|node| {
let value = <Component as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(value)
})
.collect::<Result<::m2_syn::Punctuated<_>, _>>()?;
Ok({
let delimiter = <Delimiter![()] as ::m2_syn::DelimiterToken>::new(span);
Self {
muted,
elements,
delimiter,
}
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct ParenthesizedExpression {
pub muted: ::std::vec::Vec<MutedGroup>,
pub value: ::std::option::Option<::std::boxed::Box<Expr>>,
pub delimiter: Delimiter![()],
}
impl ParenthesizedExpression {
pub fn new(muted: ::std::vec::Vec<MutedGroup>, value: ::std::option::Option<Expr>) -> Self {
let span = ::m2_syn::Span::join_all([
::m2_syn::Spanned::span(&muted),
::m2_syn::Spanned::span(&value),
]);
{
let value = value.map(::std::boxed::Box::new);
{
let delimiter = <Delimiter![()] as ::m2_syn::DelimiterToken>::new(span);
Self {
muted,
value,
delimiter,
}
}
}
}
}
impl ::m2_syn::ToTokens for ParenthesizedExpression {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
for (index, value) in self.muted.iter().enumerate() {
if index != 0 {
field_output.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(value, &mut field_output);
}
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.value, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::DelimiterToken::surround(&self.delimiter, output, contents);
}
}
impl ::m2_syn::PrettyTree for ParenthesizedExpression {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node = ::m2_syn::PrettyNode::syntax(
stringify!(ParenthesizedExpression),
::m2_syn::Spanned::span(self),
);
node.push("muted", &self.muted);
node.push("value", &self.value);
node.push("delimiter", self.delimiter);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for ParenthesizedExpression
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("parenthesized_expression", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"parenthesized_expression",
true,
node.identity(),
));
}
let span = node.span();
let mut children = ::m2_syn::ChildCursor::new(&node);
let muted = children
.repeated_matching::<MutedGroup>()
.into_iter()
.map(|node| {
let value = <MutedGroup as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(value)
})
.collect::<Result<::std::vec::Vec<_>, _>>()?;
let value = children
.optional_matching::<Expr>()
.map(|node| {
let value = <Expr as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(::std::boxed::Box::new(value))
})
.transpose()?;
Ok({
let delimiter = <Delimiter![()] as ::m2_syn::DelimiterToken>::new(span);
Self {
muted,
value,
delimiter,
}
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct StringLiteral {
pub elements: ::std::vec::Vec<StringElement>,
}
impl StringLiteral {
pub fn new(elements: ::std::vec::Vec<StringElement>) -> Self {
Self { elements }
}
}
impl ::m2_syn::ToTokens for StringLiteral {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
for value in &self.elements {
::m2_syn::ToTokens::to_tokens(value, &mut field_output);
}
if !field_output.is_empty() {
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
output.push_literal(::m2_syn::Literal::new(
::m2_syn::LiteralKind::String,
::std::format!("\"{}\"", contents),
::m2_syn::Spanned::span(self),
));
}
}
impl ::m2_syn::PrettyTree for StringLiteral {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(StringLiteral), ::m2_syn::Spanned::span(self));
node.push("elements", &self.elements);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for StringLiteral
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("string_literal", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"string_literal",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let elements = children
.repeated_matching::<StringElement>()
.into_iter()
.map(|node| {
let value = <StringElement as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(value)
})
.collect::<Result<::std::vec::Vec<_>, _>>()?;
Ok(Self { elements })
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct RawStringLiteral {
pub elements: ::std::vec::Vec<RawStringElement>,
}
impl RawStringLiteral {
pub fn new(elements: ::std::vec::Vec<RawStringElement>) -> Self {
Self { elements }
}
}
impl ::m2_syn::ToTokens for RawStringLiteral {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
for value in &self.elements {
::m2_syn::ToTokens::to_tokens(value, &mut field_output);
}
if !field_output.is_empty() {
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
output.push_literal(::m2_syn::Literal::new(
::m2_syn::LiteralKind::RawString,
::std::format!("///{}///", contents),
::m2_syn::Spanned::span(self),
));
}
}
impl ::m2_syn::PrettyTree for RawStringLiteral {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node = ::m2_syn::PrettyNode::syntax(
stringify!(RawStringLiteral),
::m2_syn::Spanned::span(self),
);
node.push("elements", &self.elements);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for RawStringLiteral
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("raw_string_literal", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"raw_string_literal",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let elements = children
.repeated_matching::<RawStringElement>()
.into_iter()
.map(|node| {
let value = <RawStringElement as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(value)
})
.collect::<Result<::std::vec::Vec<_>, _>>()?;
Ok(Self { elements })
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct BinaryExpression {
pub left: ::std::boxed::Box<Expr>,
pub operator: BinaryOperator,
pub right: ::std::boxed::Box<Expr>,
}
impl BinaryExpression {
pub fn new(left: Expr, operator: BinaryOperator, right: Expr) -> Self {
{
let left = ::std::boxed::Box::new(left);
let right = ::std::boxed::Box::new(right);
Self {
left,
operator,
right,
}
}
}
}
impl ::m2_syn::ToTokens for BinaryExpression {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.left, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.operator, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.right, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for BinaryExpression {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node = ::m2_syn::PrettyNode::syntax(
stringify!(BinaryExpression),
::m2_syn::Spanned::span(self),
);
node.push("left", &self.left);
node.push("operator", &self.operator);
node.push("right", &self.right);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for BinaryExpression
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("binary_expression", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"binary_expression",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let left = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("left")?,
)?);
let operator = <BinaryOperator as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("operator")?,
)?;
let right = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("right")?,
)?);
Ok(Self {
left,
operator,
right,
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct AdjacentExpression {
pub left: ::std::boxed::Box<Expr>,
pub right: ::std::boxed::Box<Expr>,
}
impl AdjacentExpression {
pub fn new(left: Expr, right: Expr) -> Self {
{
let left = ::std::boxed::Box::new(left);
let right = ::std::boxed::Box::new(right);
Self { left, right }
}
}
}
impl ::m2_syn::ToTokens for AdjacentExpression {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.left, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.right, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for AdjacentExpression {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node = ::m2_syn::PrettyNode::syntax(
stringify!(AdjacentExpression),
::m2_syn::Spanned::span(self),
);
node.push("left", &self.left);
node.push("right", &self.right);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for AdjacentExpression
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("adjacent_expression", true)
&& node.children().any(|child| {
child.field == Some("left")
&& <Expr as ::m2_syn::Reconstruct<N>>::matches(&child.node)
})
&& node.children().any(|child| {
child.field == Some("right")
&& <Expr as ::m2_syn::Reconstruct<N>>::matches(&child.node)
})
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"adjacent_expression",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let left = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("left")?,
)?);
let right = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("right")?,
)?);
Ok(Self { left, right })
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct PrefixExpression {
pub operator: PrefixOperator,
pub operand: ::std::boxed::Box<Expr>,
}
impl PrefixExpression {
pub fn new(operator: PrefixOperator, operand: Expr) -> Self {
{
let operand = ::std::boxed::Box::new(operand);
Self { operator, operand }
}
}
}
impl ::m2_syn::ToTokens for PrefixExpression {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.operator, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.operand, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for PrefixExpression {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node = ::m2_syn::PrettyNode::syntax(
stringify!(PrefixExpression),
::m2_syn::Spanned::span(self),
);
node.push("operator", &self.operator);
node.push("operand", &self.operand);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for PrefixExpression
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("prefix_expression", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"prefix_expression",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let operator = <PrefixOperator as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("operator")?,
)?;
let operand = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("operand")?,
)?);
Ok(Self { operator, operand })
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct PostfixExpression {
pub operand: ::std::boxed::Box<Expr>,
pub operator: PostfixOperator,
}
impl PostfixExpression {
pub fn new(operand: Expr, operator: PostfixOperator) -> Self {
{
let operand = ::std::boxed::Box::new(operand);
Self { operand, operator }
}
}
}
impl ::m2_syn::ToTokens for PostfixExpression {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.operand, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.operator, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for PostfixExpression {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node = ::m2_syn::PrettyNode::syntax(
stringify!(PostfixExpression),
::m2_syn::Spanned::span(self),
);
node.push("operand", &self.operand);
node.push("operator", &self.operator);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for PostfixExpression
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("postfix_expression", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"postfix_expression",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let operand = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("operand")?,
)?);
let operator = <PostfixOperator as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("operator")?,
)?;
Ok(Self { operand, operator })
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct LambdaExpression {
pub parameters: ::std::boxed::Box<LambdaParameters>,
pub operator: Token![->],
pub body: ::std::boxed::Box<Expr>,
}
impl LambdaExpression {
pub fn new(parameters: LambdaParameters, operator: Token![->], body: Expr) -> Self {
{
let parameters = ::std::boxed::Box::new(parameters);
let body = ::std::boxed::Box::new(body);
Self {
parameters,
operator,
body,
}
}
}
}
impl ::m2_syn::ToTokens for LambdaExpression {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.parameters, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.operator, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.body, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for LambdaExpression {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node = ::m2_syn::PrettyNode::syntax(
stringify!(LambdaExpression),
::m2_syn::Spanned::span(self),
);
node.push("parameters", &self.parameters);
node.push("operator", &self.operator);
node.push("body", &self.body);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for LambdaExpression
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("lambda_expression", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"lambda_expression",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let parameters =
::std::boxed::Box::new(<LambdaParameters as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("parameters")?,
)?);
let operator = <Token![->] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("operator")?,
)?;
let body = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("body")?,
)?);
Ok(Self {
parameters,
operator,
body,
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct Assignment {
pub left: ::std::boxed::Box<Symbol>,
pub operator: Token![=],
pub right: ::std::boxed::Box<Expr>,
}
impl Assignment {
pub fn new(left: Symbol, operator: Token![=], right: Expr) -> Self {
{
let left = ::std::boxed::Box::new(left);
let right = ::std::boxed::Box::new(right);
Self {
left,
operator,
right,
}
}
}
}
impl ::m2_syn::ToTokens for Assignment {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.left, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.operator, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.right, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for Assignment {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(Assignment), ::m2_syn::Spanned::span(self));
node.push("left", &self.left);
node.push("operator", &self.operator);
node.push("right", &self.right);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for Assignment
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("assignment", true)
&& node.children().any(|child| {
child.field == Some("left")
&& <Symbol as ::m2_syn::Reconstruct<N>>::matches(&child.node)
})
&& node.children().any(|child| {
child.field == Some("operator")
&& <Token![=] as ::m2_syn::Reconstruct<N>>::matches(&child.node)
})
&& node.children().any(|child| {
child.field == Some("right")
&& <Expr as ::m2_syn::Reconstruct<N>>::matches(&child.node)
})
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"assignment",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let left = ::std::boxed::Box::new(<Symbol as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("left")?,
)?);
let operator = <Token![=] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("operator")?,
)?;
let right = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("right")?,
)?);
Ok(Self {
left,
operator,
right,
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct LocalAssignment {
pub left: ::std::boxed::Box<Symbol>,
pub operator: Token![:=],
pub right: ::std::boxed::Box<Expr>,
}
impl LocalAssignment {
pub fn new(left: Symbol, operator: Token![:=], right: Expr) -> Self {
{
let left = ::std::boxed::Box::new(left);
let right = ::std::boxed::Box::new(right);
Self {
left,
operator,
right,
}
}
}
}
impl ::m2_syn::ToTokens for LocalAssignment {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.left, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.operator, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.right, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for LocalAssignment {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node = ::m2_syn::PrettyNode::syntax(
stringify!(LocalAssignment),
::m2_syn::Spanned::span(self),
);
node.push("left", &self.left);
node.push("operator", &self.operator);
node.push("right", &self.right);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for LocalAssignment
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("local_assignment", true)
&& node.children().any(|child| {
child.field == Some("left")
&& <Symbol as ::m2_syn::Reconstruct<N>>::matches(&child.node)
})
&& node.children().any(|child| {
child.field == Some("operator")
&& <Token![:=] as ::m2_syn::Reconstruct<N>>::matches(&child.node)
})
&& node.children().any(|child| {
child.field == Some("right")
&& <Expr as ::m2_syn::Reconstruct<N>>::matches(&child.node)
})
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"local_assignment",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let left = ::std::boxed::Box::new(<Symbol as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("left")?,
)?);
let operator = <Token![:=] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("operator")?,
)?;
let right = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("right")?,
)?);
Ok(Self {
left,
operator,
right,
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct BinaryAssignment {
pub left: ::std::boxed::Box<BinaryExpression>,
pub operator: Token![=],
pub right: ::std::boxed::Box<Expr>,
}
impl BinaryAssignment {
pub fn new(left: BinaryExpression, operator: Token![=], right: Expr) -> Self {
{
let left = ::std::boxed::Box::new(left);
let right = ::std::boxed::Box::new(right);
Self {
left,
operator,
right,
}
}
}
}
impl ::m2_syn::ToTokens for BinaryAssignment {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.left, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.operator, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.right, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for BinaryAssignment {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node = ::m2_syn::PrettyNode::syntax(
stringify!(BinaryAssignment),
::m2_syn::Spanned::span(self),
);
node.push("left", &self.left);
node.push("operator", &self.operator);
node.push("right", &self.right);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for BinaryAssignment
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("binary_assignment", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"binary_assignment",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let left =
::std::boxed::Box::new(<BinaryExpression as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("left")?,
)?);
let operator = <Token![=] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("operator")?,
)?;
let right = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("right")?,
)?);
Ok(Self {
left,
operator,
right,
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct BinaryInstallation {
pub left: ::std::boxed::Box<BinaryExpression>,
pub operator: Token![:=],
pub right: ::std::boxed::Box<Expr>,
}
impl BinaryInstallation {
pub fn new(left: BinaryExpression, operator: Token![:=], right: Expr) -> Self {
{
let left = ::std::boxed::Box::new(left);
let right = ::std::boxed::Box::new(right);
Self {
left,
operator,
right,
}
}
}
}
impl ::m2_syn::ToTokens for BinaryInstallation {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.left, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.operator, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.right, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for BinaryInstallation {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node = ::m2_syn::PrettyNode::syntax(
stringify!(BinaryInstallation),
::m2_syn::Spanned::span(self),
);
node.push("left", &self.left);
node.push("operator", &self.operator);
node.push("right", &self.right);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for BinaryInstallation
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("binary_installation", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"binary_installation",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let left =
::std::boxed::Box::new(<BinaryExpression as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("left")?,
)?);
let operator = <Token![:=] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("operator")?,
)?;
let right = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("right")?,
)?);
Ok(Self {
left,
operator,
right,
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct PrefixAssignment {
pub left: ::std::boxed::Box<PrefixExpression>,
pub operator: Token![=],
pub right: ::std::boxed::Box<Expr>,
}
impl PrefixAssignment {
pub fn new(left: PrefixExpression, operator: Token![=], right: Expr) -> Self {
{
let left = ::std::boxed::Box::new(left);
let right = ::std::boxed::Box::new(right);
Self {
left,
operator,
right,
}
}
}
}
impl ::m2_syn::ToTokens for PrefixAssignment {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.left, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.operator, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.right, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for PrefixAssignment {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node = ::m2_syn::PrettyNode::syntax(
stringify!(PrefixAssignment),
::m2_syn::Spanned::span(self),
);
node.push("left", &self.left);
node.push("operator", &self.operator);
node.push("right", &self.right);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for PrefixAssignment
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("prefix_assignment", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"prefix_assignment",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let left =
::std::boxed::Box::new(<PrefixExpression as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("left")?,
)?);
let operator = <Token![=] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("operator")?,
)?;
let right = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("right")?,
)?);
Ok(Self {
left,
operator,
right,
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct PrefixInstallation {
pub left: ::std::boxed::Box<PrefixExpression>,
pub operator: Token![:=],
pub right: ::std::boxed::Box<Expr>,
}
impl PrefixInstallation {
pub fn new(left: PrefixExpression, operator: Token![:=], right: Expr) -> Self {
{
let left = ::std::boxed::Box::new(left);
let right = ::std::boxed::Box::new(right);
Self {
left,
operator,
right,
}
}
}
}
impl ::m2_syn::ToTokens for PrefixInstallation {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.left, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.operator, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.right, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for PrefixInstallation {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node = ::m2_syn::PrettyNode::syntax(
stringify!(PrefixInstallation),
::m2_syn::Spanned::span(self),
);
node.push("left", &self.left);
node.push("operator", &self.operator);
node.push("right", &self.right);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for PrefixInstallation
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("prefix_installation", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"prefix_installation",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let left =
::std::boxed::Box::new(<PrefixExpression as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("left")?,
)?);
let operator = <Token![:=] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("operator")?,
)?;
let right = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("right")?,
)?);
Ok(Self {
left,
operator,
right,
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct PostfixAssignment {
pub left: ::std::boxed::Box<PostfixExpression>,
pub operator: Token![=],
pub right: ::std::boxed::Box<Expr>,
}
impl PostfixAssignment {
pub fn new(left: PostfixExpression, operator: Token![=], right: Expr) -> Self {
{
let left = ::std::boxed::Box::new(left);
let right = ::std::boxed::Box::new(right);
Self {
left,
operator,
right,
}
}
}
}
impl ::m2_syn::ToTokens for PostfixAssignment {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.left, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.operator, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.right, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for PostfixAssignment {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node = ::m2_syn::PrettyNode::syntax(
stringify!(PostfixAssignment),
::m2_syn::Spanned::span(self),
);
node.push("left", &self.left);
node.push("operator", &self.operator);
node.push("right", &self.right);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for PostfixAssignment
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("postfix_assignment", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"postfix_assignment",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let left = ::std::boxed::Box::new(
<PostfixExpression as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("left")?,
)?,
);
let operator = <Token![=] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("operator")?,
)?;
let right = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("right")?,
)?);
Ok(Self {
left,
operator,
right,
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct PostfixInstallation {
pub left: ::std::boxed::Box<PostfixExpression>,
pub operator: Token![:=],
pub right: ::std::boxed::Box<Expr>,
}
impl PostfixInstallation {
pub fn new(left: PostfixExpression, operator: Token![:=], right: Expr) -> Self {
{
let left = ::std::boxed::Box::new(left);
let right = ::std::boxed::Box::new(right);
Self {
left,
operator,
right,
}
}
}
}
impl ::m2_syn::ToTokens for PostfixInstallation {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.left, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.operator, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.right, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for PostfixInstallation {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node = ::m2_syn::PrettyNode::syntax(
stringify!(PostfixInstallation),
::m2_syn::Spanned::span(self),
);
node.push("left", &self.left);
node.push("operator", &self.operator);
node.push("right", &self.right);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for PostfixInstallation
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("postfix_installation", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"postfix_installation",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let left = ::std::boxed::Box::new(
<PostfixExpression as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("left")?,
)?,
);
let operator = <Token![:=] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("operator")?,
)?;
let right = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("right")?,
)?);
Ok(Self {
left,
operator,
right,
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct StructuredBinding {
pub binding_pack: ::std::boxed::Box<BindingPack>,
pub operator: Token![=],
pub right: ::std::boxed::Box<Expr>,
}
impl StructuredBinding {
pub fn new(binding_pack: BindingPack, operator: Token![=], right: Expr) -> Self {
{
let binding_pack = ::std::boxed::Box::new(binding_pack);
let right = ::std::boxed::Box::new(right);
Self {
binding_pack,
operator,
right,
}
}
}
}
impl ::m2_syn::ToTokens for StructuredBinding {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.binding_pack, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.operator, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.right, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for StructuredBinding {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node = ::m2_syn::PrettyNode::syntax(
stringify!(StructuredBinding),
::m2_syn::Spanned::span(self),
);
node.push("binding_pack", &self.binding_pack);
node.push("operator", &self.operator);
node.push("right", &self.right);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for StructuredBinding
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("structured_binding", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"structured_binding",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let binding_pack =
::std::boxed::Box::new(<BindingPack as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("binding_pack")?,
)?);
let operator = <Token![=] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("operator")?,
)?;
let right = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("right")?,
)?);
Ok(Self {
binding_pack,
operator,
right,
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct LocalStructuredBinding {
pub binding_pack: ::std::boxed::Box<BindingPack>,
pub operator: Token![:=],
pub right: ::std::boxed::Box<Expr>,
}
impl LocalStructuredBinding {
pub fn new(binding_pack: BindingPack, operator: Token![:=], right: Expr) -> Self {
{
let binding_pack = ::std::boxed::Box::new(binding_pack);
let right = ::std::boxed::Box::new(right);
Self {
binding_pack,
operator,
right,
}
}
}
}
impl ::m2_syn::ToTokens for LocalStructuredBinding {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.binding_pack, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.operator, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.right, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for LocalStructuredBinding {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node = ::m2_syn::PrettyNode::syntax(
stringify!(LocalStructuredBinding),
::m2_syn::Spanned::span(self),
);
node.push("binding_pack", &self.binding_pack);
node.push("operator", &self.operator);
node.push("right", &self.right);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for LocalStructuredBinding
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("local_structured_binding", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"local_structured_binding",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let binding_pack =
::std::boxed::Box::new(<BindingPack as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("binding_pack")?,
)?);
let operator = <Token![:=] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("operator")?,
)?;
let right = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("right")?,
)?);
Ok(Self {
binding_pack,
operator,
right,
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct EvaluatedAssignment {
pub left: ::std::boxed::Box<Expr>,
pub operator: Token![<-],
pub right: ::std::boxed::Box<Expr>,
}
impl EvaluatedAssignment {
pub fn new(left: Expr, operator: Token![<-], right: Expr) -> Self {
{
let left = ::std::boxed::Box::new(left);
let right = ::std::boxed::Box::new(right);
Self {
left,
operator,
right,
}
}
}
}
impl ::m2_syn::ToTokens for EvaluatedAssignment {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.left, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.operator, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.right, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for EvaluatedAssignment {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node = ::m2_syn::PrettyNode::syntax(
stringify!(EvaluatedAssignment),
::m2_syn::Spanned::span(self),
);
node.push("left", &self.left);
node.push("operator", &self.operator);
node.push("right", &self.right);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for EvaluatedAssignment
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("evaluated_assignment", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"evaluated_assignment",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let left = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("left")?,
)?);
let operator = <Token![<-] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("operator")?,
)?;
let right = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("right")?,
)?);
Ok(Self {
left,
operator,
right,
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct OptionExpression {
pub left: ::std::boxed::Box<Expr>,
pub operator: Token![=>],
pub right: ::std::boxed::Box<Expr>,
}
impl OptionExpression {
pub fn new(left: Expr, operator: Token![=>], right: Expr) -> Self {
{
let left = ::std::boxed::Box::new(left);
let right = ::std::boxed::Box::new(right);
Self {
left,
operator,
right,
}
}
}
}
impl ::m2_syn::ToTokens for OptionExpression {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.left, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.operator, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.right, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for OptionExpression {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node = ::m2_syn::PrettyNode::syntax(
stringify!(OptionExpression),
::m2_syn::Spanned::span(self),
);
node.push("left", &self.left);
node.push("operator", &self.operator);
node.push("right", &self.right);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for OptionExpression
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("option", true)
&& node.children().any(|child| {
child.field == Some("left")
&& <Expr as ::m2_syn::Reconstruct<N>>::matches(&child.node)
})
&& node.children().any(|child| {
child.field == Some("operator")
&& <Token![=>] as ::m2_syn::Reconstruct<N>>::matches(&child.node)
})
&& node.children().any(|child| {
child.field == Some("right")
&& <Expr as ::m2_syn::Reconstruct<N>>::matches(&child.node)
})
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"option",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let left = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("left")?,
)?);
let operator = <Token![=>] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("operator")?,
)?;
let right = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("right")?,
)?);
Ok(Self {
left,
operator,
right,
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct ThenClause {
pub keyword: Token![then],
pub value: ::std::boxed::Box<Expr>,
}
impl ThenClause {
pub fn new(keyword: Token![then], value: Expr) -> Self {
{
let value = ::std::boxed::Box::new(value);
Self { keyword, value }
}
}
}
impl ::m2_syn::ToTokens for ThenClause {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.keyword, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.value, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for ThenClause {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(ThenClause), ::m2_syn::Spanned::span(self));
node.push("keyword", &self.keyword);
node.push("value", &self.value);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for ThenClause
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("then_clause", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"then_clause",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let keyword = <Token![then] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<Token![then]>()?,
)?;
let value = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<Expr>()?,
)?);
Ok(Self { keyword, value })
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct ElseClause {
pub keyword: Token![else],
pub value: ::std::boxed::Box<Expr>,
}
impl ElseClause {
pub fn new(keyword: Token![else], value: Expr) -> Self {
{
let value = ::std::boxed::Box::new(value);
Self { keyword, value }
}
}
}
impl ::m2_syn::ToTokens for ElseClause {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.keyword, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.value, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for ElseClause {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(ElseClause), ::m2_syn::Spanned::span(self));
node.push("keyword", &self.keyword);
node.push("value", &self.value);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for ElseClause
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("else_clause", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"else_clause",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let keyword = <Token![else] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<Token![else]>()?,
)?;
let value = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<Expr>()?,
)?);
Ok(Self { keyword, value })
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct IfStatement {
pub keyword: Token![if],
pub condition: ::std::boxed::Box<Expr>,
pub then_clause: ::std::boxed::Box<ThenClause>,
pub else_clause: ::std::option::Option<::std::boxed::Box<ElseClause>>,
}
impl IfStatement {
pub fn new(
keyword: Token![if],
condition: Expr,
then_clause: ThenClause,
else_clause: ::std::option::Option<ElseClause>,
) -> Self {
{
let condition = ::std::boxed::Box::new(condition);
let then_clause = ::std::boxed::Box::new(then_clause);
let else_clause = else_clause.map(::std::boxed::Box::new);
Self {
keyword,
condition,
then_clause,
else_clause,
}
}
}
}
impl ::m2_syn::ToTokens for IfStatement {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.keyword, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.condition, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.then_clause, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.else_clause, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for IfStatement {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(IfStatement), ::m2_syn::Spanned::span(self));
node.push("keyword", &self.keyword);
node.push("condition", &self.condition);
node.push("then_clause", &self.then_clause);
node.push("else_clause", &self.else_clause);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for IfStatement
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("if_statement", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"if_statement",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let keyword = <Token![if] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<Token![if]>()?,
)?;
let condition = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("condition")?,
)?);
let then_clause =
::std::boxed::Box::new(<ThenClause as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<ThenClause>()?,
)?);
let else_clause = children
.optional_matching::<ElseClause>()
.map(|node| {
let value = <ElseClause as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(::std::boxed::Box::new(value))
})
.transpose()?;
Ok(Self {
keyword,
condition,
then_clause,
else_clause,
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct LoopBody {
pub list_keyword: ::std::option::Option<Token![list]>,
pub listed_value: ::std::option::Option<::std::boxed::Box<Expr>>,
pub do_keyword: ::std::option::Option<Token![do]>,
pub ignored_value: ::std::option::Option<::std::boxed::Box<Expr>>,
}
impl LoopBody {
pub fn new(
list_keyword: ::std::option::Option<Token![list]>,
listed_value: ::std::option::Option<Expr>,
do_keyword: ::std::option::Option<Token![do]>,
ignored_value: ::std::option::Option<Expr>,
) -> Self {
{
let listed_value = listed_value.map(::std::boxed::Box::new);
let ignored_value = ignored_value.map(::std::boxed::Box::new);
Self {
list_keyword,
listed_value,
do_keyword,
ignored_value,
}
}
}
}
impl ::m2_syn::ToTokens for LoopBody {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.list_keyword, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.listed_value, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.do_keyword, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.ignored_value, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for LoopBody {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(LoopBody), ::m2_syn::Spanned::span(self));
node.push("list_keyword", &self.list_keyword);
node.push("listed_value", &self.listed_value);
node.push("do_keyword", &self.do_keyword);
node.push("ignored_value", &self.ignored_value);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for LoopBody
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("loop_body", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"loop_body",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let list_keyword = children
.optional_matching::<Token![list]>()
.map(|node| {
let value = <Token![list] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(value)
})
.transpose()?;
let listed_value = children
.optional_field("listed_value")
.map(|node| {
let value = <Expr as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(::std::boxed::Box::new(value))
})
.transpose()?;
let do_keyword = children
.optional_matching::<Token![do]>()
.map(|node| {
let value = <Token![do] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(value)
})
.transpose()?;
let ignored_value = children
.optional_field("ignored_value")
.map(|node| {
let value = <Expr as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(::std::boxed::Box::new(value))
})
.transpose()?;
Ok(Self {
list_keyword,
listed_value,
do_keyword,
ignored_value,
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct IterationRange {
pub in_keyword: ::std::option::Option<Token![in]>,
pub iterated_collection: ::std::option::Option<::std::boxed::Box<Expr>>,
pub from_keyword: ::std::option::Option<Token![from]>,
pub range_start: ::std::option::Option<::std::boxed::Box<Expr>>,
pub to_keyword: ::std::option::Option<Token![to]>,
pub range_end: ::std::option::Option<::std::boxed::Box<Expr>>,
}
impl IterationRange {
pub fn new(
in_keyword: ::std::option::Option<Token![in]>,
iterated_collection: ::std::option::Option<Expr>,
from_keyword: ::std::option::Option<Token![from]>,
range_start: ::std::option::Option<Expr>,
to_keyword: ::std::option::Option<Token![to]>,
range_end: ::std::option::Option<Expr>,
) -> Self {
{
let iterated_collection = iterated_collection.map(::std::boxed::Box::new);
let range_start = range_start.map(::std::boxed::Box::new);
let range_end = range_end.map(::std::boxed::Box::new);
Self {
in_keyword,
iterated_collection,
from_keyword,
range_start,
to_keyword,
range_end,
}
}
}
}
impl ::m2_syn::ToTokens for IterationRange {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.in_keyword, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.iterated_collection, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.from_keyword, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.range_start, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.to_keyword, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.range_end, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for IterationRange {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(IterationRange), ::m2_syn::Spanned::span(self));
node.push("in_keyword", &self.in_keyword);
node.push("iterated_collection", &self.iterated_collection);
node.push("from_keyword", &self.from_keyword);
node.push("range_start", &self.range_start);
node.push("to_keyword", &self.to_keyword);
node.push("range_end", &self.range_end);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for IterationRange
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("iteration_range", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"iteration_range",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let in_keyword = children
.optional_matching::<Token![in]>()
.map(|node| {
let value = <Token![in] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(value)
})
.transpose()?;
let iterated_collection = children
.optional_field("iterated_collection")
.map(|node| {
let value = <Expr as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(::std::boxed::Box::new(value))
})
.transpose()?;
let from_keyword = children
.optional_matching::<Token![from]>()
.map(|node| {
let value = <Token![from] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(value)
})
.transpose()?;
let range_start = children
.optional_field("range_start")
.map(|node| {
let value = <Expr as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(::std::boxed::Box::new(value))
})
.transpose()?;
let to_keyword = children
.optional_matching::<Token![to]>()
.map(|node| {
let value = <Token![to] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(value)
})
.transpose()?;
let range_end = children
.optional_field("range_end")
.map(|node| {
let value = <Expr as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(::std::boxed::Box::new(value))
})
.transpose()?;
Ok(Self {
in_keyword,
iterated_collection,
from_keyword,
range_start,
to_keyword,
range_end,
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct ForLoop {
pub keyword: Token![for],
pub variable: ::std::boxed::Box<Symbol>,
pub range: ::std::option::Option<::std::boxed::Box<IterationRange>>,
pub when_keyword: ::std::option::Option<Token![when]>,
pub filter: ::std::option::Option<::std::boxed::Box<Expr>>,
pub body: ::std::boxed::Box<LoopBody>,
}
impl ForLoop {
pub fn new(
keyword: Token![for],
variable: Symbol,
range: ::std::option::Option<IterationRange>,
when_keyword: ::std::option::Option<Token![when]>,
filter: ::std::option::Option<Expr>,
body: LoopBody,
) -> Self {
{
let variable = ::std::boxed::Box::new(variable);
let range = range.map(::std::boxed::Box::new);
let filter = filter.map(::std::boxed::Box::new);
let body = ::std::boxed::Box::new(body);
Self {
keyword,
variable,
range,
when_keyword,
filter,
body,
}
}
}
}
impl ::m2_syn::ToTokens for ForLoop {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.keyword, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.variable, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.range, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.when_keyword, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.filter, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.body, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for ForLoop {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(ForLoop), ::m2_syn::Spanned::span(self));
node.push("keyword", &self.keyword);
node.push("variable", &self.variable);
node.push("range", &self.range);
node.push("when_keyword", &self.when_keyword);
node.push("filter", &self.filter);
node.push("body", &self.body);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for ForLoop
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("for_loop", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"for_loop",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let keyword = <Token![for] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<Token![for]>()?,
)?;
let variable = ::std::boxed::Box::new(<Symbol as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("variable")?,
)?);
let range = children
.optional_matching::<IterationRange>()
.map(|node| {
let value = <IterationRange as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(::std::boxed::Box::new(value))
})
.transpose()?;
let when_keyword = children
.optional_matching::<Token![when]>()
.map(|node| {
let value = <Token![when] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(value)
})
.transpose()?;
let filter = children
.optional_field("filter")
.map(|node| {
let value = <Expr as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(::std::boxed::Box::new(value))
})
.transpose()?;
let body = ::std::boxed::Box::new(<LoopBody as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<LoopBody>()?,
)?);
Ok(Self {
keyword,
variable,
range,
when_keyword,
filter,
body,
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct WhileLoop {
pub keyword: Token![while],
pub condition: ::std::boxed::Box<Expr>,
pub body: ::std::boxed::Box<LoopBody>,
}
impl WhileLoop {
pub fn new(keyword: Token![while], condition: Expr, body: LoopBody) -> Self {
{
let condition = ::std::boxed::Box::new(condition);
let body = ::std::boxed::Box::new(body);
Self {
keyword,
condition,
body,
}
}
}
}
impl ::m2_syn::ToTokens for WhileLoop {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.keyword, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.condition, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.body, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for WhileLoop {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(WhileLoop), ::m2_syn::Spanned::span(self));
node.push("keyword", &self.keyword);
node.push("condition", &self.condition);
node.push("body", &self.body);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for WhileLoop
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("while_loop", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"while_loop",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let keyword = <Token![while] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<Token![while]>()?,
)?;
let condition = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("condition")?,
)?);
let body = ::std::boxed::Box::new(<LoopBody as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<LoopBody>()?,
)?);
Ok(Self {
keyword,
condition,
body,
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct NewStatement {
pub keyword: Token![new],
pub class: ::std::boxed::Box<Expr>,
pub of_keyword: ::std::option::Option<Token![of]>,
pub parent: ::std::option::Option<::std::boxed::Box<Expr>>,
pub from_keyword: ::std::option::Option<Token![from]>,
pub instance: ::std::option::Option<::std::boxed::Box<Expr>>,
}
impl NewStatement {
pub fn new(
keyword: Token![new],
class: Expr,
of_keyword: ::std::option::Option<Token![of]>,
parent: ::std::option::Option<Expr>,
from_keyword: ::std::option::Option<Token![from]>,
instance: ::std::option::Option<Expr>,
) -> Self {
{
let class = ::std::boxed::Box::new(class);
let parent = parent.map(::std::boxed::Box::new);
let instance = instance.map(::std::boxed::Box::new);
Self {
keyword,
class,
of_keyword,
parent,
from_keyword,
instance,
}
}
}
}
impl ::m2_syn::ToTokens for NewStatement {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.keyword, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.class, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.of_keyword, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.parent, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.from_keyword, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.instance, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for NewStatement {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(NewStatement), ::m2_syn::Spanned::span(self));
node.push("keyword", &self.keyword);
node.push("class", &self.class);
node.push("of_keyword", &self.of_keyword);
node.push("parent", &self.parent);
node.push("from_keyword", &self.from_keyword);
node.push("instance", &self.instance);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for NewStatement
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("new_statement", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"new_statement",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let keyword = <Token![new] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<Token![new]>()?,
)?;
let class = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("class")?,
)?);
let of_keyword = children
.optional_matching::<Token![of]>()
.map(|node| {
let value = <Token![of] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(value)
})
.transpose()?;
let parent = children
.optional_field("parent")
.map(|node| {
let value = <Expr as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(::std::boxed::Box::new(value))
})
.transpose()?;
let from_keyword = children
.optional_matching::<Token![from]>()
.map(|node| {
let value = <Token![from] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(value)
})
.transpose()?;
let instance = children
.optional_field("instance")
.map(|node| {
let value = <Expr as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(::std::boxed::Box::new(value))
})
.transpose()?;
Ok(Self {
keyword,
class,
of_keyword,
parent,
from_keyword,
instance,
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct DebugClause {
pub keyword: DebugKeyword,
pub value: ::std::option::Option<::std::boxed::Box<Expr>>,
}
impl DebugClause {
pub fn new(keyword: DebugKeyword, value: ::std::option::Option<Expr>) -> Self {
{
let value = value.map(::std::boxed::Box::new);
Self { keyword, value }
}
}
}
impl ::m2_syn::ToTokens for DebugClause {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.keyword, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.value, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for DebugClause {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(DebugClause), ::m2_syn::Spanned::span(self));
node.push("keyword", &self.keyword);
node.push("value", &self.value);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for DebugClause
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("debug_clause", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"debug_clause",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let keyword = <DebugKeyword as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("keyword")?,
)?;
let value = children
.optional_matching::<Expr>()
.map(|node| {
let value = <Expr as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(::std::boxed::Box::new(value))
})
.transpose()?;
Ok(Self { keyword, value })
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct BreakStatement {
pub keyword: Token![break],
pub value: ::std::option::Option<::std::boxed::Box<Expr>>,
}
impl BreakStatement {
pub fn new(keyword: Token![break], value: ::std::option::Option<Expr>) -> Self {
{
let value = value.map(::std::boxed::Box::new);
Self { keyword, value }
}
}
}
impl ::m2_syn::ToTokens for BreakStatement {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.keyword, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.value, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for BreakStatement {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(BreakStatement), ::m2_syn::Spanned::span(self));
node.push("keyword", &self.keyword);
node.push("value", &self.value);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for BreakStatement
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("break_statement", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"break_statement",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let keyword = <Token![break] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<Token![break]>()?,
)?;
let value = children
.optional_matching::<Expr>()
.map(|node| {
let value = <Expr as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(::std::boxed::Box::new(value))
})
.transpose()?;
Ok(Self { keyword, value })
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct ContinueStatement {
pub keyword: Token![continue],
pub value: ::std::option::Option<::std::boxed::Box<Expr>>,
}
impl ContinueStatement {
pub fn new(keyword: Token![continue], value: ::std::option::Option<Expr>) -> Self {
{
let value = value.map(::std::boxed::Box::new);
Self { keyword, value }
}
}
}
impl ::m2_syn::ToTokens for ContinueStatement {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.keyword, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.value, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for ContinueStatement {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node = ::m2_syn::PrettyNode::syntax(
stringify!(ContinueStatement),
::m2_syn::Spanned::span(self),
);
node.push("keyword", &self.keyword);
node.push("value", &self.value);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for ContinueStatement
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("continue_statement", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"continue_statement",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let keyword = <Token![continue] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<Token![continue]>()?,
)?;
let value = children
.optional_matching::<Expr>()
.map(|node| {
let value = <Expr as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(::std::boxed::Box::new(value))
})
.transpose()?;
Ok(Self { keyword, value })
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct ReturnStatement {
pub keyword: Token![return],
pub value: ::std::option::Option<::std::boxed::Box<Expr>>,
}
impl ReturnStatement {
pub fn new(keyword: Token![return], value: ::std::option::Option<Expr>) -> Self {
{
let value = value.map(::std::boxed::Box::new);
Self { keyword, value }
}
}
}
impl ::m2_syn::ToTokens for ReturnStatement {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.keyword, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.value, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for ReturnStatement {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node = ::m2_syn::PrettyNode::syntax(
stringify!(ReturnStatement),
::m2_syn::Spanned::span(self),
);
node.push("keyword", &self.keyword);
node.push("value", &self.value);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for ReturnStatement
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("return_statement", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"return_statement",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let keyword = <Token![return] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<Token![return]>()?,
)?;
let value = children
.optional_matching::<Expr>()
.map(|node| {
let value = <Expr as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(::std::boxed::Box::new(value))
})
.transpose()?;
Ok(Self { keyword, value })
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct CatchStatement {
pub keyword: Token![catch],
pub value: ::std::boxed::Box<Expr>,
}
impl CatchStatement {
pub fn new(keyword: Token![catch], value: Expr) -> Self {
{
let value = ::std::boxed::Box::new(value);
Self { keyword, value }
}
}
}
impl ::m2_syn::ToTokens for CatchStatement {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.keyword, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.value, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for CatchStatement {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(CatchStatement), ::m2_syn::Spanned::span(self));
node.push("keyword", &self.keyword);
node.push("value", &self.value);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for CatchStatement
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("catch_statement", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"catch_statement",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let keyword = <Token![catch] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<Token![catch]>()?,
)?;
let value = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<Expr>()?,
)?);
Ok(Self { keyword, value })
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct ThrowStatement {
pub keyword: Token![throw],
pub value: ::std::boxed::Box<Expr>,
}
impl ThrowStatement {
pub fn new(keyword: Token![throw], value: Expr) -> Self {
{
let value = ::std::boxed::Box::new(value);
Self { keyword, value }
}
}
}
impl ::m2_syn::ToTokens for ThrowStatement {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.keyword, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.value, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for ThrowStatement {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(ThrowStatement), ::m2_syn::Spanned::span(self));
node.push("keyword", &self.keyword);
node.push("value", &self.value);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for ThrowStatement
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("throw_statement", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"throw_statement",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let keyword = <Token![throw] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<Token![throw]>()?,
)?;
let value = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<Expr>()?,
)?);
Ok(Self { keyword, value })
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct TrapStatement {
pub keyword: Token![trap],
pub value: ::std::boxed::Box<Expr>,
}
impl TrapStatement {
pub fn new(keyword: Token![trap], value: Expr) -> Self {
{
let value = ::std::boxed::Box::new(value);
Self { keyword, value }
}
}
}
impl ::m2_syn::ToTokens for TrapStatement {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.keyword, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.value, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for TrapStatement {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(TrapStatement), ::m2_syn::Spanned::span(self));
node.push("keyword", &self.keyword);
node.push("value", &self.value);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for TrapStatement
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("trap_statement", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"trap_statement",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let keyword = <Token![trap] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<Token![trap]>()?,
)?;
let value = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<Expr>()?,
)?);
Ok(Self { keyword, value })
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct ExceptClause {
pub keyword: Token![except],
pub exception: ::std::boxed::Box<Symbol>,
pub do_keyword: Token![do],
pub value: ::std::boxed::Box<Expr>,
}
impl ExceptClause {
pub fn new(
keyword: Token![except],
exception: Symbol,
do_keyword: Token![do],
value: Expr,
) -> Self {
{
let exception = ::std::boxed::Box::new(exception);
let value = ::std::boxed::Box::new(value);
Self {
keyword,
exception,
do_keyword,
value,
}
}
}
}
impl ::m2_syn::ToTokens for ExceptClause {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.keyword, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.exception, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.do_keyword, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.value, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for ExceptClause {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(ExceptClause), ::m2_syn::Spanned::span(self));
node.push("keyword", &self.keyword);
node.push("exception", &self.exception);
node.push("do_keyword", &self.do_keyword);
node.push("value", &self.value);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for ExceptClause
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("except_clause", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"except_clause",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let keyword = <Token![except] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<Token![except]>()?,
)?;
let exception = ::std::boxed::Box::new(<Symbol as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("exception")?,
)?);
let do_keyword = <Token![do] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<Token![do]>()?,
)?;
let value = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<Expr>()?,
)?);
Ok(Self {
keyword,
exception,
do_keyword,
value,
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct TryStatement {
pub keyword: Token![try],
pub value: ::std::boxed::Box<Expr>,
pub then_clause: ::std::option::Option<::std::boxed::Box<ThenClause>>,
pub fallback: ::std::option::Option<::std::boxed::Box<TryFallback>>,
}
impl TryStatement {
pub fn new(
keyword: Token![try],
value: Expr,
then_clause: ::std::option::Option<ThenClause>,
fallback: ::std::option::Option<TryFallback>,
) -> Self {
{
let value = ::std::boxed::Box::new(value);
let then_clause = then_clause.map(::std::boxed::Box::new);
let fallback = fallback.map(::std::boxed::Box::new);
Self {
keyword,
value,
then_clause,
fallback,
}
}
}
}
impl ::m2_syn::ToTokens for TryStatement {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.keyword, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.value, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.then_clause, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.fallback, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for TryStatement {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node =
::m2_syn::PrettyNode::syntax(stringify!(TryStatement), ::m2_syn::Spanned::span(self));
node.push("keyword", &self.keyword);
node.push("value", &self.value);
node.push("then_clause", &self.then_clause);
node.push("fallback", &self.fallback);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for TryStatement
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("try_statement", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"try_statement",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let keyword = <Token![try] as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<Token![try]>()?,
)?;
let value = ::std::boxed::Box::new(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<Expr>()?,
)?);
let then_clause = children
.optional_matching::<ThenClause>()
.map(|node| {
let value = <ThenClause as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(::std::boxed::Box::new(value))
})
.transpose()?;
let fallback = children
.optional_field("fallback")
.map(|node| {
let value = <TryFallback as ::m2_syn::Reconstruct<N>>::reconstruct(node)?;
Ok::<_, ::m2_syn::ReconstructError>(::std::boxed::Box::new(value))
})
.transpose()?;
Ok(Self {
keyword,
value,
then_clause,
fallback,
})
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub struct QuoteExpression {
pub specifier: QuoteSpecifier,
pub token: ::std::boxed::Box<Symbol>,
}
impl QuoteExpression {
pub fn new(specifier: QuoteSpecifier, token: Symbol) -> Self {
{
let token = ::std::boxed::Box::new(token);
Self { specifier, token }
}
}
}
impl ::m2_syn::ToTokens for QuoteExpression {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
let mut contents = ::m2_syn::TokenStream::new();
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.specifier, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
{
let mut field_output = ::m2_syn::TokenStream::new();
::m2_syn::ToTokens::to_tokens(&self.token, &mut field_output);
if !field_output.is_empty() {
if !contents.is_empty()
&& !contents.ends_with_whitespace()
&& !field_output.starts_with_whitespace()
{
contents.push_trivia(::m2_syn::Trivia::new(
::m2_syn::TriviaKind::Whitespace,
" ",
::m2_syn::Span::detached(),
));
}
::m2_syn::ToTokens::to_tokens(&field_output, &mut contents);
}
}
::m2_syn::ToTokens::to_tokens(&contents, output);
}
}
impl ::m2_syn::PrettyTree for QuoteExpression {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
let mut node = ::m2_syn::PrettyNode::syntax(
stringify!(QuoteExpression),
::m2_syn::Spanned::span(self),
);
node.push("specifier", &self.specifier);
node.push("token", &self.token);
node
}
}
impl<N> ::m2_syn::Reconstruct<N> for QuoteExpression
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
node.identity().matches("quote_expression", true)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if !<Self as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Err(::m2_syn::ReconstructError::wrong_node(
"quote_expression",
true,
node.identity(),
));
}
let mut children = ::m2_syn::ChildCursor::new(&node);
let specifier = <QuoteSpecifier as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_matching::<QuoteSpecifier>()?,
)?;
let token = ::std::boxed::Box::new(<Symbol as ::m2_syn::Reconstruct<N>>::reconstruct(
children.required_field("token")?,
)?);
Ok(Self { specifier, token })
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub enum PrefixOperator {
Hsh(Token![#]),
Mul(Token![*]),
Add(Token![+]),
Sub(Token![-]),
Lst(Token![<]),
LstLst(Token![<<]),
LstEql(Token![<=]),
LstEqlEql(Token![<==]),
LstEqlEqlEql(Token![<===]),
Gst(Token![>]),
GstEql(Token![>=]),
Qsm(Token![?]),
QsmQsm(Token![??]),
PipSub(Token![|-]),
Tld(Token![~]),
Not(Token![not]),
}
impl ::m2_syn::ToTokens for PrefixOperator {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
match self {
Self::Hsh(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Mul(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Add(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Sub(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Lst(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::LstLst(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::LstEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::LstEqlEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::LstEqlEqlEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Gst(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::GstEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Qsm(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::QsmQsm(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::PipSub(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Tld(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Not(node) => ::m2_syn::ToTokens::to_tokens(node, output),
}
}
}
impl ::m2_syn::PrettyTree for PrefixOperator {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
match self {
Self::Hsh(value) => ::m2_syn::PrettyNode::variant(
stringify!(PrefixOperator),
stringify!(Hsh),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Mul(value) => ::m2_syn::PrettyNode::variant(
stringify!(PrefixOperator),
stringify!(Mul),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Add(value) => ::m2_syn::PrettyNode::variant(
stringify!(PrefixOperator),
stringify!(Add),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Sub(value) => ::m2_syn::PrettyNode::variant(
stringify!(PrefixOperator),
stringify!(Sub),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Lst(value) => ::m2_syn::PrettyNode::variant(
stringify!(PrefixOperator),
stringify!(Lst),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::LstLst(value) => ::m2_syn::PrettyNode::variant(
stringify!(PrefixOperator),
stringify!(LstLst),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::LstEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(PrefixOperator),
stringify!(LstEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::LstEqlEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(PrefixOperator),
stringify!(LstEqlEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::LstEqlEqlEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(PrefixOperator),
stringify!(LstEqlEqlEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Gst(value) => ::m2_syn::PrettyNode::variant(
stringify!(PrefixOperator),
stringify!(Gst),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::GstEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(PrefixOperator),
stringify!(GstEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Qsm(value) => ::m2_syn::PrettyNode::variant(
stringify!(PrefixOperator),
stringify!(Qsm),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::QsmQsm(value) => ::m2_syn::PrettyNode::variant(
stringify!(PrefixOperator),
stringify!(QsmQsm),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::PipSub(value) => ::m2_syn::PrettyNode::variant(
stringify!(PrefixOperator),
stringify!(PipSub),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Tld(value) => ::m2_syn::PrettyNode::variant(
stringify!(PrefixOperator),
stringify!(Tld),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Not(value) => ::m2_syn::PrettyNode::variant(
stringify!(PrefixOperator),
stringify!(Not),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
}
}
}
impl<N> ::m2_syn::Reconstruct<N> for PrefixOperator
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
<Token![#] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![*] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![+] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![-] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![<] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![<<] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![<=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![<==] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![<===] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![>] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![>=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![?] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![??] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![|-] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![~] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![not] as ::m2_syn::Reconstruct<N>>::matches(node)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if <Token![#] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Hsh(
<Token![#] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![*] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Mul(
<Token![*] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![+] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Add(
<Token![+] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![-] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Sub(
<Token![-] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![<] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Lst(
<Token![<] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![<<] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::LstLst(
<Token![<<] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![<=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::LstEql(
<Token![<=] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![<==] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::LstEqlEql(<Token![<==] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![<===] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::LstEqlEqlEql(
<Token![<===] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![>] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Gst(
<Token![>] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![>=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::GstEql(
<Token![>=] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![?] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Qsm(
<Token![?] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![??] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::QsmQsm(
<Token![??] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![|-] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::PipSub(
<Token![|-] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![~] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Tld(
<Token![~] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![not] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Not(
<Token![not] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
Err(::m2_syn::ReconstructError::wrong_category(
stringify!(PrefixOperator),
node.identity(),
))
}
}
impl PrefixOperator {
pub fn from_spelling(spelling: &str, span: ::m2_syn::Span) -> ::std::option::Option<Self> {
match spelling {
"#" => Some(Self::Hsh(Token)),
"*" => Some(Self::Mul(Token)),
"+" => Some(Self::Add(Token)),
"-" => Some(Self::Sub(Token)),
"<" => Some(Self::Lst(Token)),
"<<" => Some(Self::LstLst(Token)),
"<=" => Some(Self::LstEql(Token)),
"<==" => Some(Self::LstEqlEql(Token)),
"<===" => Some(Self::LstEqlEqlEql(Token)),
">" => Some(Self::Gst(Token)),
">=" => Some(Self::GstEql(Token)),
"?" => Some(Self::Qsm(Token)),
"??" => Some(Self::QsmQsm(Token)),
"|-" => Some(Self::PipSub(Token)),
"~" => Some(Self::Tld(Token)),
"not" => Some(Self::Not(Token)),
_ => None,
}
}
pub fn from_token_tree(token: ::m2_syn::TokenTree) -> ::std::option::Option<Self> {
if <Token![#] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Hsh(<Token![#] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![*] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Mul(<Token![*] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![+] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Add(<Token![+] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![-] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Sub(<Token![-] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![<] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Lst(<Token![<] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![<<] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::LstLst(
<Token![<<] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![<=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::LstEql(
<Token![<=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![<==] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::LstEqlEql(
<Token![<==] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![<===] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::LstEqlEqlEql(
<Token![<===] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![>] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Gst(<Token![>] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![>=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::GstEql(
<Token![>=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![?] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Qsm(<Token![?] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![??] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::QsmQsm(
<Token![??] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![|-] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::PipSub(
<Token![|-] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![~] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Tld(<Token![~] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![not] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Not(
<Token![not] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
None
}
pub fn spelling(&self) -> &'static str {
match self {
Self::Hsh(_) => "#",
Self::Mul(_) => "*",
Self::Add(_) => "+",
Self::Sub(_) => "-",
Self::Lst(_) => "<",
Self::LstLst(_) => "<<",
Self::LstEql(_) => "<=",
Self::LstEqlEql(_) => "<==",
Self::LstEqlEqlEql(_) => "<===",
Self::Gst(_) => ">",
Self::GstEql(_) => ">=",
Self::Qsm(_) => "?",
Self::QsmQsm(_) => "??",
Self::PipSub(_) => "|-",
Self::Tld(_) => "~",
Self::Not(_) => "not",
}
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub enum BinaryOperator {
BngEql(Token![!=]),
Hsh(Token![#]),
HshQsm(Token![#?]),
Mod(Token![%]),
ModEql(Token![%=]),
Amp(Token![&]),
AmpEql(Token![&=]),
Mul(Token![*]),
MulEql(Token![*=]),
MulMul(Token![**]),
MulMulEql(Token![**=]),
Add(Token![+]),
AddEql(Token![+=]),
AddAdd(Token![++]),
AddAddEql(Token![++=]),
Sub(Token![-]),
SubEql(Token![-=]),
Dot(Token![.]),
DotDot(Token![..]),
DotDotEql(Token![..=]),
DotDotLst(Token![..<]),
DotDotLstEql(Token![..<=]),
DotQsm(Token![.?]),
Slh(Token![/]),
SlhEql(Token![/=]),
SlhSlh(Token![/ /]),
SlhSlhEql(Token![/ /=]),
Col(Token![:]),
ColEql(Token![:=]),
Lst(Token![<]),
LstLst(Token![<<]),
LstLstEql(Token![<<=]),
LstEql(Token![<=]),
LstEqlEql(Token![<==]),
LstEqlEqlEql(Token![<===]),
LstEqlEqlGst(Token![<==>]),
LstEqlEqlGstEql(Token![<==>=]),
EqlBngEql(Token![=!=]),
EqlEql(Token![==]),
EqlEqlEql(Token![===]),
EqlEqlEqlGst(Token![===>]),
EqlEqlEqlGstEql(Token![===>=]),
EqlEqlGst(Token![==>]),
EqlEqlGstEql(Token![==>=]),
Gst(Token![>]),
GstEql(Token![>=]),
GstGst(Token![>>]),
GstGstEql(Token![>>=]),
Qsm(Token![?]),
QsmQsm(Token![??]),
QsmQsmEql(Token![??=]),
Att(Token![@]),
AttEql(Token![@=]),
AttAtt(Token![@@]),
AttAttEql(Token![@@=]),
AttAttQsm(Token![@@?]),
AttAttQsmEql(Token![@@?=]),
Bsl(Token!["\\"]),
BslEql(Token!["\\="]),
BslBsl(Token!["\\\\"]),
BslBslEql(Token!["\\\\="]),
Crt(Token![^]),
CrtEql(Token![^=]),
CrtMulMul(Token![^**]),
CrtMulMulEql(Token![^**=]),
CrtLst(Token![^<]),
CrtLstEql(Token![^<=]),
CrtGst(Token![^>]),
CrtGstEql(Token![^>=]),
CrtCrt(Token![^^]),
CrtCrtEql(Token![^^=]),
Ubs(Token![_]),
UbsEql(Token![_=]),
UbsLst(Token![_<]),
UbsLstEql(Token![_<=]),
UbsGst(Token![_>]),
UbsGstEql(Token![_>=]),
Pip(Token![|]),
PipEql(Token![|=]),
PipSub(Token![|-]),
PipSubEql(Token![|-=]),
PipUbs(Token![|_]),
PipUbsEql(Token![|_=]),
PipPip(Token![||]),
PipPipEql(Token![||=]),
Tld(Token![~]),
TldEql(Token![~=]),
Cdt(Token!["·"]),
CdtEql(Token!["·="]),
Box(Token!["⊠"]),
BoxEql(Token!["⊠="]),
Sfp(Token!["â§¢"]),
SfpEql(Token!["â§¢="]),
And(Token![and]),
Or(Token![or]),
Space(Token![SPACE]),
Xor(Token![xor]),
}
impl ::m2_syn::ToTokens for BinaryOperator {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
match self {
Self::BngEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Hsh(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::HshQsm(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Mod(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::ModEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Amp(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::AmpEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Mul(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::MulEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::MulMul(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::MulMulEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Add(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::AddEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::AddAdd(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::AddAddEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Sub(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::SubEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Dot(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::DotDot(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::DotDotEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::DotDotLst(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::DotDotLstEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::DotQsm(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Slh(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::SlhEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::SlhSlh(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::SlhSlhEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Col(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::ColEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Lst(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::LstLst(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::LstLstEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::LstEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::LstEqlEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::LstEqlEqlEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::LstEqlEqlGst(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::LstEqlEqlGstEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::EqlBngEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::EqlEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::EqlEqlEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::EqlEqlEqlGst(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::EqlEqlEqlGstEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::EqlEqlGst(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::EqlEqlGstEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Gst(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::GstEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::GstGst(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::GstGstEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Qsm(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::QsmQsm(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::QsmQsmEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Att(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::AttEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::AttAtt(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::AttAttEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::AttAttQsm(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::AttAttQsmEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Bsl(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::BslEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::BslBsl(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::BslBslEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Crt(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::CrtEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::CrtMulMul(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::CrtMulMulEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::CrtLst(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::CrtLstEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::CrtGst(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::CrtGstEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::CrtCrt(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::CrtCrtEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Ubs(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::UbsEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::UbsLst(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::UbsLstEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::UbsGst(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::UbsGstEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Pip(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::PipEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::PipSub(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::PipSubEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::PipUbs(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::PipUbsEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::PipPip(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::PipPipEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Tld(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::TldEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Cdt(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::CdtEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Box(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::BoxEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Sfp(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::SfpEql(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::And(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Or(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Space(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Xor(node) => ::m2_syn::ToTokens::to_tokens(node, output),
}
}
}
impl ::m2_syn::PrettyTree for BinaryOperator {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
match self {
Self::BngEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(BngEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Hsh(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(Hsh),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::HshQsm(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(HshQsm),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Mod(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(Mod),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::ModEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(ModEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Amp(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(Amp),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::AmpEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(AmpEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Mul(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(Mul),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::MulEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(MulEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::MulMul(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(MulMul),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::MulMulEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(MulMulEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Add(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(Add),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::AddEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(AddEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::AddAdd(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(AddAdd),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::AddAddEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(AddAddEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Sub(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(Sub),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::SubEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(SubEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Dot(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(Dot),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::DotDot(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(DotDot),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::DotDotEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(DotDotEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::DotDotLst(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(DotDotLst),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::DotDotLstEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(DotDotLstEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::DotQsm(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(DotQsm),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Slh(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(Slh),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::SlhEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(SlhEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::SlhSlh(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(SlhSlh),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::SlhSlhEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(SlhSlhEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Col(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(Col),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::ColEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(ColEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Lst(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(Lst),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::LstLst(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(LstLst),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::LstLstEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(LstLstEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::LstEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(LstEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::LstEqlEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(LstEqlEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::LstEqlEqlEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(LstEqlEqlEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::LstEqlEqlGst(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(LstEqlEqlGst),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::LstEqlEqlGstEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(LstEqlEqlGstEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::EqlBngEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(EqlBngEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::EqlEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(EqlEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::EqlEqlEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(EqlEqlEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::EqlEqlEqlGst(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(EqlEqlEqlGst),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::EqlEqlEqlGstEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(EqlEqlEqlGstEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::EqlEqlGst(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(EqlEqlGst),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::EqlEqlGstEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(EqlEqlGstEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Gst(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(Gst),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::GstEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(GstEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::GstGst(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(GstGst),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::GstGstEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(GstGstEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Qsm(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(Qsm),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::QsmQsm(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(QsmQsm),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::QsmQsmEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(QsmQsmEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Att(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(Att),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::AttEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(AttEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::AttAtt(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(AttAtt),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::AttAttEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(AttAttEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::AttAttQsm(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(AttAttQsm),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::AttAttQsmEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(AttAttQsmEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Bsl(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(Bsl),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::BslEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(BslEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::BslBsl(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(BslBsl),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::BslBslEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(BslBslEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Crt(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(Crt),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::CrtEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(CrtEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::CrtMulMul(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(CrtMulMul),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::CrtMulMulEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(CrtMulMulEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::CrtLst(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(CrtLst),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::CrtLstEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(CrtLstEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::CrtGst(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(CrtGst),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::CrtGstEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(CrtGstEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::CrtCrt(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(CrtCrt),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::CrtCrtEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(CrtCrtEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Ubs(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(Ubs),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::UbsEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(UbsEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::UbsLst(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(UbsLst),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::UbsLstEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(UbsLstEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::UbsGst(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(UbsGst),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::UbsGstEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(UbsGstEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Pip(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(Pip),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::PipEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(PipEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::PipSub(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(PipSub),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::PipSubEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(PipSubEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::PipUbs(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(PipUbs),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::PipUbsEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(PipUbsEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::PipPip(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(PipPip),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::PipPipEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(PipPipEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Tld(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(Tld),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::TldEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(TldEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Cdt(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(Cdt),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::CdtEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(CdtEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Box(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(Box),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::BoxEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(BoxEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Sfp(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(Sfp),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::SfpEql(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(SfpEql),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::And(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(And),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Or(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(Or),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Space(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(Space),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Xor(value) => ::m2_syn::PrettyNode::variant(
stringify!(BinaryOperator),
stringify!(Xor),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
}
}
}
impl<N> ::m2_syn::Reconstruct<N> for BinaryOperator
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
<Token![!=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![#] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![#?] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![%] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![%=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![&] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![&=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![*] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![*=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![**] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![**=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![+] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![+=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![++] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![++=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![-] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![-=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![.] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![..] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![..=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![..<] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![..<=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![.?] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![/] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![/=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![/ /] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![/ /=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![:] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![:=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![<] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![<<] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![<<=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![<=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![<==] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![<===] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![<==>] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![<==>=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![=!=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![==] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![===] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![===>] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![===>=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![==>] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![==>=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![>] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![>=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![>>] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![>>=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![?] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![??] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![??=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![@] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![@=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![@@] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![@@=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![@@?] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![@@?=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token!["\\"] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token!["\\="] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token!["\\\\"] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token!["\\\\="] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![^] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![^=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![^**] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![^**=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![^<] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![^<=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![^>] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![^>=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![^^] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![^^=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![_] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![_=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![_<] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![_<=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![_>] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![_>=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![|] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![|=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![|-] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![|-=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![|_] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![|_=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![||] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![||=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![~] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![~=] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token!["·"] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token!["·="] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token!["⊠"] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token!["⊠="] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token!["â§¢"] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token!["â§¢="] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![and] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![or] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![SPACE] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![xor] as ::m2_syn::Reconstruct<N>>::matches(node)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if <Token![!=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::BngEql(
<Token![!=] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![#] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Hsh(
<Token![#] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![#?] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::HshQsm(
<Token![#?] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![%] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Mod(
<Token![%] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![%=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::ModEql(
<Token![%=] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![&] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Amp(
<Token![&] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![&=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::AmpEql(
<Token![&=] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![*] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Mul(
<Token![*] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![*=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::MulEql(
<Token![*=] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![**] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::MulMul(
<Token![**] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![**=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::MulMulEql(<Token![**=] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![+] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Add(
<Token![+] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![+=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::AddEql(
<Token![+=] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![++] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::AddAdd(
<Token![++] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![++=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::AddAddEql(<Token![++=] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![-] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Sub(
<Token![-] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![-=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::SubEql(
<Token![-=] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![.] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Dot(
<Token![.] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![..] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::DotDot(
<Token![..] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![..=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::DotDotEql(<Token![..=] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![..<] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::DotDotLst(<Token![..<] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![..<=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::DotDotLstEql(
<Token![..<=] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![.?] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::DotQsm(
<Token![.?] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![/] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Slh(
<Token![/] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![/=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::SlhEql(
<Token![/=] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![/ /] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::SlhSlh(
<Token![/ /] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![/ /=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::SlhSlhEql(<Token![/ /=] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![:] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Col(
<Token![:] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![:=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::ColEql(
<Token![:=] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![<] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Lst(
<Token![<] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![<<] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::LstLst(
<Token![<<] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![<<=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::LstLstEql(<Token![<<=] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![<=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::LstEql(
<Token![<=] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![<==] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::LstEqlEql(<Token![<==] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![<===] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::LstEqlEqlEql(
<Token![<===] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![<==>] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::LstEqlEqlGst(
<Token![<==>] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![<==>=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::LstEqlEqlGstEql(
<Token![<==>=] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![=!=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::EqlBngEql(<Token![=!=] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![==] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::EqlEql(
<Token![==] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![===] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::EqlEqlEql(<Token![===] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![===>] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::EqlEqlEqlGst(
<Token![===>] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![===>=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::EqlEqlEqlGstEql(
<Token![===>=] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![==>] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::EqlEqlGst(<Token![==>] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![==>=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::EqlEqlGstEql(
<Token![==>=] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![>] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Gst(
<Token![>] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![>=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::GstEql(
<Token![>=] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![>>] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::GstGst(
<Token![>>] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![>>=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::GstGstEql(<Token![>>=] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![?] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Qsm(
<Token![?] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![??] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::QsmQsm(
<Token![??] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![??=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::QsmQsmEql(<Token![??=] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![@] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Att(
<Token![@] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![@=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::AttEql(
<Token![@=] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![@@] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::AttAtt(
<Token![@@] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![@@=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::AttAttEql(<Token![@@=] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![@@?] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::AttAttQsm(<Token![@@?] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![@@?=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::AttAttQsmEql(
<Token![@@?=] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token!["\\"] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Bsl(
<Token!["\\"] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token!["\\="] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::BslEql(
<Token!["\\="] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token!["\\\\"] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::BslBsl(<Token!["\\\\"] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token!["\\\\="] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::BslBslEql(
<Token!["\\\\="] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![^] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Crt(
<Token![^] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![^=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::CrtEql(
<Token![^=] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![^**] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::CrtMulMul(<Token![^**] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![^**=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::CrtMulMulEql(
<Token![^**=] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![^<] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::CrtLst(
<Token![^<] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![^<=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::CrtLstEql(<Token![^<=] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![^>] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::CrtGst(
<Token![^>] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![^>=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::CrtGstEql(<Token![^>=] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![^^] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::CrtCrt(
<Token![^^] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![^^=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::CrtCrtEql(<Token![^^=] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![_] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Ubs(
<Token![_] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![_=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::UbsEql(
<Token![_=] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![_<] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::UbsLst(
<Token![_<] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![_<=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::UbsLstEql(<Token![_<=] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![_>] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::UbsGst(
<Token![_>] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![_>=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::UbsGstEql(<Token![_>=] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![|] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Pip(
<Token![|] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![|=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::PipEql(
<Token![|=] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![|-] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::PipSub(
<Token![|-] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![|-=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::PipSubEql(<Token![|-=] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![|_] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::PipUbs(
<Token![|_] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![|_=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::PipUbsEql(<Token![|_=] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![||] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::PipPip(
<Token![||] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![||=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::PipPipEql(<Token![||=] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![~] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Tld(
<Token![~] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![~=] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::TldEql(
<Token![~=] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token!["·"] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Cdt(
<Token!["·"] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token!["·="] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::CdtEql(
<Token!["·="] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token!["⊠"] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Box(
<Token!["⊠"] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token!["⊠="] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::BoxEql(<Token!["⊠="] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token!["â§¢"] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Sfp(
<Token!["â§¢"] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token!["â§¢="] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::SfpEql(<Token!["â§¢="] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![and] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::And(
<Token![and] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![or] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Or(
<Token![or] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![SPACE] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Space(
<Token![SPACE] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![xor] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Xor(
<Token![xor] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
Err(::m2_syn::ReconstructError::wrong_category(
stringify!(BinaryOperator),
node.identity(),
))
}
}
impl BinaryOperator {
pub fn from_spelling(spelling: &str, span: ::m2_syn::Span) -> ::std::option::Option<Self> {
match spelling {
"!=" => Some(Self::BngEql(Token)),
"#" => Some(Self::Hsh(Token)),
"#?" => Some(Self::HshQsm(Token)),
"%" => Some(Self::Mod(Token)),
"%=" => Some(Self::ModEql(Token)),
"&" => Some(Self::Amp(Token)),
"&=" => Some(Self::AmpEql(Token)),
"*" => Some(Self::Mul(Token)),
"*=" => Some(Self::MulEql(Token)),
"**" => Some(Self::MulMul(Token)),
"**=" => Some(Self::MulMulEql(Token)),
"+" => Some(Self::Add(Token)),
"+=" => Some(Self::AddEql(Token)),
"++" => Some(Self::AddAdd(Token)),
"++=" => Some(Self::AddAddEql(Token)),
"-" => Some(Self::Sub(Token)),
"-=" => Some(Self::SubEql(Token)),
"." => Some(Self::Dot(Token)),
".." => Some(Self::DotDot(Token)),
"..=" => Some(Self::DotDotEql(Token)),
"..<" => Some(Self::DotDotLst(Token)),
"..<=" => Some(Self::DotDotLstEql(Token)),
".?" => Some(Self::DotQsm(Token)),
"/" => Some(Self::Slh(Token)),
"/=" => Some(Self::SlhEql(Token)),
"//" => Some(Self::SlhSlh(Token)),
"//=" => Some(Self::SlhSlhEql(Token)),
":" => Some(Self::Col(Token)),
":=" => Some(Self::ColEql(Token)),
"<" => Some(Self::Lst(Token)),
"<<" => Some(Self::LstLst(Token)),
"<<=" => Some(Self::LstLstEql(Token)),
"<=" => Some(Self::LstEql(Token)),
"<==" => Some(Self::LstEqlEql(Token)),
"<===" => Some(Self::LstEqlEqlEql(Token)),
"<==>" => Some(Self::LstEqlEqlGst(Token)),
"<==>=" => Some(Self::LstEqlEqlGstEql(Token)),
"=!=" => Some(Self::EqlBngEql(Token)),
"==" => Some(Self::EqlEql(Token)),
"===" => Some(Self::EqlEqlEql(Token)),
"===>" => Some(Self::EqlEqlEqlGst(Token)),
"===>=" => Some(Self::EqlEqlEqlGstEql(Token)),
"==>" => Some(Self::EqlEqlGst(Token)),
"==>=" => Some(Self::EqlEqlGstEql(Token)),
">" => Some(Self::Gst(Token)),
">=" => Some(Self::GstEql(Token)),
">>" => Some(Self::GstGst(Token)),
">>=" => Some(Self::GstGstEql(Token)),
"?" => Some(Self::Qsm(Token)),
"??" => Some(Self::QsmQsm(Token)),
"??=" => Some(Self::QsmQsmEql(Token)),
"@" => Some(Self::Att(Token)),
"@=" => Some(Self::AttEql(Token)),
"@@" => Some(Self::AttAtt(Token)),
"@@=" => Some(Self::AttAttEql(Token)),
"@@?" => Some(Self::AttAttQsm(Token)),
"@@?=" => Some(Self::AttAttQsmEql(Token)),
"\\" => Some(Self::Bsl(Token)),
"\\=" => Some(Self::BslEql(Token)),
"\\\\" => Some(Self::BslBsl(Token)),
"\\\\=" => Some(Self::BslBslEql(Token)),
"^" => Some(Self::Crt(Token)),
"^=" => Some(Self::CrtEql(Token)),
"^**" => Some(Self::CrtMulMul(Token)),
"^**=" => Some(Self::CrtMulMulEql(Token)),
"^<" => Some(Self::CrtLst(Token)),
"^<=" => Some(Self::CrtLstEql(Token)),
"^>" => Some(Self::CrtGst(Token)),
"^>=" => Some(Self::CrtGstEql(Token)),
"^^" => Some(Self::CrtCrt(Token)),
"^^=" => Some(Self::CrtCrtEql(Token)),
"_" => Some(Self::Ubs(Token)),
"_=" => Some(Self::UbsEql(Token)),
"_<" => Some(Self::UbsLst(Token)),
"_<=" => Some(Self::UbsLstEql(Token)),
"_>" => Some(Self::UbsGst(Token)),
"_>=" => Some(Self::UbsGstEql(Token)),
"|" => Some(Self::Pip(Token)),
"|=" => Some(Self::PipEql(Token)),
"|-" => Some(Self::PipSub(Token)),
"|-=" => Some(Self::PipSubEql(Token)),
"|_" => Some(Self::PipUbs(Token)),
"|_=" => Some(Self::PipUbsEql(Token)),
"||" => Some(Self::PipPip(Token)),
"||=" => Some(Self::PipPipEql(Token)),
"~" => Some(Self::Tld(Token)),
"~=" => Some(Self::TldEql(Token)),
"·" => Some(Self::Cdt(Token)),
"·=" => Some(Self::CdtEql(Token)),
"⊠" => Some(Self::Box(Token)),
"⊠=" => Some(Self::BoxEql(Token)),
"â§¢" => Some(Self::Sfp(Token)),
"â§¢=" => Some(Self::SfpEql(Token)),
"and" => Some(Self::And(Token)),
"or" => Some(Self::Or(Token)),
"SPACE" => Some(Self::Space(Token)),
"xor" => Some(Self::Xor(Token)),
_ => None,
}
}
pub fn from_token_tree(token: ::m2_syn::TokenTree) -> ::std::option::Option<Self> {
if <Token![!=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::BngEql(
<Token![!=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![#] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Hsh(<Token![#] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![#?] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::HshQsm(
<Token![#?] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![%] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Mod(<Token![%] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![%=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::ModEql(
<Token![%=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![&] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Amp(<Token![&] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![&=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::AmpEql(
<Token![&=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![*] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Mul(<Token![*] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![*=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::MulEql(
<Token![*=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![**] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::MulMul(
<Token![**] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![**=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::MulMulEql(
<Token![**=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![+] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Add(<Token![+] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![+=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::AddEql(
<Token![+=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![++] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::AddAdd(
<Token![++] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![++=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::AddAddEql(
<Token![++=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![-] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Sub(<Token![-] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![-=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::SubEql(
<Token![-=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![.] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Dot(<Token![.] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![..] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::DotDot(
<Token![..] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![..=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::DotDotEql(
<Token![..=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![..<] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::DotDotLst(
<Token![..<] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![..<=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::DotDotLstEql(
<Token![..<=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![.?] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::DotQsm(
<Token![.?] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![/] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Slh(<Token![/] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![/=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::SlhEql(
<Token![/=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![/ /] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::SlhSlh(
<Token![/ /] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![/ /=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::SlhSlhEql(
<Token![/ /=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![:] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Col(<Token![:] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![:=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::ColEql(
<Token![:=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![<] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Lst(<Token![<] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![<<] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::LstLst(
<Token![<<] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![<<=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::LstLstEql(
<Token![<<=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![<=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::LstEql(
<Token![<=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![<==] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::LstEqlEql(
<Token![<==] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![<===] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::LstEqlEqlEql(
<Token![<===] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![<==>] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::LstEqlEqlGst(
<Token![<==>] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![<==>=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::LstEqlEqlGstEql(
<Token![<==>=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![=!=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::EqlBngEql(
<Token![=!=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![==] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::EqlEql(
<Token![==] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![===] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::EqlEqlEql(
<Token![===] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![===>] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::EqlEqlEqlGst(
<Token![===>] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![===>=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::EqlEqlEqlGstEql(
<Token![===>=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![==>] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::EqlEqlGst(
<Token![==>] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![==>=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::EqlEqlGstEql(
<Token![==>=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![>] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Gst(<Token![>] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![>=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::GstEql(
<Token![>=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![>>] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::GstGst(
<Token![>>] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![>>=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::GstGstEql(
<Token![>>=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![?] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Qsm(<Token![?] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![??] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::QsmQsm(
<Token![??] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![??=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::QsmQsmEql(
<Token![??=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![@] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Att(<Token![@] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![@=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::AttEql(
<Token![@=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![@@] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::AttAtt(
<Token![@@] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![@@=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::AttAttEql(
<Token![@@=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![@@?] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::AttAttQsm(
<Token![@@?] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![@@?=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::AttAttQsmEql(
<Token![@@?=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token!["\\"] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Bsl(
<Token!["\\"] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token!["\\="] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::BslEql(
<Token!["\\="] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token!["\\\\"] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::BslBsl(
<Token!["\\\\"] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token!["\\\\="] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::BslBslEql(
<Token!["\\\\="] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![^] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Crt(<Token![^] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![^=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::CrtEql(
<Token![^=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![^**] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::CrtMulMul(
<Token![^**] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![^**=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::CrtMulMulEql(
<Token![^**=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![^<] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::CrtLst(
<Token![^<] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![^<=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::CrtLstEql(
<Token![^<=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![^>] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::CrtGst(
<Token![^>] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![^>=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::CrtGstEql(
<Token![^>=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![^^] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::CrtCrt(
<Token![^^] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![^^=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::CrtCrtEql(
<Token![^^=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![_] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Ubs(<Token![_] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![_=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::UbsEql(
<Token![_=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![_<] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::UbsLst(
<Token![_<] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![_<=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::UbsLstEql(
<Token![_<=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![_>] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::UbsGst(
<Token![_>] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![_>=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::UbsGstEql(
<Token![_>=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![|] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Pip(<Token![|] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![|=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::PipEql(
<Token![|=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![|-] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::PipSub(
<Token![|-] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![|-=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::PipSubEql(
<Token![|-=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![|_] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::PipUbs(
<Token![|_] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![|_=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::PipUbsEql(
<Token![|_=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![||] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::PipPip(
<Token![||] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![||=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::PipPipEql(
<Token![||=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![~] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Tld(<Token![~] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![~=] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::TldEql(
<Token![~=] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token!["·"] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Cdt(
<Token!["·"] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token!["·="] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::CdtEql(
<Token!["·="] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token!["⊠"] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Box(
<Token!["⊠"] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token!["⊠="] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::BoxEql(
<Token!["⊠="] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token!["â§¢"] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Sfp(
<Token!["â§¢"] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token!["â§¢="] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::SfpEql(
<Token!["â§¢="] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![and] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::And(
<Token![and] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![or] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Or(<Token![or] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![SPACE] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Space(
<Token![SPACE] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![xor] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Xor(
<Token![xor] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
None
}
pub fn spelling(&self) -> &'static str {
match self {
Self::BngEql(_) => "!=",
Self::Hsh(_) => "#",
Self::HshQsm(_) => "#?",
Self::Mod(_) => "%",
Self::ModEql(_) => "%=",
Self::Amp(_) => "&",
Self::AmpEql(_) => "&=",
Self::Mul(_) => "*",
Self::MulEql(_) => "*=",
Self::MulMul(_) => "**",
Self::MulMulEql(_) => "**=",
Self::Add(_) => "+",
Self::AddEql(_) => "+=",
Self::AddAdd(_) => "++",
Self::AddAddEql(_) => "++=",
Self::Sub(_) => "-",
Self::SubEql(_) => "-=",
Self::Dot(_) => ".",
Self::DotDot(_) => "..",
Self::DotDotEql(_) => "..=",
Self::DotDotLst(_) => "..<",
Self::DotDotLstEql(_) => "..<=",
Self::DotQsm(_) => ".?",
Self::Slh(_) => "/",
Self::SlhEql(_) => "/=",
Self::SlhSlh(_) => "//",
Self::SlhSlhEql(_) => "//=",
Self::Col(_) => ":",
Self::ColEql(_) => ":=",
Self::Lst(_) => "<",
Self::LstLst(_) => "<<",
Self::LstLstEql(_) => "<<=",
Self::LstEql(_) => "<=",
Self::LstEqlEql(_) => "<==",
Self::LstEqlEqlEql(_) => "<===",
Self::LstEqlEqlGst(_) => "<==>",
Self::LstEqlEqlGstEql(_) => "<==>=",
Self::EqlBngEql(_) => "=!=",
Self::EqlEql(_) => "==",
Self::EqlEqlEql(_) => "===",
Self::EqlEqlEqlGst(_) => "===>",
Self::EqlEqlEqlGstEql(_) => "===>=",
Self::EqlEqlGst(_) => "==>",
Self::EqlEqlGstEql(_) => "==>=",
Self::Gst(_) => ">",
Self::GstEql(_) => ">=",
Self::GstGst(_) => ">>",
Self::GstGstEql(_) => ">>=",
Self::Qsm(_) => "?",
Self::QsmQsm(_) => "??",
Self::QsmQsmEql(_) => "??=",
Self::Att(_) => "@",
Self::AttEql(_) => "@=",
Self::AttAtt(_) => "@@",
Self::AttAttEql(_) => "@@=",
Self::AttAttQsm(_) => "@@?",
Self::AttAttQsmEql(_) => "@@?=",
Self::Bsl(_) => "\\",
Self::BslEql(_) => "\\=",
Self::BslBsl(_) => "\\\\",
Self::BslBslEql(_) => "\\\\=",
Self::Crt(_) => "^",
Self::CrtEql(_) => "^=",
Self::CrtMulMul(_) => "^**",
Self::CrtMulMulEql(_) => "^**=",
Self::CrtLst(_) => "^<",
Self::CrtLstEql(_) => "^<=",
Self::CrtGst(_) => "^>",
Self::CrtGstEql(_) => "^>=",
Self::CrtCrt(_) => "^^",
Self::CrtCrtEql(_) => "^^=",
Self::Ubs(_) => "_",
Self::UbsEql(_) => "_=",
Self::UbsLst(_) => "_<",
Self::UbsLstEql(_) => "_<=",
Self::UbsGst(_) => "_>",
Self::UbsGstEql(_) => "_>=",
Self::Pip(_) => "|",
Self::PipEql(_) => "|=",
Self::PipSub(_) => "|-",
Self::PipSubEql(_) => "|-=",
Self::PipUbs(_) => "|_",
Self::PipUbsEql(_) => "|_=",
Self::PipPip(_) => "||",
Self::PipPipEql(_) => "||=",
Self::Tld(_) => "~",
Self::TldEql(_) => "~=",
Self::Cdt(_) => "·",
Self::CdtEql(_) => "·=",
Self::Box(_) => "⊠",
Self::BoxEql(_) => "⊠=",
Self::Sfp(_) => "â§¢",
Self::SfpEql(_) => "â§¢=",
Self::And(_) => "and",
Self::Or(_) => "or",
Self::Space(_) => "SPACE",
Self::Xor(_) => "xor",
}
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub enum PostfixOperator {
Bng(Token![!]),
Graded(Token![(*)]),
CrtBng(Token![^!]),
CrtMul(Token![^*]),
CrtTld(Token![^~]),
UbsBng(Token![_!]),
UbsMul(Token![_*]),
UbsTld(Token![_~]),
}
impl ::m2_syn::ToTokens for PostfixOperator {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
match self {
Self::Bng(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Graded(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::CrtBng(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::CrtMul(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::CrtTld(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::UbsBng(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::UbsMul(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::UbsTld(node) => ::m2_syn::ToTokens::to_tokens(node, output),
}
}
}
impl ::m2_syn::PrettyTree for PostfixOperator {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
match self {
Self::Bng(value) => ::m2_syn::PrettyNode::variant(
stringify!(PostfixOperator),
stringify!(Bng),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Graded(value) => ::m2_syn::PrettyNode::variant(
stringify!(PostfixOperator),
stringify!(Graded),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::CrtBng(value) => ::m2_syn::PrettyNode::variant(
stringify!(PostfixOperator),
stringify!(CrtBng),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::CrtMul(value) => ::m2_syn::PrettyNode::variant(
stringify!(PostfixOperator),
stringify!(CrtMul),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::CrtTld(value) => ::m2_syn::PrettyNode::variant(
stringify!(PostfixOperator),
stringify!(CrtTld),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::UbsBng(value) => ::m2_syn::PrettyNode::variant(
stringify!(PostfixOperator),
stringify!(UbsBng),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::UbsMul(value) => ::m2_syn::PrettyNode::variant(
stringify!(PostfixOperator),
stringify!(UbsMul),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::UbsTld(value) => ::m2_syn::PrettyNode::variant(
stringify!(PostfixOperator),
stringify!(UbsTld),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
}
}
}
impl<N> ::m2_syn::Reconstruct<N> for PostfixOperator
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
<Token![!] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![(*)] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![^!] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![^*] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![^~] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![_!] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![_*] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![_~] as ::m2_syn::Reconstruct<N>>::matches(node)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if <Token![!] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Bng(
<Token![!] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![(*)] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Graded(
<Token![(*)] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![^!] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::CrtBng(
<Token![^!] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![^*] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::CrtMul(
<Token![^*] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![^~] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::CrtTld(
<Token![^~] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![_!] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::UbsBng(
<Token![_!] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![_*] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::UbsMul(
<Token![_*] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![_~] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::UbsTld(
<Token![_~] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
Err(::m2_syn::ReconstructError::wrong_category(
stringify!(PostfixOperator),
node.identity(),
))
}
}
impl PostfixOperator {
pub fn from_spelling(spelling: &str, span: ::m2_syn::Span) -> ::std::option::Option<Self> {
match spelling {
"!" => Some(Self::Bng(Token)),
"(*)" => Some(Self::Graded(Token)),
"^!" => Some(Self::CrtBng(Token)),
"^*" => Some(Self::CrtMul(Token)),
"^~" => Some(Self::CrtTld(Token)),
"_!" => Some(Self::UbsBng(Token)),
"_*" => Some(Self::UbsMul(Token)),
"_~" => Some(Self::UbsTld(Token)),
_ => None,
}
}
pub fn from_token_tree(token: ::m2_syn::TokenTree) -> ::std::option::Option<Self> {
if <Token![!] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Bng(<Token![!] as ::m2_syn::Token>::from_token_tree(
token,
)?));
}
if <Token![(*)] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::Graded(
<Token![(*)] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![^!] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::CrtBng(
<Token![^!] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![^*] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::CrtMul(
<Token![^*] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![^~] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::CrtTld(
<Token![^~] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![_!] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::UbsBng(
<Token![_!] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![_*] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::UbsMul(
<Token![_*] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
if <Token![_~] as ::m2_syn::Token>::matches_token_tree(&token) {
return Some(Self::UbsTld(
<Token![_~] as ::m2_syn::Token>::from_token_tree(token)?,
));
}
None
}
pub fn spelling(&self) -> &'static str {
match self {
Self::Bng(_) => "!",
Self::Graded(_) => "(*)",
Self::CrtBng(_) => "^!",
Self::CrtMul(_) => "^*",
Self::CrtTld(_) => "^~",
Self::UbsBng(_) => "_!",
Self::UbsMul(_) => "_*",
Self::UbsTld(_) => "_~",
}
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub enum DebugKeyword {
Step(Token![step]),
Finish(Token![finish]),
Shield(Token![shield]),
Test(Token![TEST]),
Time(Token![time]),
Timing(Token![timing]),
Breakpoint(Token![breakpoint]),
ElapsedTime(Token![elapsedTime]),
ElapsedTiming(Token![elapsedTiming]),
Profile(Token![profile]),
}
impl ::m2_syn::ToTokens for DebugKeyword {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
match self {
Self::Step(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Finish(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Shield(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Test(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Time(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Timing(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Breakpoint(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::ElapsedTime(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::ElapsedTiming(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Profile(node) => ::m2_syn::ToTokens::to_tokens(node, output),
}
}
}
impl ::m2_syn::PrettyTree for DebugKeyword {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
match self {
Self::Step(value) => ::m2_syn::PrettyNode::variant(
stringify!(DebugKeyword),
stringify!(Step),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Finish(value) => ::m2_syn::PrettyNode::variant(
stringify!(DebugKeyword),
stringify!(Finish),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Shield(value) => ::m2_syn::PrettyNode::variant(
stringify!(DebugKeyword),
stringify!(Shield),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Test(value) => ::m2_syn::PrettyNode::variant(
stringify!(DebugKeyword),
stringify!(Test),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Time(value) => ::m2_syn::PrettyNode::variant(
stringify!(DebugKeyword),
stringify!(Time),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Timing(value) => ::m2_syn::PrettyNode::variant(
stringify!(DebugKeyword),
stringify!(Timing),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Breakpoint(value) => ::m2_syn::PrettyNode::variant(
stringify!(DebugKeyword),
stringify!(Breakpoint),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::ElapsedTime(value) => ::m2_syn::PrettyNode::variant(
stringify!(DebugKeyword),
stringify!(ElapsedTime),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::ElapsedTiming(value) => ::m2_syn::PrettyNode::variant(
stringify!(DebugKeyword),
stringify!(ElapsedTiming),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Profile(value) => ::m2_syn::PrettyNode::variant(
stringify!(DebugKeyword),
stringify!(Profile),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
}
}
}
impl<N> ::m2_syn::Reconstruct<N> for DebugKeyword
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
<Token![step] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![finish] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![shield] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![TEST] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![time] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![timing] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![breakpoint] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![elapsedTime] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![elapsedTiming] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![profile] as ::m2_syn::Reconstruct<N>>::matches(node)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if <Token![step] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Step(
<Token![step] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![finish] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Finish(<Token![finish] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![shield] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Shield(<Token![shield] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![TEST] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Test(
<Token![TEST] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![time] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Time(
<Token![time] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![timing] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Timing(<Token![timing] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![breakpoint] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Breakpoint(
<Token![breakpoint] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![elapsedTime] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::ElapsedTime(
<Token![elapsedTime] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![elapsedTiming] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::ElapsedTiming(
<Token![elapsedTiming] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![profile] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Profile(<Token![profile] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
Err(::m2_syn::ReconstructError::wrong_category(
stringify!(DebugKeyword),
node.identity(),
))
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub enum TryFallback {
ExceptClause(ExceptClause),
ElseClause(ElseClause),
}
impl ::m2_syn::ToTokens for TryFallback {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
match self {
Self::ExceptClause(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::ElseClause(node) => ::m2_syn::ToTokens::to_tokens(node, output),
}
}
}
impl ::m2_syn::PrettyTree for TryFallback {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
match self {
Self::ExceptClause(value) => ::m2_syn::PrettyNode::variant(
stringify!(TryFallback),
stringify!(ExceptClause),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::ElseClause(value) => ::m2_syn::PrettyNode::variant(
stringify!(TryFallback),
stringify!(ElseClause),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
}
}
}
impl<N> ::m2_syn::Reconstruct<N> for TryFallback
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
<ExceptClause as ::m2_syn::Reconstruct<N>>::matches(node)
|| <ElseClause as ::m2_syn::Reconstruct<N>>::matches(node)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if <ExceptClause as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::ExceptClause(
<ExceptClause as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <ElseClause as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::ElseClause(<ElseClause as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
Err(::m2_syn::ReconstructError::wrong_category(
stringify!(TryFallback),
node.identity(),
))
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub enum QuoteSpecifier {
Symbol(Token![symbol]),
Local(Token![local]),
Global(Token![global]),
ThreadVariable(Token![threadVariable]),
ThreadLocal(Token![threadLocal]),
}
impl ::m2_syn::ToTokens for QuoteSpecifier {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
match self {
Self::Symbol(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Local(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Global(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::ThreadVariable(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::ThreadLocal(node) => ::m2_syn::ToTokens::to_tokens(node, output),
}
}
}
impl ::m2_syn::PrettyTree for QuoteSpecifier {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
match self {
Self::Symbol(value) => ::m2_syn::PrettyNode::variant(
stringify!(QuoteSpecifier),
stringify!(Symbol),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Local(value) => ::m2_syn::PrettyNode::variant(
stringify!(QuoteSpecifier),
stringify!(Local),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Global(value) => ::m2_syn::PrettyNode::variant(
stringify!(QuoteSpecifier),
stringify!(Global),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::ThreadVariable(value) => ::m2_syn::PrettyNode::variant(
stringify!(QuoteSpecifier),
stringify!(ThreadVariable),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::ThreadLocal(value) => ::m2_syn::PrettyNode::variant(
stringify!(QuoteSpecifier),
stringify!(ThreadLocal),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
}
}
}
impl<N> ::m2_syn::Reconstruct<N> for QuoteSpecifier
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
<Token![symbol] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![local] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![global] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![threadVariable] as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Token![threadLocal] as ::m2_syn::Reconstruct<N>>::matches(node)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if <Token![symbol] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Symbol(<Token![symbol] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![local] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Local(
<Token![local] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![global] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Global(<Token![global] as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <Token![threadVariable] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::ThreadVariable(
<Token![threadVariable] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Token![threadLocal] as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::ThreadLocal(
<Token![threadLocal] as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
Err(::m2_syn::ReconstructError::wrong_category(
stringify!(QuoteSpecifier),
node.identity(),
))
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub enum AnyCell {
ExpressionCell(ExpressionCell),
SequenceCell(SequenceCell),
MutedCell(MutedCell),
}
impl ::m2_syn::ToTokens for AnyCell {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
match self {
Self::ExpressionCell(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::SequenceCell(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::MutedCell(node) => ::m2_syn::ToTokens::to_tokens(node, output),
}
}
}
impl ::m2_syn::PrettyTree for AnyCell {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
match self {
Self::ExpressionCell(value) => ::m2_syn::PrettyNode::variant(
stringify!(AnyCell),
stringify!(ExpressionCell),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::SequenceCell(value) => ::m2_syn::PrettyNode::variant(
stringify!(AnyCell),
stringify!(SequenceCell),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::MutedCell(value) => ::m2_syn::PrettyNode::variant(
stringify!(AnyCell),
stringify!(MutedCell),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
}
}
}
impl<N> ::m2_syn::Reconstruct<N> for AnyCell
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
<ExpressionCell as ::m2_syn::Reconstruct<N>>::matches(node)
|| <SequenceCell as ::m2_syn::Reconstruct<N>>::matches(node)
|| <MutedCell as ::m2_syn::Reconstruct<N>>::matches(node)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if <ExpressionCell as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::ExpressionCell(
<ExpressionCell as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <SequenceCell as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::SequenceCell(
<SequenceCell as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <MutedCell as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::MutedCell(
<MutedCell as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
Err(::m2_syn::ReconstructError::wrong_category(
stringify!(AnyCell),
node.identity(),
))
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub enum Component {
EmptyComponent(EmptyComponent),
Expr(Expr),
}
impl ::m2_syn::ToTokens for Component {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
match self {
Self::EmptyComponent(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Expr(node) => ::m2_syn::ToTokens::to_tokens(node, output),
}
}
}
impl ::m2_syn::PrettyTree for Component {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
match self {
Self::EmptyComponent(value) => ::m2_syn::PrettyNode::variant(
stringify!(Component),
stringify!(EmptyComponent),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Expr(value) => ::m2_syn::PrettyNode::variant(
stringify!(Component),
stringify!(Expr),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
}
}
}
impl<N> ::m2_syn::Reconstruct<N> for Component
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
<EmptyComponent as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Expr as ::m2_syn::Reconstruct<N>>::matches(node)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if <EmptyComponent as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::EmptyComponent(
<EmptyComponent as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Expr as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Expr(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
node,
)?));
}
Err(::m2_syn::ReconstructError::wrong_category(
stringify!(Component),
node.identity(),
))
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub enum SequenceElement {
Component(Component),
MutedGroup(MutedGroup),
}
impl ::m2_syn::ToTokens for SequenceElement {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
match self {
Self::Component(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::MutedGroup(node) => ::m2_syn::ToTokens::to_tokens(node, output),
}
}
}
impl ::m2_syn::PrettyTree for SequenceElement {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
match self {
Self::Component(value) => ::m2_syn::PrettyNode::variant(
stringify!(SequenceElement),
stringify!(Component),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::MutedGroup(value) => ::m2_syn::PrettyNode::variant(
stringify!(SequenceElement),
stringify!(MutedGroup),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
}
}
}
impl<N> ::m2_syn::Reconstruct<N> for SequenceElement
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
<Component as ::m2_syn::Reconstruct<N>>::matches(node)
|| <MutedGroup as ::m2_syn::Reconstruct<N>>::matches(node)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if <Component as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Component(
<Component as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <MutedGroup as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::MutedGroup(<MutedGroup as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
Err(::m2_syn::ReconstructError::wrong_category(
stringify!(SequenceElement),
node.identity(),
))
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub enum StringElement {
EscapeSequence(EscapeSequence),
StringContent(StringContent),
}
impl ::m2_syn::ToTokens for StringElement {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
match self {
Self::EscapeSequence(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::StringContent(node) => ::m2_syn::ToTokens::to_tokens(node, output),
}
}
}
impl ::m2_syn::PrettyTree for StringElement {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
match self {
Self::EscapeSequence(value) => ::m2_syn::PrettyNode::variant(
stringify!(StringElement),
stringify!(EscapeSequence),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::StringContent(value) => ::m2_syn::PrettyNode::variant(
stringify!(StringElement),
stringify!(StringContent),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
}
}
}
impl<N> ::m2_syn::Reconstruct<N> for StringElement
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
<EscapeSequence as ::m2_syn::Reconstruct<N>>::matches(node)
|| <StringContent as ::m2_syn::Reconstruct<N>>::matches(node)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if <EscapeSequence as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::EscapeSequence(
<EscapeSequence as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <StringContent as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::StringContent(
<StringContent as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
Err(::m2_syn::ReconstructError::wrong_category(
stringify!(StringElement),
node.identity(),
))
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub enum RawStringElement {
EscapeSequence(EscapeSequence),
RawStringContent(RawStringContent),
}
impl ::m2_syn::ToTokens for RawStringElement {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
match self {
Self::EscapeSequence(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::RawStringContent(node) => ::m2_syn::ToTokens::to_tokens(node, output),
}
}
}
impl ::m2_syn::PrettyTree for RawStringElement {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
match self {
Self::EscapeSequence(value) => ::m2_syn::PrettyNode::variant(
stringify!(RawStringElement),
stringify!(EscapeSequence),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::RawStringContent(value) => ::m2_syn::PrettyNode::variant(
stringify!(RawStringElement),
stringify!(RawStringContent),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
}
}
}
impl<N> ::m2_syn::Reconstruct<N> for RawStringElement
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
<EscapeSequence as ::m2_syn::Reconstruct<N>>::matches(node)
|| <RawStringContent as ::m2_syn::Reconstruct<N>>::matches(node)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if <EscapeSequence as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::EscapeSequence(
<EscapeSequence as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <RawStringContent as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::RawStringContent(
<RawStringContent as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
Err(::m2_syn::ReconstructError::wrong_category(
stringify!(RawStringElement),
node.identity(),
))
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub enum Collection {
ParenthesizedExpression(ParenthesizedExpression),
Sequence(Sequence),
List(List),
Array(Array),
AngleBarList(AngleBarList),
}
impl ::m2_syn::ToTokens for Collection {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
match self {
Self::ParenthesizedExpression(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Sequence(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::List(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Array(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::AngleBarList(node) => ::m2_syn::ToTokens::to_tokens(node, output),
}
}
}
impl ::m2_syn::PrettyTree for Collection {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
match self {
Self::ParenthesizedExpression(value) => ::m2_syn::PrettyNode::variant(
stringify!(Collection),
stringify!(ParenthesizedExpression),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Sequence(value) => ::m2_syn::PrettyNode::variant(
stringify!(Collection),
stringify!(Sequence),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::List(value) => ::m2_syn::PrettyNode::variant(
stringify!(Collection),
stringify!(List),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Array(value) => ::m2_syn::PrettyNode::variant(
stringify!(Collection),
stringify!(Array),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::AngleBarList(value) => ::m2_syn::PrettyNode::variant(
stringify!(Collection),
stringify!(AngleBarList),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
}
}
}
impl<N> ::m2_syn::Reconstruct<N> for Collection
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
<ParenthesizedExpression as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Sequence as ::m2_syn::Reconstruct<N>>::matches(node)
|| <List as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Array as ::m2_syn::Reconstruct<N>>::matches(node)
|| <AngleBarList as ::m2_syn::Reconstruct<N>>::matches(node)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if <ParenthesizedExpression as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::ParenthesizedExpression(
<ParenthesizedExpression as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Sequence as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Sequence(
<Sequence as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <List as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::List(<List as ::m2_syn::Reconstruct<N>>::reconstruct(
node,
)?));
}
if <Array as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Array(
<Array as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <AngleBarList as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::AngleBarList(
<AngleBarList as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
Err(::m2_syn::ReconstructError::wrong_category(
stringify!(Collection),
node.identity(),
))
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub enum BindingPack {
ParenthesizedExpression(ParenthesizedExpression),
Sequence(Sequence),
List(List),
Array(Array),
AngleBarList(AngleBarList),
}
impl ::m2_syn::ToTokens for BindingPack {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
match self {
Self::ParenthesizedExpression(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Sequence(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::List(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Array(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::AngleBarList(node) => ::m2_syn::ToTokens::to_tokens(node, output),
}
}
}
impl ::m2_syn::PrettyTree for BindingPack {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
match self {
Self::ParenthesizedExpression(value) => ::m2_syn::PrettyNode::variant(
stringify!(BindingPack),
stringify!(ParenthesizedExpression),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Sequence(value) => ::m2_syn::PrettyNode::variant(
stringify!(BindingPack),
stringify!(Sequence),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::List(value) => ::m2_syn::PrettyNode::variant(
stringify!(BindingPack),
stringify!(List),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Array(value) => ::m2_syn::PrettyNode::variant(
stringify!(BindingPack),
stringify!(Array),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::AngleBarList(value) => ::m2_syn::PrettyNode::variant(
stringify!(BindingPack),
stringify!(AngleBarList),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
}
}
}
impl<N> ::m2_syn::Reconstruct<N> for BindingPack
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
<ParenthesizedExpression as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Sequence as ::m2_syn::Reconstruct<N>>::matches(node)
|| <List as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Array as ::m2_syn::Reconstruct<N>>::matches(node)
|| <AngleBarList as ::m2_syn::Reconstruct<N>>::matches(node)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if <ParenthesizedExpression as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::ParenthesizedExpression(
<ParenthesizedExpression as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Sequence as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Sequence(
<Sequence as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <List as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::List(<List as ::m2_syn::Reconstruct<N>>::reconstruct(
node,
)?));
}
if <Array as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Array(
<Array as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <AngleBarList as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::AngleBarList(
<AngleBarList as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
Err(::m2_syn::ReconstructError::wrong_category(
stringify!(BindingPack),
node.identity(),
))
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub enum LambdaParameters {
Symbol(Symbol),
ParenthesizedExpression(ParenthesizedExpression),
Sequence(Sequence),
List(List),
Array(Array),
AngleBarList(AngleBarList),
}
impl ::m2_syn::ToTokens for LambdaParameters {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
match self {
Self::Symbol(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::ParenthesizedExpression(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Sequence(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::List(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Array(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::AngleBarList(node) => ::m2_syn::ToTokens::to_tokens(node, output),
}
}
}
impl ::m2_syn::PrettyTree for LambdaParameters {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
match self {
Self::Symbol(value) => ::m2_syn::PrettyNode::variant(
stringify!(LambdaParameters),
stringify!(Symbol),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::ParenthesizedExpression(value) => ::m2_syn::PrettyNode::variant(
stringify!(LambdaParameters),
stringify!(ParenthesizedExpression),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Sequence(value) => ::m2_syn::PrettyNode::variant(
stringify!(LambdaParameters),
stringify!(Sequence),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::List(value) => ::m2_syn::PrettyNode::variant(
stringify!(LambdaParameters),
stringify!(List),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Array(value) => ::m2_syn::PrettyNode::variant(
stringify!(LambdaParameters),
stringify!(Array),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::AngleBarList(value) => ::m2_syn::PrettyNode::variant(
stringify!(LambdaParameters),
stringify!(AngleBarList),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
}
}
}
impl<N> ::m2_syn::Reconstruct<N> for LambdaParameters
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
<Symbol as ::m2_syn::Reconstruct<N>>::matches(node)
|| <ParenthesizedExpression as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Sequence as ::m2_syn::Reconstruct<N>>::matches(node)
|| <List as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Array as ::m2_syn::Reconstruct<N>>::matches(node)
|| <AngleBarList as ::m2_syn::Reconstruct<N>>::matches(node)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if <Symbol as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Symbol(
<Symbol as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <ParenthesizedExpression as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::ParenthesizedExpression(
<ParenthesizedExpression as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Sequence as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Sequence(
<Sequence as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <List as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::List(<List as ::m2_syn::Reconstruct<N>>::reconstruct(
node,
)?));
}
if <Array as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Array(
<Array as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <AngleBarList as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::AngleBarList(
<AngleBarList as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
Err(::m2_syn::ReconstructError::wrong_category(
stringify!(LambdaParameters),
node.identity(),
))
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub enum OperatorExpr {
AdjacentExpression(AdjacentExpression),
BinaryExpression(BinaryExpression),
PrefixExpression(PrefixExpression),
PostfixExpression(PostfixExpression),
}
impl ::m2_syn::ToTokens for OperatorExpr {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
match self {
Self::AdjacentExpression(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::BinaryExpression(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::PrefixExpression(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::PostfixExpression(node) => ::m2_syn::ToTokens::to_tokens(node, output),
}
}
}
impl ::m2_syn::PrettyTree for OperatorExpr {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
match self {
Self::AdjacentExpression(value) => ::m2_syn::PrettyNode::variant(
stringify!(OperatorExpr),
stringify!(AdjacentExpression),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::BinaryExpression(value) => ::m2_syn::PrettyNode::variant(
stringify!(OperatorExpr),
stringify!(BinaryExpression),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::PrefixExpression(value) => ::m2_syn::PrettyNode::variant(
stringify!(OperatorExpr),
stringify!(PrefixExpression),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::PostfixExpression(value) => ::m2_syn::PrettyNode::variant(
stringify!(OperatorExpr),
stringify!(PostfixExpression),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
}
}
}
impl<N> ::m2_syn::Reconstruct<N> for OperatorExpr
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
<AdjacentExpression as ::m2_syn::Reconstruct<N>>::matches(node)
|| <BinaryExpression as ::m2_syn::Reconstruct<N>>::matches(node)
|| <PrefixExpression as ::m2_syn::Reconstruct<N>>::matches(node)
|| <PostfixExpression as ::m2_syn::Reconstruct<N>>::matches(node)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if <AdjacentExpression as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::AdjacentExpression(
<AdjacentExpression as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <BinaryExpression as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::BinaryExpression(
<BinaryExpression as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <PrefixExpression as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::PrefixExpression(
<PrefixExpression as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <PostfixExpression as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::PostfixExpression(
<PostfixExpression as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
Err(::m2_syn::ReconstructError::wrong_category(
stringify!(OperatorExpr),
node.identity(),
))
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub enum AssignmentExpr {
Assignment(Assignment),
LocalAssignment(LocalAssignment),
BinaryAssignment(BinaryAssignment),
BinaryInstallation(BinaryInstallation),
PrefixAssignment(PrefixAssignment),
PrefixInstallation(PrefixInstallation),
PostfixAssignment(PostfixAssignment),
PostfixInstallation(PostfixInstallation),
StructuredBinding(StructuredBinding),
LocalStructuredBinding(LocalStructuredBinding),
EvaluatedAssignment(EvaluatedAssignment),
}
impl ::m2_syn::ToTokens for AssignmentExpr {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
match self {
Self::Assignment(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::LocalAssignment(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::BinaryAssignment(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::BinaryInstallation(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::PrefixAssignment(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::PrefixInstallation(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::PostfixAssignment(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::PostfixInstallation(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::StructuredBinding(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::LocalStructuredBinding(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::EvaluatedAssignment(node) => ::m2_syn::ToTokens::to_tokens(node, output),
}
}
}
impl ::m2_syn::PrettyTree for AssignmentExpr {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
match self {
Self::Assignment(value) => ::m2_syn::PrettyNode::variant(
stringify!(AssignmentExpr),
stringify!(Assignment),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::LocalAssignment(value) => ::m2_syn::PrettyNode::variant(
stringify!(AssignmentExpr),
stringify!(LocalAssignment),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::BinaryAssignment(value) => ::m2_syn::PrettyNode::variant(
stringify!(AssignmentExpr),
stringify!(BinaryAssignment),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::BinaryInstallation(value) => ::m2_syn::PrettyNode::variant(
stringify!(AssignmentExpr),
stringify!(BinaryInstallation),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::PrefixAssignment(value) => ::m2_syn::PrettyNode::variant(
stringify!(AssignmentExpr),
stringify!(PrefixAssignment),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::PrefixInstallation(value) => ::m2_syn::PrettyNode::variant(
stringify!(AssignmentExpr),
stringify!(PrefixInstallation),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::PostfixAssignment(value) => ::m2_syn::PrettyNode::variant(
stringify!(AssignmentExpr),
stringify!(PostfixAssignment),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::PostfixInstallation(value) => ::m2_syn::PrettyNode::variant(
stringify!(AssignmentExpr),
stringify!(PostfixInstallation),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::StructuredBinding(value) => ::m2_syn::PrettyNode::variant(
stringify!(AssignmentExpr),
stringify!(StructuredBinding),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::LocalStructuredBinding(value) => ::m2_syn::PrettyNode::variant(
stringify!(AssignmentExpr),
stringify!(LocalStructuredBinding),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::EvaluatedAssignment(value) => ::m2_syn::PrettyNode::variant(
stringify!(AssignmentExpr),
stringify!(EvaluatedAssignment),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
}
}
}
impl<N> ::m2_syn::Reconstruct<N> for AssignmentExpr
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
<Assignment as ::m2_syn::Reconstruct<N>>::matches(node)
|| <LocalAssignment as ::m2_syn::Reconstruct<N>>::matches(node)
|| <BinaryAssignment as ::m2_syn::Reconstruct<N>>::matches(node)
|| <BinaryInstallation as ::m2_syn::Reconstruct<N>>::matches(node)
|| <PrefixAssignment as ::m2_syn::Reconstruct<N>>::matches(node)
|| <PrefixInstallation as ::m2_syn::Reconstruct<N>>::matches(node)
|| <PostfixAssignment as ::m2_syn::Reconstruct<N>>::matches(node)
|| <PostfixInstallation as ::m2_syn::Reconstruct<N>>::matches(node)
|| <StructuredBinding as ::m2_syn::Reconstruct<N>>::matches(node)
|| <LocalStructuredBinding as ::m2_syn::Reconstruct<N>>::matches(node)
|| <EvaluatedAssignment as ::m2_syn::Reconstruct<N>>::matches(node)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if <Assignment as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Assignment(<Assignment as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <LocalAssignment as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::LocalAssignment(
<LocalAssignment as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <BinaryAssignment as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::BinaryAssignment(
<BinaryAssignment as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <BinaryInstallation as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::BinaryInstallation(
<BinaryInstallation as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <PrefixAssignment as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::PrefixAssignment(
<PrefixAssignment as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <PrefixInstallation as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::PrefixInstallation(
<PrefixInstallation as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <PostfixAssignment as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::PostfixAssignment(
<PostfixAssignment as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <PostfixInstallation as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::PostfixInstallation(
<PostfixInstallation as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <StructuredBinding as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::StructuredBinding(
<StructuredBinding as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <LocalStructuredBinding as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::LocalStructuredBinding(
<LocalStructuredBinding as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <EvaluatedAssignment as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::EvaluatedAssignment(
<EvaluatedAssignment as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
Err(::m2_syn::ReconstructError::wrong_category(
stringify!(AssignmentExpr),
node.identity(),
))
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub enum Expr {
Collection(Collection),
OperatorExpr(OperatorExpr),
AssignmentExpr(AssignmentExpr),
OptionExpression(OptionExpression),
LambdaExpression(LambdaExpression),
IfStatement(IfStatement),
ForLoop(ForLoop),
WhileLoop(WhileLoop),
TryStatement(TryStatement),
QuoteExpression(QuoteExpression),
NewStatement(NewStatement),
BreakStatement(BreakStatement),
ContinueStatement(ContinueStatement),
ReturnStatement(ReturnStatement),
CatchStatement(CatchStatement),
ThrowStatement(ThrowStatement),
TrapStatement(TrapStatement),
DebugClause(DebugClause),
FloatLiteral(FloatLiteral),
IntegerLiteral(IntegerLiteral),
RawStringLiteral(RawStringLiteral),
StringLiteral(StringLiteral),
Symbol(Symbol),
}
impl ::m2_syn::ToTokens for Expr {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
match self {
Self::Collection(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::OperatorExpr(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::AssignmentExpr(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::OptionExpression(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::LambdaExpression(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::IfStatement(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::ForLoop(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::WhileLoop(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::TryStatement(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::QuoteExpression(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::NewStatement(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::BreakStatement(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::ContinueStatement(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::ReturnStatement(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::CatchStatement(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::ThrowStatement(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::TrapStatement(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::DebugClause(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::FloatLiteral(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::IntegerLiteral(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::RawStringLiteral(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::StringLiteral(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Symbol(node) => ::m2_syn::ToTokens::to_tokens(node, output),
}
}
}
impl ::m2_syn::PrettyTree for Expr {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
match self {
Self::Collection(value) => ::m2_syn::PrettyNode::variant(
stringify!(Expr),
stringify!(Collection),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::OperatorExpr(value) => ::m2_syn::PrettyNode::variant(
stringify!(Expr),
stringify!(OperatorExpr),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::AssignmentExpr(value) => ::m2_syn::PrettyNode::variant(
stringify!(Expr),
stringify!(AssignmentExpr),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::OptionExpression(value) => ::m2_syn::PrettyNode::variant(
stringify!(Expr),
stringify!(OptionExpression),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::LambdaExpression(value) => ::m2_syn::PrettyNode::variant(
stringify!(Expr),
stringify!(LambdaExpression),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::IfStatement(value) => ::m2_syn::PrettyNode::variant(
stringify!(Expr),
stringify!(IfStatement),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::ForLoop(value) => ::m2_syn::PrettyNode::variant(
stringify!(Expr),
stringify!(ForLoop),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::WhileLoop(value) => ::m2_syn::PrettyNode::variant(
stringify!(Expr),
stringify!(WhileLoop),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::TryStatement(value) => ::m2_syn::PrettyNode::variant(
stringify!(Expr),
stringify!(TryStatement),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::QuoteExpression(value) => ::m2_syn::PrettyNode::variant(
stringify!(Expr),
stringify!(QuoteExpression),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::NewStatement(value) => ::m2_syn::PrettyNode::variant(
stringify!(Expr),
stringify!(NewStatement),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::BreakStatement(value) => ::m2_syn::PrettyNode::variant(
stringify!(Expr),
stringify!(BreakStatement),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::ContinueStatement(value) => ::m2_syn::PrettyNode::variant(
stringify!(Expr),
stringify!(ContinueStatement),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::ReturnStatement(value) => ::m2_syn::PrettyNode::variant(
stringify!(Expr),
stringify!(ReturnStatement),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::CatchStatement(value) => ::m2_syn::PrettyNode::variant(
stringify!(Expr),
stringify!(CatchStatement),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::ThrowStatement(value) => ::m2_syn::PrettyNode::variant(
stringify!(Expr),
stringify!(ThrowStatement),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::TrapStatement(value) => ::m2_syn::PrettyNode::variant(
stringify!(Expr),
stringify!(TrapStatement),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::DebugClause(value) => ::m2_syn::PrettyNode::variant(
stringify!(Expr),
stringify!(DebugClause),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::FloatLiteral(value) => ::m2_syn::PrettyNode::variant(
stringify!(Expr),
stringify!(FloatLiteral),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::IntegerLiteral(value) => ::m2_syn::PrettyNode::variant(
stringify!(Expr),
stringify!(IntegerLiteral),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::RawStringLiteral(value) => ::m2_syn::PrettyNode::variant(
stringify!(Expr),
stringify!(RawStringLiteral),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::StringLiteral(value) => ::m2_syn::PrettyNode::variant(
stringify!(Expr),
stringify!(StringLiteral),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Symbol(value) => ::m2_syn::PrettyNode::variant(
stringify!(Expr),
stringify!(Symbol),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
}
}
}
impl<N> ::m2_syn::Reconstruct<N> for Expr
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
<Collection as ::m2_syn::Reconstruct<N>>::matches(node)
|| <OperatorExpr as ::m2_syn::Reconstruct<N>>::matches(node)
|| <AssignmentExpr as ::m2_syn::Reconstruct<N>>::matches(node)
|| <OptionExpression as ::m2_syn::Reconstruct<N>>::matches(node)
|| <LambdaExpression as ::m2_syn::Reconstruct<N>>::matches(node)
|| <IfStatement as ::m2_syn::Reconstruct<N>>::matches(node)
|| <ForLoop as ::m2_syn::Reconstruct<N>>::matches(node)
|| <WhileLoop as ::m2_syn::Reconstruct<N>>::matches(node)
|| <TryStatement as ::m2_syn::Reconstruct<N>>::matches(node)
|| <QuoteExpression as ::m2_syn::Reconstruct<N>>::matches(node)
|| <NewStatement as ::m2_syn::Reconstruct<N>>::matches(node)
|| <BreakStatement as ::m2_syn::Reconstruct<N>>::matches(node)
|| <ContinueStatement as ::m2_syn::Reconstruct<N>>::matches(node)
|| <ReturnStatement as ::m2_syn::Reconstruct<N>>::matches(node)
|| <CatchStatement as ::m2_syn::Reconstruct<N>>::matches(node)
|| <ThrowStatement as ::m2_syn::Reconstruct<N>>::matches(node)
|| <TrapStatement as ::m2_syn::Reconstruct<N>>::matches(node)
|| <DebugClause as ::m2_syn::Reconstruct<N>>::matches(node)
|| <FloatLiteral as ::m2_syn::Reconstruct<N>>::matches(node)
|| <IntegerLiteral as ::m2_syn::Reconstruct<N>>::matches(node)
|| <RawStringLiteral as ::m2_syn::Reconstruct<N>>::matches(node)
|| <StringLiteral as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Symbol as ::m2_syn::Reconstruct<N>>::matches(node)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if <Collection as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Collection(<Collection as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <OperatorExpr as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::OperatorExpr(
<OperatorExpr as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <AssignmentExpr as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::AssignmentExpr(
<AssignmentExpr as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <OptionExpression as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::OptionExpression(
<OptionExpression as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <LambdaExpression as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::LambdaExpression(
<LambdaExpression as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <IfStatement as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::IfStatement(<IfStatement as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <ForLoop as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::ForLoop(
<ForLoop as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <WhileLoop as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::WhileLoop(
<WhileLoop as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <TryStatement as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::TryStatement(
<TryStatement as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <QuoteExpression as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::QuoteExpression(
<QuoteExpression as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <NewStatement as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::NewStatement(
<NewStatement as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <BreakStatement as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::BreakStatement(
<BreakStatement as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <ContinueStatement as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::ContinueStatement(
<ContinueStatement as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <ReturnStatement as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::ReturnStatement(
<ReturnStatement as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <CatchStatement as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::CatchStatement(
<CatchStatement as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <ThrowStatement as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::ThrowStatement(
<ThrowStatement as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <TrapStatement as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::TrapStatement(
<TrapStatement as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <DebugClause as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::DebugClause(<DebugClause as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <FloatLiteral as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::FloatLiteral(
<FloatLiteral as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <IntegerLiteral as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::IntegerLiteral(
<IntegerLiteral as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <RawStringLiteral as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::RawStringLiteral(
<RawStringLiteral as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <StringLiteral as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::StringLiteral(
<StringLiteral as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Symbol as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Symbol(
<Symbol as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
Err(::m2_syn::ReconstructError::wrong_category(
stringify!(Expr),
node.identity(),
))
}
}
#[derive(Debug, ::m2_syn::Spanned)]
pub enum SyntaxNode {
SourceFile(SourceFile),
AnyCell(AnyCell),
Expr(Expr),
}
impl ::m2_syn::ToTokens for SyntaxNode {
fn to_tokens(&self, output: &mut ::m2_syn::TokenStream) {
match self {
Self::SourceFile(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::AnyCell(node) => ::m2_syn::ToTokens::to_tokens(node, output),
Self::Expr(node) => ::m2_syn::ToTokens::to_tokens(node, output),
}
}
}
impl ::m2_syn::PrettyTree for SyntaxNode {
fn pretty_tree(&self) -> ::m2_syn::PrettyNode {
match self {
Self::SourceFile(value) => ::m2_syn::PrettyNode::variant(
stringify!(SyntaxNode),
stringify!(SourceFile),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::AnyCell(value) => ::m2_syn::PrettyNode::variant(
stringify!(SyntaxNode),
stringify!(AnyCell),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
Self::Expr(value) => ::m2_syn::PrettyNode::variant(
stringify!(SyntaxNode),
stringify!(Expr),
::m2_syn::Spanned::span(self),
::m2_syn::PrettyTree::pretty_tree(value),
),
}
}
}
impl<N> ::m2_syn::Reconstruct<N> for SyntaxNode
where
N: ::m2_syn::ExternalCstNode,
{
fn matches(node: &N) -> bool {
<SourceFile as ::m2_syn::Reconstruct<N>>::matches(node)
|| <AnyCell as ::m2_syn::Reconstruct<N>>::matches(node)
|| <Expr as ::m2_syn::Reconstruct<N>>::matches(node)
}
fn reconstruct(node: N) -> Result<Self, ::m2_syn::ReconstructError> {
if <SourceFile as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::SourceFile(<SourceFile as ::m2_syn::Reconstruct<
N,
>>::reconstruct(node)?));
}
if <AnyCell as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::AnyCell(
<AnyCell as ::m2_syn::Reconstruct<N>>::reconstruct(node)?,
));
}
if <Expr as ::m2_syn::Reconstruct<N>>::matches(&node) {
return Ok(Self::Expr(<Expr as ::m2_syn::Reconstruct<N>>::reconstruct(
node,
)?));
}
Err(::m2_syn::ReconstructError::wrong_category(
stringify!(SyntaxNode),
node.identity(),
))
}
}
impl From<Token![+]> for BinaryOperator {
fn from(value: Token![+]) -> Self {
BinaryOperator::Add(value)
}
}
impl From<Token![+]> for PrefixOperator {
fn from(value: Token![+]) -> Self {
PrefixOperator::Add(value)
}
}
impl From<Token![++]> for BinaryOperator {
fn from(value: Token![++]) -> Self {
BinaryOperator::AddAdd(value)
}
}
impl From<Token![++=]> for BinaryOperator {
fn from(value: Token![++=]) -> Self {
BinaryOperator::AddAddEql(value)
}
}
impl From<Token![+=]> for BinaryOperator {
fn from(value: Token![+=]) -> Self {
BinaryOperator::AddEql(value)
}
}
impl From<AdjacentExpression> for Component {
fn from(value: AdjacentExpression) -> Self {
Component::Expr(Expr::OperatorExpr(OperatorExpr::AdjacentExpression(value)))
}
}
impl From<AdjacentExpression> for Expr {
fn from(value: AdjacentExpression) -> Self {
Expr::OperatorExpr(OperatorExpr::AdjacentExpression(value))
}
}
impl From<AdjacentExpression> for OperatorExpr {
fn from(value: AdjacentExpression) -> Self {
OperatorExpr::AdjacentExpression(value)
}
}
impl From<AdjacentExpression> for SequenceElement {
fn from(value: AdjacentExpression) -> Self {
SequenceElement::Component(Component::Expr(Expr::OperatorExpr(
OperatorExpr::AdjacentExpression(value),
)))
}
}
impl From<AdjacentExpression> for SyntaxNode {
fn from(value: AdjacentExpression) -> Self {
SyntaxNode::Expr(Expr::OperatorExpr(OperatorExpr::AdjacentExpression(value)))
}
}
impl From<Token![&]> for BinaryOperator {
fn from(value: Token![&]) -> Self {
BinaryOperator::Amp(value)
}
}
impl From<Token![&=]> for BinaryOperator {
fn from(value: Token![&=]) -> Self {
BinaryOperator::AmpEql(value)
}
}
impl From<Token![and]> for BinaryOperator {
fn from(value: Token![and]) -> Self {
BinaryOperator::And(value)
}
}
impl From<AngleBarList> for BindingPack {
fn from(value: AngleBarList) -> Self {
BindingPack::AngleBarList(value)
}
}
impl From<AngleBarList> for Collection {
fn from(value: AngleBarList) -> Self {
Collection::AngleBarList(value)
}
}
impl From<AngleBarList> for Component {
fn from(value: AngleBarList) -> Self {
Component::Expr(Expr::Collection(Collection::AngleBarList(value)))
}
}
impl From<AngleBarList> for Expr {
fn from(value: AngleBarList) -> Self {
Expr::Collection(Collection::AngleBarList(value))
}
}
impl From<AngleBarList> for LambdaParameters {
fn from(value: AngleBarList) -> Self {
LambdaParameters::AngleBarList(value)
}
}
impl From<AngleBarList> for SequenceElement {
fn from(value: AngleBarList) -> Self {
SequenceElement::Component(Component::Expr(Expr::Collection(Collection::AngleBarList(
value,
))))
}
}
impl From<AngleBarList> for SyntaxNode {
fn from(value: AngleBarList) -> Self {
SyntaxNode::Expr(Expr::Collection(Collection::AngleBarList(value)))
}
}
impl From<AnyCell> for SyntaxNode {
fn from(value: AnyCell) -> Self {
SyntaxNode::AnyCell(value)
}
}
impl From<Array> for BindingPack {
fn from(value: Array) -> Self {
BindingPack::Array(value)
}
}
impl From<Array> for Collection {
fn from(value: Array) -> Self {
Collection::Array(value)
}
}
impl From<Array> for Component {
fn from(value: Array) -> Self {
Component::Expr(Expr::Collection(Collection::Array(value)))
}
}
impl From<Array> for Expr {
fn from(value: Array) -> Self {
Expr::Collection(Collection::Array(value))
}
}
impl From<Array> for LambdaParameters {
fn from(value: Array) -> Self {
LambdaParameters::Array(value)
}
}
impl From<Array> for SequenceElement {
fn from(value: Array) -> Self {
SequenceElement::Component(Component::Expr(Expr::Collection(Collection::Array(value))))
}
}
impl From<Array> for SyntaxNode {
fn from(value: Array) -> Self {
SyntaxNode::Expr(Expr::Collection(Collection::Array(value)))
}
}
impl From<Assignment> for AssignmentExpr {
fn from(value: Assignment) -> Self {
AssignmentExpr::Assignment(value)
}
}
impl From<Assignment> for Component {
fn from(value: Assignment) -> Self {
Component::Expr(Expr::AssignmentExpr(AssignmentExpr::Assignment(value)))
}
}
impl From<Assignment> for Expr {
fn from(value: Assignment) -> Self {
Expr::AssignmentExpr(AssignmentExpr::Assignment(value))
}
}
impl From<Assignment> for SequenceElement {
fn from(value: Assignment) -> Self {
SequenceElement::Component(Component::Expr(Expr::AssignmentExpr(
AssignmentExpr::Assignment(value),
)))
}
}
impl From<Assignment> for SyntaxNode {
fn from(value: Assignment) -> Self {
SyntaxNode::Expr(Expr::AssignmentExpr(AssignmentExpr::Assignment(value)))
}
}
impl From<AssignmentExpr> for Component {
fn from(value: AssignmentExpr) -> Self {
Component::Expr(Expr::AssignmentExpr(value))
}
}
impl From<AssignmentExpr> for Expr {
fn from(value: AssignmentExpr) -> Self {
Expr::AssignmentExpr(value)
}
}
impl From<AssignmentExpr> for SequenceElement {
fn from(value: AssignmentExpr) -> Self {
SequenceElement::Component(Component::Expr(Expr::AssignmentExpr(value)))
}
}
impl From<AssignmentExpr> for SyntaxNode {
fn from(value: AssignmentExpr) -> Self {
SyntaxNode::Expr(Expr::AssignmentExpr(value))
}
}
impl From<Token![@]> for BinaryOperator {
fn from(value: Token![@]) -> Self {
BinaryOperator::Att(value)
}
}
impl From<Token![@@]> for BinaryOperator {
fn from(value: Token![@@]) -> Self {
BinaryOperator::AttAtt(value)
}
}
impl From<Token![@@=]> for BinaryOperator {
fn from(value: Token![@@=]) -> Self {
BinaryOperator::AttAttEql(value)
}
}
impl From<Token![@@?]> for BinaryOperator {
fn from(value: Token![@@?]) -> Self {
BinaryOperator::AttAttQsm(value)
}
}
impl From<Token![@@?=]> for BinaryOperator {
fn from(value: Token![@@?=]) -> Self {
BinaryOperator::AttAttQsmEql(value)
}
}
impl From<Token![@=]> for BinaryOperator {
fn from(value: Token![@=]) -> Self {
BinaryOperator::AttEql(value)
}
}
impl From<BinaryAssignment> for AssignmentExpr {
fn from(value: BinaryAssignment) -> Self {
AssignmentExpr::BinaryAssignment(value)
}
}
impl From<BinaryAssignment> for Component {
fn from(value: BinaryAssignment) -> Self {
Component::Expr(Expr::AssignmentExpr(AssignmentExpr::BinaryAssignment(
value,
)))
}
}
impl From<BinaryAssignment> for Expr {
fn from(value: BinaryAssignment) -> Self {
Expr::AssignmentExpr(AssignmentExpr::BinaryAssignment(value))
}
}
impl From<BinaryAssignment> for SequenceElement {
fn from(value: BinaryAssignment) -> Self {
SequenceElement::Component(Component::Expr(Expr::AssignmentExpr(
AssignmentExpr::BinaryAssignment(value),
)))
}
}
impl From<BinaryAssignment> for SyntaxNode {
fn from(value: BinaryAssignment) -> Self {
SyntaxNode::Expr(Expr::AssignmentExpr(AssignmentExpr::BinaryAssignment(
value,
)))
}
}
impl From<BinaryExpression> for Component {
fn from(value: BinaryExpression) -> Self {
Component::Expr(Expr::OperatorExpr(OperatorExpr::BinaryExpression(value)))
}
}
impl From<BinaryExpression> for Expr {
fn from(value: BinaryExpression) -> Self {
Expr::OperatorExpr(OperatorExpr::BinaryExpression(value))
}
}
impl From<BinaryExpression> for OperatorExpr {
fn from(value: BinaryExpression) -> Self {
OperatorExpr::BinaryExpression(value)
}
}
impl From<BinaryExpression> for SequenceElement {
fn from(value: BinaryExpression) -> Self {
SequenceElement::Component(Component::Expr(Expr::OperatorExpr(
OperatorExpr::BinaryExpression(value),
)))
}
}
impl From<BinaryExpression> for SyntaxNode {
fn from(value: BinaryExpression) -> Self {
SyntaxNode::Expr(Expr::OperatorExpr(OperatorExpr::BinaryExpression(value)))
}
}
impl From<BinaryInstallation> for AssignmentExpr {
fn from(value: BinaryInstallation) -> Self {
AssignmentExpr::BinaryInstallation(value)
}
}
impl From<BinaryInstallation> for Component {
fn from(value: BinaryInstallation) -> Self {
Component::Expr(Expr::AssignmentExpr(AssignmentExpr::BinaryInstallation(
value,
)))
}
}
impl From<BinaryInstallation> for Expr {
fn from(value: BinaryInstallation) -> Self {
Expr::AssignmentExpr(AssignmentExpr::BinaryInstallation(value))
}
}
impl From<BinaryInstallation> for SequenceElement {
fn from(value: BinaryInstallation) -> Self {
SequenceElement::Component(Component::Expr(Expr::AssignmentExpr(
AssignmentExpr::BinaryInstallation(value),
)))
}
}
impl From<BinaryInstallation> for SyntaxNode {
fn from(value: BinaryInstallation) -> Self {
SyntaxNode::Expr(Expr::AssignmentExpr(AssignmentExpr::BinaryInstallation(
value,
)))
}
}
impl From<Token![!]> for PostfixOperator {
fn from(value: Token![!]) -> Self {
PostfixOperator::Bng(value)
}
}
impl From<Token![!=]> for BinaryOperator {
fn from(value: Token![!=]) -> Self {
BinaryOperator::BngEql(value)
}
}
impl From<Token!["⊠"]> for BinaryOperator {
fn from(value: Token!["⊠"]) -> Self {
BinaryOperator::Box(value)
}
}
impl From<Token!["⊠="]> for BinaryOperator {
fn from(value: Token!["⊠="]) -> Self {
BinaryOperator::BoxEql(value)
}
}
impl From<BreakStatement> for Component {
fn from(value: BreakStatement) -> Self {
Component::Expr(Expr::BreakStatement(value))
}
}
impl From<BreakStatement> for Expr {
fn from(value: BreakStatement) -> Self {
Expr::BreakStatement(value)
}
}
impl From<BreakStatement> for SequenceElement {
fn from(value: BreakStatement) -> Self {
SequenceElement::Component(Component::Expr(Expr::BreakStatement(value)))
}
}
impl From<BreakStatement> for SyntaxNode {
fn from(value: BreakStatement) -> Self {
SyntaxNode::Expr(Expr::BreakStatement(value))
}
}
impl From<Token![breakpoint]> for DebugKeyword {
fn from(value: Token![breakpoint]) -> Self {
DebugKeyword::Breakpoint(value)
}
}
impl From<Token!["\\"]> for BinaryOperator {
fn from(value: Token!["\\"]) -> Self {
BinaryOperator::Bsl(value)
}
}
impl From<Token!["\\\\"]> for BinaryOperator {
fn from(value: Token!["\\\\"]) -> Self {
BinaryOperator::BslBsl(value)
}
}
impl From<Token!["\\\\="]> for BinaryOperator {
fn from(value: Token!["\\\\="]) -> Self {
BinaryOperator::BslBslEql(value)
}
}
impl From<Token!["\\="]> for BinaryOperator {
fn from(value: Token!["\\="]) -> Self {
BinaryOperator::BslEql(value)
}
}
impl From<CatchStatement> for Component {
fn from(value: CatchStatement) -> Self {
Component::Expr(Expr::CatchStatement(value))
}
}
impl From<CatchStatement> for Expr {
fn from(value: CatchStatement) -> Self {
Expr::CatchStatement(value)
}
}
impl From<CatchStatement> for SequenceElement {
fn from(value: CatchStatement) -> Self {
SequenceElement::Component(Component::Expr(Expr::CatchStatement(value)))
}
}
impl From<CatchStatement> for SyntaxNode {
fn from(value: CatchStatement) -> Self {
SyntaxNode::Expr(Expr::CatchStatement(value))
}
}
impl From<Token!["·"]> for BinaryOperator {
fn from(value: Token!["·"]) -> Self {
BinaryOperator::Cdt(value)
}
}
impl From<Token!["·="]> for BinaryOperator {
fn from(value: Token!["·="]) -> Self {
BinaryOperator::CdtEql(value)
}
}
impl From<Token![:]> for BinaryOperator {
fn from(value: Token![:]) -> Self {
BinaryOperator::Col(value)
}
}
impl From<Token![:=]> for BinaryOperator {
fn from(value: Token![:=]) -> Self {
BinaryOperator::ColEql(value)
}
}
impl From<Collection> for Component {
fn from(value: Collection) -> Self {
Component::Expr(Expr::Collection(value))
}
}
impl From<Collection> for Expr {
fn from(value: Collection) -> Self {
Expr::Collection(value)
}
}
impl From<Collection> for SequenceElement {
fn from(value: Collection) -> Self {
SequenceElement::Component(Component::Expr(Expr::Collection(value)))
}
}
impl From<Collection> for SyntaxNode {
fn from(value: Collection) -> Self {
SyntaxNode::Expr(Expr::Collection(value))
}
}
impl From<Component> for SequenceElement {
fn from(value: Component) -> Self {
SequenceElement::Component(value)
}
}
impl From<ContinueStatement> for Component {
fn from(value: ContinueStatement) -> Self {
Component::Expr(Expr::ContinueStatement(value))
}
}
impl From<ContinueStatement> for Expr {
fn from(value: ContinueStatement) -> Self {
Expr::ContinueStatement(value)
}
}
impl From<ContinueStatement> for SequenceElement {
fn from(value: ContinueStatement) -> Self {
SequenceElement::Component(Component::Expr(Expr::ContinueStatement(value)))
}
}
impl From<ContinueStatement> for SyntaxNode {
fn from(value: ContinueStatement) -> Self {
SyntaxNode::Expr(Expr::ContinueStatement(value))
}
}
impl From<Token![^]> for BinaryOperator {
fn from(value: Token![^]) -> Self {
BinaryOperator::Crt(value)
}
}
impl From<Token![^!]> for PostfixOperator {
fn from(value: Token![^!]) -> Self {
PostfixOperator::CrtBng(value)
}
}
impl From<Token![^^]> for BinaryOperator {
fn from(value: Token![^^]) -> Self {
BinaryOperator::CrtCrt(value)
}
}
impl From<Token![^^=]> for BinaryOperator {
fn from(value: Token![^^=]) -> Self {
BinaryOperator::CrtCrtEql(value)
}
}
impl From<Token![^=]> for BinaryOperator {
fn from(value: Token![^=]) -> Self {
BinaryOperator::CrtEql(value)
}
}
impl From<Token![^>]> for BinaryOperator {
fn from(value: Token![^>]) -> Self {
BinaryOperator::CrtGst(value)
}
}
impl From<Token![^>=]> for BinaryOperator {
fn from(value: Token![^>=]) -> Self {
BinaryOperator::CrtGstEql(value)
}
}
impl From<Token![^<]> for BinaryOperator {
fn from(value: Token![^<]) -> Self {
BinaryOperator::CrtLst(value)
}
}
impl From<Token![^<=]> for BinaryOperator {
fn from(value: Token![^<=]) -> Self {
BinaryOperator::CrtLstEql(value)
}
}
impl From<Token![^*]> for PostfixOperator {
fn from(value: Token![^*]) -> Self {
PostfixOperator::CrtMul(value)
}
}
impl From<Token![^**]> for BinaryOperator {
fn from(value: Token![^**]) -> Self {
BinaryOperator::CrtMulMul(value)
}
}
impl From<Token![^**=]> for BinaryOperator {
fn from(value: Token![^**=]) -> Self {
BinaryOperator::CrtMulMulEql(value)
}
}
impl From<Token![^~]> for PostfixOperator {
fn from(value: Token![^~]) -> Self {
PostfixOperator::CrtTld(value)
}
}
impl From<DebugClause> for Component {
fn from(value: DebugClause) -> Self {
Component::Expr(Expr::DebugClause(value))
}
}
impl From<DebugClause> for Expr {
fn from(value: DebugClause) -> Self {
Expr::DebugClause(value)
}
}
impl From<DebugClause> for SequenceElement {
fn from(value: DebugClause) -> Self {
SequenceElement::Component(Component::Expr(Expr::DebugClause(value)))
}
}
impl From<DebugClause> for SyntaxNode {
fn from(value: DebugClause) -> Self {
SyntaxNode::Expr(Expr::DebugClause(value))
}
}
impl From<Token![.]> for BinaryOperator {
fn from(value: Token![.]) -> Self {
BinaryOperator::Dot(value)
}
}
impl From<Token![..]> for BinaryOperator {
fn from(value: Token![..]) -> Self {
BinaryOperator::DotDot(value)
}
}
impl From<Token![..=]> for BinaryOperator {
fn from(value: Token![..=]) -> Self {
BinaryOperator::DotDotEql(value)
}
}
impl From<Token![..<]> for BinaryOperator {
fn from(value: Token![..<]) -> Self {
BinaryOperator::DotDotLst(value)
}
}
impl From<Token![..<=]> for BinaryOperator {
fn from(value: Token![..<=]) -> Self {
BinaryOperator::DotDotLstEql(value)
}
}
impl From<Token![.?]> for BinaryOperator {
fn from(value: Token![.?]) -> Self {
BinaryOperator::DotQsm(value)
}
}
impl From<Token![elapsedTime]> for DebugKeyword {
fn from(value: Token![elapsedTime]) -> Self {
DebugKeyword::ElapsedTime(value)
}
}
impl From<Token![elapsedTiming]> for DebugKeyword {
fn from(value: Token![elapsedTiming]) -> Self {
DebugKeyword::ElapsedTiming(value)
}
}
impl From<ElseClause> for TryFallback {
fn from(value: ElseClause) -> Self {
TryFallback::ElseClause(value)
}
}
impl From<EmptyComponent> for Component {
fn from(value: EmptyComponent) -> Self {
Component::EmptyComponent(value)
}
}
impl From<EmptyComponent> for SequenceElement {
fn from(value: EmptyComponent) -> Self {
SequenceElement::Component(Component::EmptyComponent(value))
}
}
impl From<Token![=!=]> for BinaryOperator {
fn from(value: Token![=!=]) -> Self {
BinaryOperator::EqlBngEql(value)
}
}
impl From<Token![==]> for BinaryOperator {
fn from(value: Token![==]) -> Self {
BinaryOperator::EqlEql(value)
}
}
impl From<Token![===]> for BinaryOperator {
fn from(value: Token![===]) -> Self {
BinaryOperator::EqlEqlEql(value)
}
}
impl From<Token![===>]> for BinaryOperator {
fn from(value: Token![===>]) -> Self {
BinaryOperator::EqlEqlEqlGst(value)
}
}
impl From<Token![===>=]> for BinaryOperator {
fn from(value: Token![===>=]) -> Self {
BinaryOperator::EqlEqlEqlGstEql(value)
}
}
impl From<Token![==>]> for BinaryOperator {
fn from(value: Token![==>]) -> Self {
BinaryOperator::EqlEqlGst(value)
}
}
impl From<Token![==>=]> for BinaryOperator {
fn from(value: Token![==>=]) -> Self {
BinaryOperator::EqlEqlGstEql(value)
}
}
impl From<EscapeSequence> for RawStringElement {
fn from(value: EscapeSequence) -> Self {
RawStringElement::EscapeSequence(value)
}
}
impl From<EscapeSequence> for StringElement {
fn from(value: EscapeSequence) -> Self {
StringElement::EscapeSequence(value)
}
}
impl From<EvaluatedAssignment> for AssignmentExpr {
fn from(value: EvaluatedAssignment) -> Self {
AssignmentExpr::EvaluatedAssignment(value)
}
}
impl From<EvaluatedAssignment> for Component {
fn from(value: EvaluatedAssignment) -> Self {
Component::Expr(Expr::AssignmentExpr(AssignmentExpr::EvaluatedAssignment(
value,
)))
}
}
impl From<EvaluatedAssignment> for Expr {
fn from(value: EvaluatedAssignment) -> Self {
Expr::AssignmentExpr(AssignmentExpr::EvaluatedAssignment(value))
}
}
impl From<EvaluatedAssignment> for SequenceElement {
fn from(value: EvaluatedAssignment) -> Self {
SequenceElement::Component(Component::Expr(Expr::AssignmentExpr(
AssignmentExpr::EvaluatedAssignment(value),
)))
}
}
impl From<EvaluatedAssignment> for SyntaxNode {
fn from(value: EvaluatedAssignment) -> Self {
SyntaxNode::Expr(Expr::AssignmentExpr(AssignmentExpr::EvaluatedAssignment(
value,
)))
}
}
impl From<ExceptClause> for TryFallback {
fn from(value: ExceptClause) -> Self {
TryFallback::ExceptClause(value)
}
}
impl From<Expr> for Component {
fn from(value: Expr) -> Self {
Component::Expr(value)
}
}
impl From<Expr> for SequenceElement {
fn from(value: Expr) -> Self {
SequenceElement::Component(Component::Expr(value))
}
}
impl From<Expr> for SyntaxNode {
fn from(value: Expr) -> Self {
SyntaxNode::Expr(value)
}
}
impl From<ExpressionCell> for AnyCell {
fn from(value: ExpressionCell) -> Self {
AnyCell::ExpressionCell(value)
}
}
impl From<ExpressionCell> for SyntaxNode {
fn from(value: ExpressionCell) -> Self {
SyntaxNode::AnyCell(AnyCell::ExpressionCell(value))
}
}
impl From<Token![finish]> for DebugKeyword {
fn from(value: Token![finish]) -> Self {
DebugKeyword::Finish(value)
}
}
impl From<FloatLiteral> for Component {
fn from(value: FloatLiteral) -> Self {
Component::Expr(Expr::FloatLiteral(value))
}
}
impl From<FloatLiteral> for Expr {
fn from(value: FloatLiteral) -> Self {
Expr::FloatLiteral(value)
}
}
impl From<FloatLiteral> for SequenceElement {
fn from(value: FloatLiteral) -> Self {
SequenceElement::Component(Component::Expr(Expr::FloatLiteral(value)))
}
}
impl From<FloatLiteral> for SyntaxNode {
fn from(value: FloatLiteral) -> Self {
SyntaxNode::Expr(Expr::FloatLiteral(value))
}
}
impl From<ForLoop> for Component {
fn from(value: ForLoop) -> Self {
Component::Expr(Expr::ForLoop(value))
}
}
impl From<ForLoop> for Expr {
fn from(value: ForLoop) -> Self {
Expr::ForLoop(value)
}
}
impl From<ForLoop> for SequenceElement {
fn from(value: ForLoop) -> Self {
SequenceElement::Component(Component::Expr(Expr::ForLoop(value)))
}
}
impl From<ForLoop> for SyntaxNode {
fn from(value: ForLoop) -> Self {
SyntaxNode::Expr(Expr::ForLoop(value))
}
}
impl From<Token![global]> for QuoteSpecifier {
fn from(value: Token![global]) -> Self {
QuoteSpecifier::Global(value)
}
}
impl From<Token![(*)]> for PostfixOperator {
fn from(value: Token![(*)]) -> Self {
PostfixOperator::Graded(value)
}
}
impl From<Token![>]> for BinaryOperator {
fn from(value: Token![>]) -> Self {
BinaryOperator::Gst(value)
}
}
impl From<Token![>]> for PrefixOperator {
fn from(value: Token![>]) -> Self {
PrefixOperator::Gst(value)
}
}
impl From<Token![>=]> for BinaryOperator {
fn from(value: Token![>=]) -> Self {
BinaryOperator::GstEql(value)
}
}
impl From<Token![>=]> for PrefixOperator {
fn from(value: Token![>=]) -> Self {
PrefixOperator::GstEql(value)
}
}
impl From<Token![>>]> for BinaryOperator {
fn from(value: Token![>>]) -> Self {
BinaryOperator::GstGst(value)
}
}
impl From<Token![>>=]> for BinaryOperator {
fn from(value: Token![>>=]) -> Self {
BinaryOperator::GstGstEql(value)
}
}
impl From<Token![#]> for BinaryOperator {
fn from(value: Token![#]) -> Self {
BinaryOperator::Hsh(value)
}
}
impl From<Token![#]> for PrefixOperator {
fn from(value: Token![#]) -> Self {
PrefixOperator::Hsh(value)
}
}
impl From<Token![#?]> for BinaryOperator {
fn from(value: Token![#?]) -> Self {
BinaryOperator::HshQsm(value)
}
}
impl From<IfStatement> for Component {
fn from(value: IfStatement) -> Self {
Component::Expr(Expr::IfStatement(value))
}
}
impl From<IfStatement> for Expr {
fn from(value: IfStatement) -> Self {
Expr::IfStatement(value)
}
}
impl From<IfStatement> for SequenceElement {
fn from(value: IfStatement) -> Self {
SequenceElement::Component(Component::Expr(Expr::IfStatement(value)))
}
}
impl From<IfStatement> for SyntaxNode {
fn from(value: IfStatement) -> Self {
SyntaxNode::Expr(Expr::IfStatement(value))
}
}
impl From<IntegerLiteral> for Component {
fn from(value: IntegerLiteral) -> Self {
Component::Expr(Expr::IntegerLiteral(value))
}
}
impl From<IntegerLiteral> for Expr {
fn from(value: IntegerLiteral) -> Self {
Expr::IntegerLiteral(value)
}
}
impl From<IntegerLiteral> for SequenceElement {
fn from(value: IntegerLiteral) -> Self {
SequenceElement::Component(Component::Expr(Expr::IntegerLiteral(value)))
}
}
impl From<IntegerLiteral> for SyntaxNode {
fn from(value: IntegerLiteral) -> Self {
SyntaxNode::Expr(Expr::IntegerLiteral(value))
}
}
impl From<LambdaExpression> for Component {
fn from(value: LambdaExpression) -> Self {
Component::Expr(Expr::LambdaExpression(value))
}
}
impl From<LambdaExpression> for Expr {
fn from(value: LambdaExpression) -> Self {
Expr::LambdaExpression(value)
}
}
impl From<LambdaExpression> for SequenceElement {
fn from(value: LambdaExpression) -> Self {
SequenceElement::Component(Component::Expr(Expr::LambdaExpression(value)))
}
}
impl From<LambdaExpression> for SyntaxNode {
fn from(value: LambdaExpression) -> Self {
SyntaxNode::Expr(Expr::LambdaExpression(value))
}
}
impl From<List> for BindingPack {
fn from(value: List) -> Self {
BindingPack::List(value)
}
}
impl From<List> for Collection {
fn from(value: List) -> Self {
Collection::List(value)
}
}
impl From<List> for Component {
fn from(value: List) -> Self {
Component::Expr(Expr::Collection(Collection::List(value)))
}
}
impl From<List> for Expr {
fn from(value: List) -> Self {
Expr::Collection(Collection::List(value))
}
}
impl From<List> for LambdaParameters {
fn from(value: List) -> Self {
LambdaParameters::List(value)
}
}
impl From<List> for SequenceElement {
fn from(value: List) -> Self {
SequenceElement::Component(Component::Expr(Expr::Collection(Collection::List(value))))
}
}
impl From<List> for SyntaxNode {
fn from(value: List) -> Self {
SyntaxNode::Expr(Expr::Collection(Collection::List(value)))
}
}
impl From<LocalAssignment> for AssignmentExpr {
fn from(value: LocalAssignment) -> Self {
AssignmentExpr::LocalAssignment(value)
}
}
impl From<LocalAssignment> for Component {
fn from(value: LocalAssignment) -> Self {
Component::Expr(Expr::AssignmentExpr(AssignmentExpr::LocalAssignment(value)))
}
}
impl From<LocalAssignment> for Expr {
fn from(value: LocalAssignment) -> Self {
Expr::AssignmentExpr(AssignmentExpr::LocalAssignment(value))
}
}
impl From<LocalAssignment> for SequenceElement {
fn from(value: LocalAssignment) -> Self {
SequenceElement::Component(Component::Expr(Expr::AssignmentExpr(
AssignmentExpr::LocalAssignment(value),
)))
}
}
impl From<LocalAssignment> for SyntaxNode {
fn from(value: LocalAssignment) -> Self {
SyntaxNode::Expr(Expr::AssignmentExpr(AssignmentExpr::LocalAssignment(value)))
}
}
impl From<Token![local]> for QuoteSpecifier {
fn from(value: Token![local]) -> Self {
QuoteSpecifier::Local(value)
}
}
impl From<LocalStructuredBinding> for AssignmentExpr {
fn from(value: LocalStructuredBinding) -> Self {
AssignmentExpr::LocalStructuredBinding(value)
}
}
impl From<LocalStructuredBinding> for Component {
fn from(value: LocalStructuredBinding) -> Self {
Component::Expr(Expr::AssignmentExpr(
AssignmentExpr::LocalStructuredBinding(value),
))
}
}
impl From<LocalStructuredBinding> for Expr {
fn from(value: LocalStructuredBinding) -> Self {
Expr::AssignmentExpr(AssignmentExpr::LocalStructuredBinding(value))
}
}
impl From<LocalStructuredBinding> for SequenceElement {
fn from(value: LocalStructuredBinding) -> Self {
SequenceElement::Component(Component::Expr(Expr::AssignmentExpr(
AssignmentExpr::LocalStructuredBinding(value),
)))
}
}
impl From<LocalStructuredBinding> for SyntaxNode {
fn from(value: LocalStructuredBinding) -> Self {
SyntaxNode::Expr(Expr::AssignmentExpr(
AssignmentExpr::LocalStructuredBinding(value),
))
}
}
impl From<Token![<]> for BinaryOperator {
fn from(value: Token![<]) -> Self {
BinaryOperator::Lst(value)
}
}
impl From<Token![<]> for PrefixOperator {
fn from(value: Token![<]) -> Self {
PrefixOperator::Lst(value)
}
}
impl From<Token![<=]> for BinaryOperator {
fn from(value: Token![<=]) -> Self {
BinaryOperator::LstEql(value)
}
}
impl From<Token![<=]> for PrefixOperator {
fn from(value: Token![<=]) -> Self {
PrefixOperator::LstEql(value)
}
}
impl From<Token![<==]> for BinaryOperator {
fn from(value: Token![<==]) -> Self {
BinaryOperator::LstEqlEql(value)
}
}
impl From<Token![<==]> for PrefixOperator {
fn from(value: Token![<==]) -> Self {
PrefixOperator::LstEqlEql(value)
}
}
impl From<Token![<===]> for BinaryOperator {
fn from(value: Token![<===]) -> Self {
BinaryOperator::LstEqlEqlEql(value)
}
}
impl From<Token![<===]> for PrefixOperator {
fn from(value: Token![<===]) -> Self {
PrefixOperator::LstEqlEqlEql(value)
}
}
impl From<Token![<==>]> for BinaryOperator {
fn from(value: Token![<==>]) -> Self {
BinaryOperator::LstEqlEqlGst(value)
}
}
impl From<Token![<==>=]> for BinaryOperator {
fn from(value: Token![<==>=]) -> Self {
BinaryOperator::LstEqlEqlGstEql(value)
}
}
impl From<Token![<<]> for BinaryOperator {
fn from(value: Token![<<]) -> Self {
BinaryOperator::LstLst(value)
}
}
impl From<Token![<<]> for PrefixOperator {
fn from(value: Token![<<]) -> Self {
PrefixOperator::LstLst(value)
}
}
impl From<Token![<<=]> for BinaryOperator {
fn from(value: Token![<<=]) -> Self {
BinaryOperator::LstLstEql(value)
}
}
impl From<Token![%]> for BinaryOperator {
fn from(value: Token![%]) -> Self {
BinaryOperator::Mod(value)
}
}
impl From<Token![%=]> for BinaryOperator {
fn from(value: Token![%=]) -> Self {
BinaryOperator::ModEql(value)
}
}
impl From<Token![*]> for BinaryOperator {
fn from(value: Token![*]) -> Self {
BinaryOperator::Mul(value)
}
}
impl From<Token![*]> for PrefixOperator {
fn from(value: Token![*]) -> Self {
PrefixOperator::Mul(value)
}
}
impl From<Token![*=]> for BinaryOperator {
fn from(value: Token![*=]) -> Self {
BinaryOperator::MulEql(value)
}
}
impl From<Token![**]> for BinaryOperator {
fn from(value: Token![**]) -> Self {
BinaryOperator::MulMul(value)
}
}
impl From<Token![**=]> for BinaryOperator {
fn from(value: Token![**=]) -> Self {
BinaryOperator::MulMulEql(value)
}
}
impl From<MutedCell> for AnyCell {
fn from(value: MutedCell) -> Self {
AnyCell::MutedCell(value)
}
}
impl From<MutedCell> for SyntaxNode {
fn from(value: MutedCell) -> Self {
SyntaxNode::AnyCell(AnyCell::MutedCell(value))
}
}
impl From<MutedGroup> for SequenceElement {
fn from(value: MutedGroup) -> Self {
SequenceElement::MutedGroup(value)
}
}
impl From<NewStatement> for Component {
fn from(value: NewStatement) -> Self {
Component::Expr(Expr::NewStatement(value))
}
}
impl From<NewStatement> for Expr {
fn from(value: NewStatement) -> Self {
Expr::NewStatement(value)
}
}
impl From<NewStatement> for SequenceElement {
fn from(value: NewStatement) -> Self {
SequenceElement::Component(Component::Expr(Expr::NewStatement(value)))
}
}
impl From<NewStatement> for SyntaxNode {
fn from(value: NewStatement) -> Self {
SyntaxNode::Expr(Expr::NewStatement(value))
}
}
impl From<Token![not]> for PrefixOperator {
fn from(value: Token![not]) -> Self {
PrefixOperator::Not(value)
}
}
impl From<OperatorExpr> for Component {
fn from(value: OperatorExpr) -> Self {
Component::Expr(Expr::OperatorExpr(value))
}
}
impl From<OperatorExpr> for Expr {
fn from(value: OperatorExpr) -> Self {
Expr::OperatorExpr(value)
}
}
impl From<OperatorExpr> for SequenceElement {
fn from(value: OperatorExpr) -> Self {
SequenceElement::Component(Component::Expr(Expr::OperatorExpr(value)))
}
}
impl From<OperatorExpr> for SyntaxNode {
fn from(value: OperatorExpr) -> Self {
SyntaxNode::Expr(Expr::OperatorExpr(value))
}
}
impl From<OptionExpression> for Component {
fn from(value: OptionExpression) -> Self {
Component::Expr(Expr::OptionExpression(value))
}
}
impl From<OptionExpression> for Expr {
fn from(value: OptionExpression) -> Self {
Expr::OptionExpression(value)
}
}
impl From<OptionExpression> for SequenceElement {
fn from(value: OptionExpression) -> Self {
SequenceElement::Component(Component::Expr(Expr::OptionExpression(value)))
}
}
impl From<OptionExpression> for SyntaxNode {
fn from(value: OptionExpression) -> Self {
SyntaxNode::Expr(Expr::OptionExpression(value))
}
}
impl From<Token![or]> for BinaryOperator {
fn from(value: Token![or]) -> Self {
BinaryOperator::Or(value)
}
}
impl From<ParenthesizedExpression> for BindingPack {
fn from(value: ParenthesizedExpression) -> Self {
BindingPack::ParenthesizedExpression(value)
}
}
impl From<ParenthesizedExpression> for Collection {
fn from(value: ParenthesizedExpression) -> Self {
Collection::ParenthesizedExpression(value)
}
}
impl From<ParenthesizedExpression> for Component {
fn from(value: ParenthesizedExpression) -> Self {
Component::Expr(Expr::Collection(Collection::ParenthesizedExpression(value)))
}
}
impl From<ParenthesizedExpression> for Expr {
fn from(value: ParenthesizedExpression) -> Self {
Expr::Collection(Collection::ParenthesizedExpression(value))
}
}
impl From<ParenthesizedExpression> for LambdaParameters {
fn from(value: ParenthesizedExpression) -> Self {
LambdaParameters::ParenthesizedExpression(value)
}
}
impl From<ParenthesizedExpression> for SequenceElement {
fn from(value: ParenthesizedExpression) -> Self {
SequenceElement::Component(Component::Expr(Expr::Collection(
Collection::ParenthesizedExpression(value),
)))
}
}
impl From<ParenthesizedExpression> for SyntaxNode {
fn from(value: ParenthesizedExpression) -> Self {
SyntaxNode::Expr(Expr::Collection(Collection::ParenthesizedExpression(value)))
}
}
impl From<Token![|]> for BinaryOperator {
fn from(value: Token![|]) -> Self {
BinaryOperator::Pip(value)
}
}
impl From<Token![|=]> for BinaryOperator {
fn from(value: Token![|=]) -> Self {
BinaryOperator::PipEql(value)
}
}
impl From<Token![||]> for BinaryOperator {
fn from(value: Token![||]) -> Self {
BinaryOperator::PipPip(value)
}
}
impl From<Token![||=]> for BinaryOperator {
fn from(value: Token![||=]) -> Self {
BinaryOperator::PipPipEql(value)
}
}
impl From<Token![|-]> for BinaryOperator {
fn from(value: Token![|-]) -> Self {
BinaryOperator::PipSub(value)
}
}
impl From<Token![|-]> for PrefixOperator {
fn from(value: Token![|-]) -> Self {
PrefixOperator::PipSub(value)
}
}
impl From<Token![|-=]> for BinaryOperator {
fn from(value: Token![|-=]) -> Self {
BinaryOperator::PipSubEql(value)
}
}
impl From<Token![|_]> for BinaryOperator {
fn from(value: Token![|_]) -> Self {
BinaryOperator::PipUbs(value)
}
}
impl From<Token![|_=]> for BinaryOperator {
fn from(value: Token![|_=]) -> Self {
BinaryOperator::PipUbsEql(value)
}
}
impl From<PostfixAssignment> for AssignmentExpr {
fn from(value: PostfixAssignment) -> Self {
AssignmentExpr::PostfixAssignment(value)
}
}
impl From<PostfixAssignment> for Component {
fn from(value: PostfixAssignment) -> Self {
Component::Expr(Expr::AssignmentExpr(AssignmentExpr::PostfixAssignment(
value,
)))
}
}
impl From<PostfixAssignment> for Expr {
fn from(value: PostfixAssignment) -> Self {
Expr::AssignmentExpr(AssignmentExpr::PostfixAssignment(value))
}
}
impl From<PostfixAssignment> for SequenceElement {
fn from(value: PostfixAssignment) -> Self {
SequenceElement::Component(Component::Expr(Expr::AssignmentExpr(
AssignmentExpr::PostfixAssignment(value),
)))
}
}
impl From<PostfixAssignment> for SyntaxNode {
fn from(value: PostfixAssignment) -> Self {
SyntaxNode::Expr(Expr::AssignmentExpr(AssignmentExpr::PostfixAssignment(
value,
)))
}
}
impl From<PostfixExpression> for Component {
fn from(value: PostfixExpression) -> Self {
Component::Expr(Expr::OperatorExpr(OperatorExpr::PostfixExpression(value)))
}
}
impl From<PostfixExpression> for Expr {
fn from(value: PostfixExpression) -> Self {
Expr::OperatorExpr(OperatorExpr::PostfixExpression(value))
}
}
impl From<PostfixExpression> for OperatorExpr {
fn from(value: PostfixExpression) -> Self {
OperatorExpr::PostfixExpression(value)
}
}
impl From<PostfixExpression> for SequenceElement {
fn from(value: PostfixExpression) -> Self {
SequenceElement::Component(Component::Expr(Expr::OperatorExpr(
OperatorExpr::PostfixExpression(value),
)))
}
}
impl From<PostfixExpression> for SyntaxNode {
fn from(value: PostfixExpression) -> Self {
SyntaxNode::Expr(Expr::OperatorExpr(OperatorExpr::PostfixExpression(value)))
}
}
impl From<PostfixInstallation> for AssignmentExpr {
fn from(value: PostfixInstallation) -> Self {
AssignmentExpr::PostfixInstallation(value)
}
}
impl From<PostfixInstallation> for Component {
fn from(value: PostfixInstallation) -> Self {
Component::Expr(Expr::AssignmentExpr(AssignmentExpr::PostfixInstallation(
value,
)))
}
}
impl From<PostfixInstallation> for Expr {
fn from(value: PostfixInstallation) -> Self {
Expr::AssignmentExpr(AssignmentExpr::PostfixInstallation(value))
}
}
impl From<PostfixInstallation> for SequenceElement {
fn from(value: PostfixInstallation) -> Self {
SequenceElement::Component(Component::Expr(Expr::AssignmentExpr(
AssignmentExpr::PostfixInstallation(value),
)))
}
}
impl From<PostfixInstallation> for SyntaxNode {
fn from(value: PostfixInstallation) -> Self {
SyntaxNode::Expr(Expr::AssignmentExpr(AssignmentExpr::PostfixInstallation(
value,
)))
}
}
impl From<PrefixAssignment> for AssignmentExpr {
fn from(value: PrefixAssignment) -> Self {
AssignmentExpr::PrefixAssignment(value)
}
}
impl From<PrefixAssignment> for Component {
fn from(value: PrefixAssignment) -> Self {
Component::Expr(Expr::AssignmentExpr(AssignmentExpr::PrefixAssignment(
value,
)))
}
}
impl From<PrefixAssignment> for Expr {
fn from(value: PrefixAssignment) -> Self {
Expr::AssignmentExpr(AssignmentExpr::PrefixAssignment(value))
}
}
impl From<PrefixAssignment> for SequenceElement {
fn from(value: PrefixAssignment) -> Self {
SequenceElement::Component(Component::Expr(Expr::AssignmentExpr(
AssignmentExpr::PrefixAssignment(value),
)))
}
}
impl From<PrefixAssignment> for SyntaxNode {
fn from(value: PrefixAssignment) -> Self {
SyntaxNode::Expr(Expr::AssignmentExpr(AssignmentExpr::PrefixAssignment(
value,
)))
}
}
impl From<PrefixExpression> for Component {
fn from(value: PrefixExpression) -> Self {
Component::Expr(Expr::OperatorExpr(OperatorExpr::PrefixExpression(value)))
}
}
impl From<PrefixExpression> for Expr {
fn from(value: PrefixExpression) -> Self {
Expr::OperatorExpr(OperatorExpr::PrefixExpression(value))
}
}
impl From<PrefixExpression> for OperatorExpr {
fn from(value: PrefixExpression) -> Self {
OperatorExpr::PrefixExpression(value)
}
}
impl From<PrefixExpression> for SequenceElement {
fn from(value: PrefixExpression) -> Self {
SequenceElement::Component(Component::Expr(Expr::OperatorExpr(
OperatorExpr::PrefixExpression(value),
)))
}
}
impl From<PrefixExpression> for SyntaxNode {
fn from(value: PrefixExpression) -> Self {
SyntaxNode::Expr(Expr::OperatorExpr(OperatorExpr::PrefixExpression(value)))
}
}
impl From<PrefixInstallation> for AssignmentExpr {
fn from(value: PrefixInstallation) -> Self {
AssignmentExpr::PrefixInstallation(value)
}
}
impl From<PrefixInstallation> for Component {
fn from(value: PrefixInstallation) -> Self {
Component::Expr(Expr::AssignmentExpr(AssignmentExpr::PrefixInstallation(
value,
)))
}
}
impl From<PrefixInstallation> for Expr {
fn from(value: PrefixInstallation) -> Self {
Expr::AssignmentExpr(AssignmentExpr::PrefixInstallation(value))
}
}
impl From<PrefixInstallation> for SequenceElement {
fn from(value: PrefixInstallation) -> Self {
SequenceElement::Component(Component::Expr(Expr::AssignmentExpr(
AssignmentExpr::PrefixInstallation(value),
)))
}
}
impl From<PrefixInstallation> for SyntaxNode {
fn from(value: PrefixInstallation) -> Self {
SyntaxNode::Expr(Expr::AssignmentExpr(AssignmentExpr::PrefixInstallation(
value,
)))
}
}
impl From<Token![profile]> for DebugKeyword {
fn from(value: Token![profile]) -> Self {
DebugKeyword::Profile(value)
}
}
impl From<Token![?]> for BinaryOperator {
fn from(value: Token![?]) -> Self {
BinaryOperator::Qsm(value)
}
}
impl From<Token![?]> for PrefixOperator {
fn from(value: Token![?]) -> Self {
PrefixOperator::Qsm(value)
}
}
impl From<Token![??]> for BinaryOperator {
fn from(value: Token![??]) -> Self {
BinaryOperator::QsmQsm(value)
}
}
impl From<Token![??]> for PrefixOperator {
fn from(value: Token![??]) -> Self {
PrefixOperator::QsmQsm(value)
}
}
impl From<Token![??=]> for BinaryOperator {
fn from(value: Token![??=]) -> Self {
BinaryOperator::QsmQsmEql(value)
}
}
impl From<QuoteExpression> for Component {
fn from(value: QuoteExpression) -> Self {
Component::Expr(Expr::QuoteExpression(value))
}
}
impl From<QuoteExpression> for Expr {
fn from(value: QuoteExpression) -> Self {
Expr::QuoteExpression(value)
}
}
impl From<QuoteExpression> for SequenceElement {
fn from(value: QuoteExpression) -> Self {
SequenceElement::Component(Component::Expr(Expr::QuoteExpression(value)))
}
}
impl From<QuoteExpression> for SyntaxNode {
fn from(value: QuoteExpression) -> Self {
SyntaxNode::Expr(Expr::QuoteExpression(value))
}
}
impl From<RawStringContent> for RawStringElement {
fn from(value: RawStringContent) -> Self {
RawStringElement::RawStringContent(value)
}
}
impl From<RawStringLiteral> for Component {
fn from(value: RawStringLiteral) -> Self {
Component::Expr(Expr::RawStringLiteral(value))
}
}
impl From<RawStringLiteral> for Expr {
fn from(value: RawStringLiteral) -> Self {
Expr::RawStringLiteral(value)
}
}
impl From<RawStringLiteral> for SequenceElement {
fn from(value: RawStringLiteral) -> Self {
SequenceElement::Component(Component::Expr(Expr::RawStringLiteral(value)))
}
}
impl From<RawStringLiteral> for SyntaxNode {
fn from(value: RawStringLiteral) -> Self {
SyntaxNode::Expr(Expr::RawStringLiteral(value))
}
}
impl From<ReturnStatement> for Component {
fn from(value: ReturnStatement) -> Self {
Component::Expr(Expr::ReturnStatement(value))
}
}
impl From<ReturnStatement> for Expr {
fn from(value: ReturnStatement) -> Self {
Expr::ReturnStatement(value)
}
}
impl From<ReturnStatement> for SequenceElement {
fn from(value: ReturnStatement) -> Self {
SequenceElement::Component(Component::Expr(Expr::ReturnStatement(value)))
}
}
impl From<ReturnStatement> for SyntaxNode {
fn from(value: ReturnStatement) -> Self {
SyntaxNode::Expr(Expr::ReturnStatement(value))
}
}
impl From<Sequence> for BindingPack {
fn from(value: Sequence) -> Self {
BindingPack::Sequence(value)
}
}
impl From<Sequence> for Collection {
fn from(value: Sequence) -> Self {
Collection::Sequence(value)
}
}
impl From<Sequence> for Component {
fn from(value: Sequence) -> Self {
Component::Expr(Expr::Collection(Collection::Sequence(value)))
}
}
impl From<Sequence> for Expr {
fn from(value: Sequence) -> Self {
Expr::Collection(Collection::Sequence(value))
}
}
impl From<Sequence> for LambdaParameters {
fn from(value: Sequence) -> Self {
LambdaParameters::Sequence(value)
}
}
impl From<Sequence> for SequenceElement {
fn from(value: Sequence) -> Self {
SequenceElement::Component(Component::Expr(Expr::Collection(Collection::Sequence(
value,
))))
}
}
impl From<Sequence> for SyntaxNode {
fn from(value: Sequence) -> Self {
SyntaxNode::Expr(Expr::Collection(Collection::Sequence(value)))
}
}
impl From<SequenceCell> for AnyCell {
fn from(value: SequenceCell) -> Self {
AnyCell::SequenceCell(value)
}
}
impl From<SequenceCell> for SyntaxNode {
fn from(value: SequenceCell) -> Self {
SyntaxNode::AnyCell(AnyCell::SequenceCell(value))
}
}
impl From<Token!["â§¢"]> for BinaryOperator {
fn from(value: Token!["â§¢"]) -> Self {
BinaryOperator::Sfp(value)
}
}
impl From<Token!["â§¢="]> for BinaryOperator {
fn from(value: Token!["â§¢="]) -> Self {
BinaryOperator::SfpEql(value)
}
}
impl From<Token![shield]> for DebugKeyword {
fn from(value: Token![shield]) -> Self {
DebugKeyword::Shield(value)
}
}
impl From<Token![/]> for BinaryOperator {
fn from(value: Token![/]) -> Self {
BinaryOperator::Slh(value)
}
}
impl From<Token![/=]> for BinaryOperator {
fn from(value: Token![/=]) -> Self {
BinaryOperator::SlhEql(value)
}
}
impl From<Token![/ /]> for BinaryOperator {
fn from(value: Token![/ /]) -> Self {
BinaryOperator::SlhSlh(value)
}
}
impl From<Token![/ /=]> for BinaryOperator {
fn from(value: Token![/ /=]) -> Self {
BinaryOperator::SlhSlhEql(value)
}
}
impl From<SourceFile> for SyntaxNode {
fn from(value: SourceFile) -> Self {
SyntaxNode::SourceFile(value)
}
}
impl From<Token![SPACE]> for BinaryOperator {
fn from(value: Token![SPACE]) -> Self {
BinaryOperator::Space(value)
}
}
impl From<Token![step]> for DebugKeyword {
fn from(value: Token![step]) -> Self {
DebugKeyword::Step(value)
}
}
impl From<StringContent> for StringElement {
fn from(value: StringContent) -> Self {
StringElement::StringContent(value)
}
}
impl From<StringLiteral> for Component {
fn from(value: StringLiteral) -> Self {
Component::Expr(Expr::StringLiteral(value))
}
}
impl From<StringLiteral> for Expr {
fn from(value: StringLiteral) -> Self {
Expr::StringLiteral(value)
}
}
impl From<StringLiteral> for SequenceElement {
fn from(value: StringLiteral) -> Self {
SequenceElement::Component(Component::Expr(Expr::StringLiteral(value)))
}
}
impl From<StringLiteral> for SyntaxNode {
fn from(value: StringLiteral) -> Self {
SyntaxNode::Expr(Expr::StringLiteral(value))
}
}
impl From<StructuredBinding> for AssignmentExpr {
fn from(value: StructuredBinding) -> Self {
AssignmentExpr::StructuredBinding(value)
}
}
impl From<StructuredBinding> for Component {
fn from(value: StructuredBinding) -> Self {
Component::Expr(Expr::AssignmentExpr(AssignmentExpr::StructuredBinding(
value,
)))
}
}
impl From<StructuredBinding> for Expr {
fn from(value: StructuredBinding) -> Self {
Expr::AssignmentExpr(AssignmentExpr::StructuredBinding(value))
}
}
impl From<StructuredBinding> for SequenceElement {
fn from(value: StructuredBinding) -> Self {
SequenceElement::Component(Component::Expr(Expr::AssignmentExpr(
AssignmentExpr::StructuredBinding(value),
)))
}
}
impl From<StructuredBinding> for SyntaxNode {
fn from(value: StructuredBinding) -> Self {
SyntaxNode::Expr(Expr::AssignmentExpr(AssignmentExpr::StructuredBinding(
value,
)))
}
}
impl From<Token![-]> for BinaryOperator {
fn from(value: Token![-]) -> Self {
BinaryOperator::Sub(value)
}
}
impl From<Token![-]> for PrefixOperator {
fn from(value: Token![-]) -> Self {
PrefixOperator::Sub(value)
}
}
impl From<Token![-=]> for BinaryOperator {
fn from(value: Token![-=]) -> Self {
BinaryOperator::SubEql(value)
}
}
impl From<Symbol> for Component {
fn from(value: Symbol) -> Self {
Component::Expr(Expr::Symbol(value))
}
}
impl From<Symbol> for Expr {
fn from(value: Symbol) -> Self {
Expr::Symbol(value)
}
}
impl From<Symbol> for LambdaParameters {
fn from(value: Symbol) -> Self {
LambdaParameters::Symbol(value)
}
}
impl From<Symbol> for SequenceElement {
fn from(value: Symbol) -> Self {
SequenceElement::Component(Component::Expr(Expr::Symbol(value)))
}
}
impl From<Symbol> for SyntaxNode {
fn from(value: Symbol) -> Self {
SyntaxNode::Expr(Expr::Symbol(value))
}
}
impl From<Token![symbol]> for QuoteSpecifier {
fn from(value: Token![symbol]) -> Self {
QuoteSpecifier::Symbol(value)
}
}
impl From<Token![TEST]> for DebugKeyword {
fn from(value: Token![TEST]) -> Self {
DebugKeyword::Test(value)
}
}
impl From<Token![threadLocal]> for QuoteSpecifier {
fn from(value: Token![threadLocal]) -> Self {
QuoteSpecifier::ThreadLocal(value)
}
}
impl From<Token![threadVariable]> for QuoteSpecifier {
fn from(value: Token![threadVariable]) -> Self {
QuoteSpecifier::ThreadVariable(value)
}
}
impl From<ThrowStatement> for Component {
fn from(value: ThrowStatement) -> Self {
Component::Expr(Expr::ThrowStatement(value))
}
}
impl From<ThrowStatement> for Expr {
fn from(value: ThrowStatement) -> Self {
Expr::ThrowStatement(value)
}
}
impl From<ThrowStatement> for SequenceElement {
fn from(value: ThrowStatement) -> Self {
SequenceElement::Component(Component::Expr(Expr::ThrowStatement(value)))
}
}
impl From<ThrowStatement> for SyntaxNode {
fn from(value: ThrowStatement) -> Self {
SyntaxNode::Expr(Expr::ThrowStatement(value))
}
}
impl From<Token![time]> for DebugKeyword {
fn from(value: Token![time]) -> Self {
DebugKeyword::Time(value)
}
}
impl From<Token![timing]> for DebugKeyword {
fn from(value: Token![timing]) -> Self {
DebugKeyword::Timing(value)
}
}
impl From<Token![~]> for BinaryOperator {
fn from(value: Token![~]) -> Self {
BinaryOperator::Tld(value)
}
}
impl From<Token![~]> for PrefixOperator {
fn from(value: Token![~]) -> Self {
PrefixOperator::Tld(value)
}
}
impl From<Token![~=]> for BinaryOperator {
fn from(value: Token![~=]) -> Self {
BinaryOperator::TldEql(value)
}
}
impl From<TrapStatement> for Component {
fn from(value: TrapStatement) -> Self {
Component::Expr(Expr::TrapStatement(value))
}
}
impl From<TrapStatement> for Expr {
fn from(value: TrapStatement) -> Self {
Expr::TrapStatement(value)
}
}
impl From<TrapStatement> for SequenceElement {
fn from(value: TrapStatement) -> Self {
SequenceElement::Component(Component::Expr(Expr::TrapStatement(value)))
}
}
impl From<TrapStatement> for SyntaxNode {
fn from(value: TrapStatement) -> Self {
SyntaxNode::Expr(Expr::TrapStatement(value))
}
}
impl From<TryStatement> for Component {
fn from(value: TryStatement) -> Self {
Component::Expr(Expr::TryStatement(value))
}
}
impl From<TryStatement> for Expr {
fn from(value: TryStatement) -> Self {
Expr::TryStatement(value)
}
}
impl From<TryStatement> for SequenceElement {
fn from(value: TryStatement) -> Self {
SequenceElement::Component(Component::Expr(Expr::TryStatement(value)))
}
}
impl From<TryStatement> for SyntaxNode {
fn from(value: TryStatement) -> Self {
SyntaxNode::Expr(Expr::TryStatement(value))
}
}
impl From<Token![_]> for BinaryOperator {
fn from(value: Token![_]) -> Self {
BinaryOperator::Ubs(value)
}
}
impl From<Token![_!]> for PostfixOperator {
fn from(value: Token![_!]) -> Self {
PostfixOperator::UbsBng(value)
}
}
impl From<Token![_=]> for BinaryOperator {
fn from(value: Token![_=]) -> Self {
BinaryOperator::UbsEql(value)
}
}
impl From<Token![_>]> for BinaryOperator {
fn from(value: Token![_>]) -> Self {
BinaryOperator::UbsGst(value)
}
}
impl From<Token![_>=]> for BinaryOperator {
fn from(value: Token![_>=]) -> Self {
BinaryOperator::UbsGstEql(value)
}
}
impl From<Token![_<]> for BinaryOperator {
fn from(value: Token![_<]) -> Self {
BinaryOperator::UbsLst(value)
}
}
impl From<Token![_<=]> for BinaryOperator {
fn from(value: Token![_<=]) -> Self {
BinaryOperator::UbsLstEql(value)
}
}
impl From<Token![_*]> for PostfixOperator {
fn from(value: Token![_*]) -> Self {
PostfixOperator::UbsMul(value)
}
}
impl From<Token![_~]> for PostfixOperator {
fn from(value: Token![_~]) -> Self {
PostfixOperator::UbsTld(value)
}
}
impl From<WhileLoop> for Component {
fn from(value: WhileLoop) -> Self {
Component::Expr(Expr::WhileLoop(value))
}
}
impl From<WhileLoop> for Expr {
fn from(value: WhileLoop) -> Self {
Expr::WhileLoop(value)
}
}
impl From<WhileLoop> for SequenceElement {
fn from(value: WhileLoop) -> Self {
SequenceElement::Component(Component::Expr(Expr::WhileLoop(value)))
}
}
impl From<WhileLoop> for SyntaxNode {
fn from(value: WhileLoop) -> Self {
SyntaxNode::Expr(Expr::WhileLoop(value))
}
}
impl From<Token![xor]> for BinaryOperator {
fn from(value: Token![xor]) -> Self {
BinaryOperator::Xor(value)
}
}