<commit_before>/**
 * Zillians MMO
 * Copyright (C) 2007-2010 Zillians.com, Inc.
 * For more information see http://www.zillians.com
 *
 * Zillians MMO is the library and runtime for massive multiplayer online game
 * development in utility computing model, which runs as a service for every
 * developer to build their virtual world running on our GPU-assisted machines.
 *
 * This is a close source library intended to be used solely within Zillians.com
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
/**
 * @date Aug 5, 2011 sdk - Initial version created.
 */

#ifndef ZILLIANS_LANGUAGE_TREE_BINARYEXPR_H_
#define ZILLIANS_LANGUAGE_TREE_BINARYEXPR_H_

#include "language/tree/expression/Expression.h"

namespace zillians { namespace language { namespace tree {

struct BinaryExpr : public Expression
{
	friend class boost::serialization::access;

	DEFINE_VISITABLE();
	DEFINE_HIERARCHY(BinaryExpr, (BinaryExpr)(Expression)(ASTNode));

	struct OpCode
	{
		enum type {
			ASSIGN, RSHIFT_ASSIGN, LSHIFT_ASSIGN, ARITHMETIC_RSHIFT_ASSIGN, ADD_ASSIGN, SUB_ASSIGN, MUL_ASSIGN, DIV_ASSIGN, MOD_ASSIGN, AND_ASSIGN, OR_ASSIGN, XOR_ASSIGN,
			ARITHMETIC_ADD, ARITHMETIC_SUB, ARITHMETIC_MUL, ARITHMETIC_DIV, ARITHMETIC_MOD, ARITHMETIC_RSHIFT,
			BINARY_AND, BINARY_OR, BINARY_XOR, BINARY_LSHIFT, BINARY_RSHIFT,
			LOGICAL_AND, LOGICAL_OR,
			INSTANCEOF,
			COMPARE_EQ, COMPARE_NE, COMPARE_GT, COMPARE_LT, COMPARE_GE, COMPARE_LE,
			RANGE_ELLIPSIS,
			ARRAY_SUBSCRIPT,
			INVALID,
		};
		static const wchar_t* toString(type op)
		{
			switch(op)
			{
			case ASSIGN: return L"=";
			case RSHIFT_ASSIGN: return L">>=";
			case LSHIFT_ASSIGN: return L"<<=";
			case ARITHMETIC_RSHIFT_ASSIGN: return L">>>=";
			case ADD_ASSIGN: return L"+=";
			case SUB_ASSIGN: return L"-=";
			case MUL_ASSIGN: return L"*=";
			case DIV_ASSIGN: return L"/=";
			case MOD_ASSIGN: return L"%=";
			case AND_ASSIGN: return L"&=";
			case OR_ASSIGN: return L"|=";
			case XOR_ASSIGN: return L"^=";
			case ARITHMETIC_ADD: return L"+";
			case ARITHMETIC_SUB: return L"-";
			case ARITHMETIC_MUL: return L"*";
			case ARITHMETIC_DIV: return L"/";
			case ARITHMETIC_MOD: return L"%";
			case ARITHMETIC_RSHIFT: return L">>>";
			case BINARY_AND: return L"&";
			case BINARY_OR: return L"|";
			case BINARY_XOR: return L"^";
			case BINARY_LSHIFT: return L"<<";
			case BINARY_RSHIFT: return L">>";
			case LOGICAL_AND: return L"&&";
			case LOGICAL_OR: return L"||";
			case INSTANCEOF: return L"instanceof";
			case COMPARE_EQ: return L"==";
			case COMPARE_NE: return L"!=";
			case COMPARE_GT: return L">";
			case COMPARE_LT: return L"<";
			case COMPARE_GE: return L">=";
			case COMPARE_LE: return L"<=";
			case RANGE_ELLIPSIS: return L"...";
			case ARRAY_SUBSCRIPT: return L"[]";
			case INVALID: return L"invalid";
			default: break;
			}
			BOOST_ASSERT(false && "reaching unreachable code");
			return NULL;
		}

