<commit_before>use lexer::types::*;

#[derive(PartialEq, Debug)]
pub struct Program(pub BlockStmt);

pub type BlockStmt = Vec<Stmt>;

#[derive(PartialEq, Debug)]
pub enum Stmt {
    Let(Ident, Expr),
    Return(Expr),
    Expr(Expr),
}

#[derive(PartialEq, Debug)]
pub enum Expr {
    Ident(Ident),
    Lit(Literal),
    Prefix(PrefixOp, Box<Expr>),
    Infix(InfixOp, Box<Expr>, Box<Expr>),
    If {
        cond: Box<Expr>,
        con: BlockStmt,
        alt: Option<BlockStmt>,
    },
    Fn { params: Vec<Ident>, body: BlockStmt },
    Call { func: Box<Expr>, args: Vec<Expr> },
    Array(Vec<Expr>),
    Hash(Vec<(Literal, Expr)>),
    Index { target: Box<Expr>, index: Box<Expr> },
}

#[derive(PartialEq, Debug)]
pub struct Ident(pub String, pub Token);

#[derive(PartialEq, Debug)]
pub enum Literal {
    Int(i64, Token),
    Bool(bool, Token),
    String(String, Token),
}

#[derive(PartialEq, Debug)]
pub enum PrefixOp {
    Plus(Token),
    Minus(Token),
    Not(Token),
}

#[derive(PartialEq, Debug)]
pub enum InfixOp {
    Plus(Token),
    Minus(Token),
    Divide(Token),
    Multiply(Token),
    Eq(Token),
    NotEq(Token),
    GreaterThan(Token),
    LessThan(Token),
}

#[derive(PartialEq, Eq, PartialOrd, Ord)]
pub enum Prec {
    Lowest,
    Equals,
    LessGreater,
    Sum,
    Product,
    Call,
    Index,
}
<commit_msg>Do not derive PartialEq for ASTs<commit_after>use lexer::types::*;

#[derive(PartialEq, Debug)]
pub struct Program(pub BlockStmt);

pub type BlockStmt = Vec<Stmt>;

#[derive(PartialEq, Debug)]
pub enum Stmt {
    Let(Ident, Expr),
    Return(Expr),
    Expr(Expr),
}

#[derive(PartialEq, Debug)]
pub enum Expr {
    Ident(Ident),
    Lit(Literal),
    Prefix(PrefixOp, Box<Expr>),
    Infix(InfixOp, Box<Expr>, Box<Expr>),
    If {
        cond: Box<Expr>,
        con: BlockStmt,
        alt: Option<BlockStmt>,
    },
    Fn { params: Vec<Ident>, body: BlockStmt },
    Call { func: Box<Expr>, args: Vec<Expr> },
    Array(Vec<Expr>),
    Hash(Vec<(Literal, Expr)>),
    Index { target: Box<Expr>, index: Box<Expr> },
}

#[derive(Debug)]
pub struct Ident(pub String, pub Token);

impl PartialEq for Ident {
    fn eq(&self, other: &Self) -> bool {
        self.0 == other.0
    }
}

#[derive(Debug)]
pub enum Literal {
    Int(i64, Token),
    Bool(bool, Token),
    String(String, Token),
}

impl PartialEq for Literal {
    fn eq(&self, other: &Self) -> bool {
        match (self, other) {
            (&Literal::Int(ref i1, _), &Literal::Int(ref i2, _)) => i1 == i2,
            (&Literal::Bool(ref b1, _), &Literal::Bool(ref b2, _)) => b1 == b2,
            (&Literal::String(ref s1, _), &Literal::String(ref s2, _)) => s1 == s2,
            _ => false,
        }
    }
}

#[derive(Debug)]
pub enum PrefixOp {
    Plus(Token),
    Minus(Token),
    Not(Token),
}

impl PartialEq for PrefixOp {
    fn eq(&self, other: &Self) -> bool {
        match (self, other) {
            (&PrefixOp::Plus(_), &PrefixOp::Plus(_)) => true,
            (&PrefixOp::Minus(_), &PrefixOp::Minus(_)) => true,
            (&PrefixOp::Not(_), &PrefixOp::Not(_)) => true,
            _ => false,
        }
    }
}

#[derive(Debug)]
pub enum InfixOp {
    Plus(Token),
    Minus(Token),
    Divide(Token),
    Multiply(Token),
    Eq(Token),
    NotEq(Token),
    GreaterThan(Token),
    LessThan(Token),
}

impl PartialEq for InfixOp {
    fn eq(&self, other: &Self) -> bool {
        match (self, other) {
            (&InfixOp::Plus(_), &InfixOp::Plus(_)) => true,
            (&InfixOp::Minus(_), &InfixOp::Minus(_)) => true,
            (&InfixOp::Divide(_), &InfixOp::Divide(_)) => true,
            (&InfixOp::Multiply(_), &InfixOp::Multiply(_)) => true,
            (&InfixOp::Eq(_), &InfixOp::Eq(_)) => true,
            (&InfixOp::NotEq(_), &InfixOp::NotEq(_)) => true,
            (&InfixOp::GreaterThan(_), &InfixOp::GreaterThan(_)) => true,
            (&InfixOp::LessThan(_), &InfixOp::LessThan(_)) => true,
            _ => false,
        }
    }
}

#[derive(PartialEq, Eq, PartialOrd, Ord)]
pub enum Prec {
    Lowest,
    Equals,
    LessGreater,
    Sum,
    Product,
    Call,
    Index,
}

{'fraction_non_alphanumeric': 0.18028032866118898, 'fraction_numerical': 0.0043499275012083135, 'mean_word_length': 2.857409133271202, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 50, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2604914', 'n_tokens_mistral': 1481, 'n_tokens_neox': 1497, 'n_words': 326}