<commit_before>use error::Result;
use token::Token;

pub struct Module;

/// Root Twig AST node.
impl Module {
    pub fn from_tokens<'code, I>(tokens: I)
        -> Result<Module>
            where I: IntoIterator<Item=Result<Token<'code>>>
    {
        let mut i = tokens.into_iter();
        i.next();
        Ok(Module)
    }<commit_msg>Starting from Module and trying to keep it simple as much as possible.<commit_after>use error::Result;
use token::Token;

pub struct Body;
pub struct Block;
pub struct Macro;
pub struct Trait;
pub struct AnyNode;

pub struct Module {
    // Sub nodes.
    body: Vec<Body>,
    blocks: Vec<Block>,
    macros: Vec<Macro>,
    traits: Vec<Trait>,

    // Attributes.
    file_id: Option<String>, // this must NOT be treated as file name
    index: i32, // TODO: wtf is this
    embedded_templates: Vec<()>, // TODO: should this be here

    // TODO: check usage of things bellow
    display_start: AnyNode,
    display_end: AnyNode,
    constructor_start: AnyNode,
    constructor_end: AnyNode,
    class_end: AnyNode,
}

/// Root Twig AST node.
impl Module {
    pub fn new() -> Module {
        Module {
            body: vec![],
            blocks: vec![],
            macros: vec![],
            traits: vec![],

            file_id: None,
            index: 0,
            embedded_templates: vec![],

            display_start: AnyNode,
            display_end: AnyNode,
            constructor_start: AnyNode,
            constructor_end: AnyNode,
            class_end: AnyNode,
        }
    }

    pub fn from_tokens<'code, I>(tokens: I)
        -> Result<Module>
            where I: IntoIterator<Item=Result<Token<'code>>>
    {
        let mut i = tokens.into_iter();
        i.next();
        Ok(Module::new())
    }
{'fraction_non_alphanumeric': 0.11807909604519774, 'fraction_numerical': 0.001694915254237288, 'mean_word_length': 2.128975265017668, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 22, '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': '1304114', 'n_tokens_mistral': 539, 'n_tokens_neox': 530, 'n_words': 162}