		static type decomposeAssignment(type t)
		{
			switch(t)
			{
			case ARITHMETIC_RSHIFT_ASSIGN: return ARITHMETIC_RSHIFT;
			case ADD_ASSIGN: return ARITHMETIC_ADD;
			case SUB_ASSIGN: return ARITHMETIC_SUB;
			case MUL_ASSIGN: return ARITHMETIC_MUL;
			case DIV_ASSIGN: return ARITHMETIC_DIV;
			case MOD_ASSIGN: return ARITHMETIC_MOD;
			case AND_ASSIGN: return BINARY_AND;
			case OR_ASSIGN:  return BINARY_OR;
			case XOR_ASSIGN: return BINARY_XOR;
			default: break;<commit_msg>bug fix for BinaryExpr::OpCode::decomposeAssignment<commit_after>/**
 * Zillians MMO
 * Copyright (C) 2007-2010 Zillians.com, Inc.
 * For more information see http://www.zillians.com
 *
 * Zillians MMO is the library and runtime for massive multiplayer online game
 * development in utility computing model, which runs as a service for every
 * developer to build their virtual world running on our GPU-assisted machines.
 *
 * This is a close source library intended to be used solely within Zillians.com
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
/**
 * @date Aug 5, 2011 sdk - Initial version created.
 */

#ifndef ZILLIANS_LANGUAGE_TREE_BINARYEXPR_H_
#define ZILLIANS_LANGUAGE_TREE_BINARYEXPR_H_

#include "language/tree/expression/Expression.h"

namespace zillians { namespace language { namespace tree {

struct BinaryExpr : public Expression
{
	friend class boost::serialization::access;

	DEFINE_VISITABLE();
	DEFINE_HIERARCHY(BinaryExpr, (BinaryExpr)(Expression)(ASTNode));

	struct OpCode
	{
		enum type {
			ASSIGN, LSHIFT_ASSIGN, RSHIFT_ASSIGN, ARITHMETIC_RSHIFT_ASSIGN, ADD_ASSIGN, SUB_ASSIGN, MUL_ASSIGN, DIV_ASSIGN, MOD_ASSIGN, AND_ASSIGN, OR_ASSIGN, XOR_ASSIGN,
			ARITHMETIC_ADD, ARITHMETIC_SUB, ARITHMETIC_MUL, ARITHMETIC_DIV, ARITHMETIC_MOD, ARITHMETIC_RSHIFT,
			BINARY_AND, BINARY_OR, BINARY_XOR, BINARY_LSHIFT, BINARY_RSHIFT,
			LOGICAL_AND, LOGICAL_OR,
			INSTANCEOF,
			COMPARE_EQ, COMPARE_NE, COMPARE_GT, COMPARE_LT, COMPARE_GE, COMPARE_LE,
			RANGE_ELLIPSIS,
			ARRAY_SUBSCRIPT,
			INVALID,
		};
		static const wchar_t* toString(type op)
		{
			switch(op)
			{
			case ASSIGN: return L"=";
			case LSHIFT_ASSIGN: return L"<<=";
			case RSHIFT_ASSIGN: return L">>=";
			case ARITHMETIC_RSHIFT_ASSIGN: return L">>>=";
			case ADD_ASSIGN: return L"+=";
			case SUB_ASSIGN: return L"-=";
			case MUL_ASSIGN: return L"*=";
			case DIV_ASSIGN: return L"/=";
			case MOD_ASSIGN: return L"%=";
			case AND_ASSIGN: return L"&=";
			case OR_ASSIGN: return L"|=";
			case XOR_ASSIGN: return L"^=";
			case ARITHMETIC_ADD: return L"+";
			case ARITHMETIC_SUB: return L"-";
			case ARITHMETIC_MUL: return L"*";
			case ARITHMETIC_DIV: return L"/";
			case ARITHMETIC_MOD: return L"%";
			case ARITHMETIC_RSHIFT: return L">>>";
			case BINARY_AND: return L"&";
			case BINARY_OR: return L"|";
			case BINARY_XOR: return L"^";
			case BINARY_LSHIFT: return L"<<";
			case BINARY_RSHIFT: return L">>";
			case LOGICAL_AND: return L"&&";
			case LOGICAL_OR: return L"||";
			case INSTANCEOF: return L"instanceof";
			case COMPARE_EQ: return L"==";
			case COMPARE_NE: return L"!=";
			case COMPARE_GT: return L">";
			case COMPARE_LT: return L"<";
			case COMPARE_GE: return L">=";
			case COMPARE_LE: return L"<=";
			case RANGE_ELLIPSIS: return L"...";
			case ARRAY_SUBSCRIPT: return L"[]";
			case INVALID: return L"invalid";
			default: break;
			}
			BOOST_ASSERT(false && "reaching unreachable code");
			return NULL;
		}

		static type decomposeAssignment(type t)
		{
			switch(t)
			{
			case ARITHMETIC_RSHIFT_ASSIGN: return ARITHMETIC_RSHIFT;
			case ADD_ASSIGN: return ARITHMETIC_ADD;
			case SUB_ASSIGN: return ARITHMETIC_SUB;
			case MUL_ASSIGN: return ARITHMETIC_MUL;
			case DIV_ASSIGN: return ARITHMETIC_DIV;
			case MOD_ASSIGN: return ARITHMETIC_MOD;
			case AND_ASSIGN: return BINARY_AND;
			case OR_ASSIGN:  return BINARY_OR;
			case XOR_ASSIGN: return BINARY_XOR;
			case RSHIFT_ASSIGN: return BINARY_RSHIFT;
			case LSHIFT_ASSIGN: return BINARY_LSHIFT;
			default: break;
{'fraction_non_alphanumeric': 0.09943181818181818, 'fraction_numerical': 0.0033574380165289257, 'mean_word_length': 4.485127478753541, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6262249', 'n_tokens_mistral': 3120, 'n_tokens_neox': 2738, 'n_words': 812}