<commit_before>﻿using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;

namespace HCEngine.Default.Language
{
    /// <summary>
    /// Base class for Operation item
    /// </summary>
    public class Operation : ISyntaxTreeItem
    {
        /// <summary>
        /// <see cref="ISyntaxTreeItem.Execute(ISourceReader, IExecutionScope, bool)"/>
        /// </summary>
        public IScriptExecution Execute(ISourceReader reader, IExecutionScope scope, bool skipExec)
        {
            string word = reader.LastKeyword;
            if (DefaultLanguageNodes.Call.IsStartOfNode(word, scope))
                return DefaultLanguageNodes.Call.Execute(reader, scope, skipExec);

            if (DefaultLanguageNodes.Variable.IsStartOfNode(word, scope))
                return DefaultLanguageNodes.Variable.Execute(reader, scope, skipExec);

            if (DefaultLanguageNodes.Constant.IsStartOfNode(word, scope))
                return DefaultLanguageNodes.Constant.Execute(reader, scope, skipExec);

            throw new SyntaxException(reader, "Not recognized as operation");
        }

        /// <summary>
        /// <see cref="ISyntaxTreeItem.IsStartOfNode(string, IExecutionScope)"/>
        /// </summary>
        public bool IsStartOfNode(string word, IExecutionScope scope)
        {
            return DefaultLanguageNodes.Call.IsStartOfNode(word, scope) ||
                DefaultLanguageNodes.Variable.IsStartOfNode(word, scope) ||
                DefaultLanguageNodes.Constant.IsStartOfNode(word, scope);
        }<commit_msg>Added Assignation in operation logic<commit_after>﻿using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;

namespace HCEngine.Default.Language
{
    /// <summary>
    /// Base class for Operation item
    /// </summary>
    public class Operation : ISyntaxTreeItem
    {
        /// <summary>
        /// <see cref="ISyntaxTreeItem.Execute(ISourceReader, IExecutionScope, bool)"/>
        /// </summary>
        public IScriptExecution Execute(ISourceReader reader, IExecutionScope scope, bool skipExec)
        {
            string word = reader.LastKeyword;

            if (DefaultLanguageNodes.Assignation.IsStartOfNode(word, scope))
                return DefaultLanguageNodes.Assignation.Execute(reader, scope, skipExec);

            if (DefaultLanguageNodes.Call.IsStartOfNode(word, scope))
                return DefaultLanguageNodes.Call.Execute(reader, scope, skipExec);

            if (DefaultLanguageNodes.Variable.IsStartOfNode(word, scope))
                return DefaultLanguageNodes.Variable.Execute(reader, scope, skipExec);
            
            if (DefaultLanguageNodes.Constant.IsStartOfNode(word, scope))
                return DefaultLanguageNodes.Constant.Execute(reader, scope, skipExec);

            throw new SyntaxException(reader, "Not recognized as operation");
        }

        /// <summary>
        /// <see cref="ISyntaxTreeItem.IsStartOfNode(string, IExecutionScope)"/>
        /// </summary>
        public bool IsStartOfNode(string word, IExecutionScope scope)
        {
            return DefaultLanguageNodes.Call.IsStartOfNode(word, scope) ||
                DefaultLanguageNodes.Variable.IsStartOfNode(word, scope) ||
                DefaultLanguageNodes.Constant.IsStartOfNode(word, scope);
        }
{'fraction_non_alphanumeric': 0.10041592394533572, 'fraction_numerical': 0.0, 'mean_word_length': 2.636069114470842, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '1369234', 'n_tokens_mistral': 862, 'n_tokens_neox': 842, 'n_words': 179}