sunflower/src/sunflower/ast_impls.rs

279 lines
7.2 KiB
Rust

#![allow(unused)]
#![allow(non_snake_case)]
#![allow(non_camel_case_types)]
#![allow(clippy::all)]
// |==========================================================|
// | WARNING: THIS FILE IS AUTOMATICALLY GENERATED. |
// | CHANGES TO IT WILL BE DELETED WHEN REGENERATED. |
// | IN GENERAL, THIS FILE SHOULD NOT BE MODIFIED IN ANY WAY. |
// |==========================================================|
use super::prelude::*;
impl<M: AstInfo> AstNode<M> for Identifier<M> {
fn ast_info(&self) -> &M {
let Self(meta, ..) = self;
meta
}
fn constructor(&self) -> &'static str {
"identifier"
}
fn sort(&self) -> &'static str {
"identifier"
}
}
impl<M: AstInfo> AstNode<M> for Times<M> {
fn ast_info(&self) -> &M {
match self {
Self::Times(meta, ..) => meta,
Self::Divide(meta, ..) => meta,
Self::Value(meta, ..) => meta,
_ => unreachable!(),
}
}
fn constructor(&self) -> &'static str {
match self {
Self::Times(..) => "times",
Self::Divide(..) => "divide",
Self::Value(..) => "value",
_ => unreachable!(),
}
}
fn sort(&self) -> &'static str {
"times"
}
}
impl<M: AstInfo> AstNode<M> for Equality<M> {
fn ast_info(&self) -> &M {
match self {
Self::Equal(meta, ..) => meta,
Self::NotEqual(meta, ..) => meta,
Self::Inequality(meta, ..) => meta,
_ => unreachable!(),
}
}
fn constructor(&self) -> &'static str {
match self {
Self::Equal(..) => "equal",
Self::NotEqual(..) => "not_equal",
Self::Inequality(..) => "inequality",
_ => unreachable!(),
}
}
fn sort(&self) -> &'static str {
"equality"
}
}
impl<M: AstInfo> AstNode<M> for Program<M> {
fn ast_info(&self) -> &M {
let Self(meta, ..) = self;
meta
}
fn constructor(&self) -> &'static str {
"program"
}
fn sort(&self) -> &'static str {
"program"
}
}
impl<M: AstInfo> AstNode<M> for Int<M> {
fn ast_info(&self) -> &M {
let Self(meta, ..) = self;
meta
}
fn constructor(&self) -> &'static str {
"int"
}
fn sort(&self) -> &'static str {
"int"
}
}
impl<M: AstInfo> AstNode<M> for Statement<M> {
fn ast_info(&self) -> &M {
match self {
Self::Expression(meta, ..) => meta,
Self::Let(meta, ..) => meta,
_ => unreachable!(),
}
}
fn constructor(&self) -> &'static str {
match self {
Self::Expression(..) => "expression",
Self::Let(..) => "let",
_ => unreachable!(),
}
}
fn sort(&self) -> &'static str {
"statement"
}
}
impl<M: AstInfo> AstNode<M> for Bool<M> {
fn ast_info(&self) -> &M {
match self {
Self::True(meta, ..) => meta,
Self::False(meta, ..) => meta,
_ => unreachable!(),
}
}
fn constructor(&self) -> &'static str {
match self {
Self::True(..) => "true",
Self::False(..) => "false",
_ => unreachable!(),
}
}
fn sort(&self) -> &'static str {
"bool"
}
}
impl<M: AstInfo> AstNode<M> for Value<M> {
fn ast_info(&self) -> &M {
match self {
Self::Const(meta, ..) => meta,
Self::Call(meta, ..) => meta,
Self::Identifier(meta, ..) => meta,
Self::Parens(meta, ..) => meta,
_ => unreachable!(),
}
}
fn constructor(&self) -> &'static str {
match self {
Self::Const(..) => "const",
Self::Call(..) => "call",
Self::Identifier(..) => "identifier",
Self::Parens(..) => "parens",
_ => unreachable!(),
}
}
fn sort(&self) -> &'static str {
"value"
}
}
impl<M: AstInfo> AstNode<M> for Char<M> {
fn ast_info(&self) -> &M {
let Self(meta, ..) = self;
meta
}
fn constructor(&self) -> &'static str {
"char"
}
fn sort(&self) -> &'static str {
"char"
}
}
impl<M: AstInfo> AstNode<M> for Inequality<M> {
fn ast_info(&self) -> &M {
match self {
Self::LessThan(meta, ..) => meta,
Self::LessThanOrEqual(meta, ..) => meta,
Self::GreaterThan(meta, ..) => meta,
Self::GreaterThanOrEqual(meta, ..) => meta,
Self::Plus(meta, ..) => meta,
_ => unreachable!(),
}
}
fn constructor(&self) -> &'static str {
match self {
Self::LessThan(..) => "less_than",
Self::LessThanOrEqual(..) => "less_than_or_equal",
Self::GreaterThan(..) => "greater_than",
Self::GreaterThanOrEqual(..) => "greater_than_or_equal",
Self::Plus(..) => "plus",
_ => unreachable!(),
}
}
fn sort(&self) -> &'static str {
"inequality"
}
}
impl<M: AstInfo> AstNode<M> for Expression<M> {
fn ast_info(&self) -> &M {
let Self(meta, ..) = self;
meta
}
fn constructor(&self) -> &'static str {
"equality"
}
fn sort(&self) -> &'static str {
"expression"
}
}
impl<M: AstInfo> AstNode<M> for Call<M> {
fn ast_info(&self) -> &M {
let Self(meta, ..) = self;
meta
}
fn constructor(&self) -> &'static str {
"call"
}
fn sort(&self) -> &'static str {
"call"
}
}
impl<M: AstInfo> AstNode<M> for String<M> {
fn ast_info(&self) -> &M {
let Self(meta, ..) = self;
meta
}
fn constructor(&self) -> &'static str {
"string"
}
fn sort(&self) -> &'static str {
"string"
}
}
impl<M: AstInfo> AstNode<M> for Plus<M> {
fn ast_info(&self) -> &M {
match self {
Self::Plus(meta, ..) => meta,
Self::Minus(meta, ..) => meta,
Self::Times(meta, ..) => meta,
_ => unreachable!(),
}
}
fn constructor(&self) -> &'static str {
match self {
Self::Plus(..) => "plus",
Self::Minus(..) => "minus",
Self::Times(..) => "times",
_ => unreachable!(),
}
}
fn sort(&self) -> &'static str {
"plus"
}
}
impl<M: AstInfo> AstNode<M> for Layout<M> {
fn ast_info(&self) -> &M {
let Self(meta, ..) = self;
meta
}
fn constructor(&self) -> &'static str {
"layout"
}
fn sort(&self) -> &'static str {
"layout"
}
}
impl<M: AstInfo> AstNode<M> for ConstValue<M> {
fn ast_info(&self) -> &M {
match self {
Self::Int(meta, ..) => meta,
Self::Bool(meta, ..) => meta,
Self::String(meta, ..) => meta,
Self::Char(meta, ..) => meta,
_ => unreachable!(),
}
}
fn constructor(&self) -> &'static str {
match self {
Self::Int(..) => "int",
Self::Bool(..) => "bool",
Self::String(..) => "string",
Self::Char(..) => "char",
_ => unreachable!(),
}
}
fn sort(&self) -> &'static str {
"const_value"
}
}