<commit_before>extern crate nom_lua53;

use std::io::{self, Read};
use nom_lua53::{parse_all, ParseResult, Statement, Exp};

#[derive(Debug)]
enum LuaValue {
    Integer(isize),
    Float(f64),
    Boolean(bool),
    Str(String),
}

// What do we say? We say "<NAME>!"
fn lit_to_string(string: &nom_lua53::string::StringLit) -> String {
    return String::from_utf8_lossy(&(string.0)).to_string();
}

fn eval_expr(expr: &Exp) -> std::option::Option<LuaValue> {
    match *expr {
        Exp::Nil => None,
        Exp::Bool(val) => Some(LuaValue::Boolean(val)),
        Exp::Num(val) => Some(match val {
            nom_lua53::num::Numeral::Float(fl) => LuaValue::Float(fl),
            nom_lua53::num::Numeral::Int(i) => LuaValue::Integer(i),
        }),
        Exp::Str(ref s) => Some(LuaValue::Str(lit_to_string(s))),
        _ => None,
    }
}

fn main() {
    let mut input = Vec::new();
    io::stdin().read_to_end(&mut input).expect("Couldn't read from stdin");

    match parse_all(&*input) {
        ParseResult::Done(blk) => {
            for stmt in blk.stmts {
                println!("{:?}", stmt);
                match stmt {<commit_msg>Remove an explicit dereference, leaving it to the coercion thingy<commit_after>extern crate nom_lua53;

use std::io::{self, Read};
use nom_lua53::{parse_all, ParseResult, Statement, Exp};

#[derive(Debug)]
enum LuaValue {
    Integer(isize),
    Float(f64),
    Boolean(bool),
    Str(String),
}

// What do we say? We say "<NAME>!"
fn lit_to_string(string: &nom_lua53::string::StringLit) -> String {
    return String::from_utf8_lossy(&(string.0)).to_string();
}

fn eval_expr(expr: &Exp) -> std::option::Option<LuaValue> {
    match *expr {
        Exp::Nil => None,
        Exp::Bool(val) => Some(LuaValue::Boolean(val)),
        Exp::Num(val) => Some(match val {
            nom_lua53::num::Numeral::Float(fl) => LuaValue::Float(fl),
            nom_lua53::num::Numeral::Int(i) => LuaValue::Integer(i),
        }),
        Exp::Str(ref s) => Some(LuaValue::Str(lit_to_string(s))),
        _ => None,
    }
}

fn main() {
    let mut input = Vec::new();
    io::stdin().read_to_end(&mut input).expect("Couldn't read from stdin");

    match parse_all(&input) {
        ParseResult::Done(blk) => {
            for stmt in blk.stmts {
                println!("{:?}", stmt);
                match stmt {
{'fraction_non_alphanumeric': 0.1824352991090369, 'fraction_numerical': 0.011879507848960543, 'mean_word_length': 3.136842105263158, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 27, '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': '593735', 'n_tokens_mistral': 850, 'n_tokens_neox': 827, 'n_words': 157}