gencpp/base/components/gen/eoperator.hpp

119 lines
3.1 KiB
C++
Raw Permalink Normal View History

#ifdef GEN_INTELLISENSE_DIRECTIVES
#pragma once
#include "components/types.hpp"
#endif
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
2023-08-21 22:51:59 -07:00
enum Operator : u32
2024-12-03 10:51:29 -08:00
{
2024-12-07 14:17:02 -08:00
Op_Invalid,
Op_Assign,
Op_Assign_Add,
Op_Assign_Subtract,
Op_Assign_Multiply,
Op_Assign_Divide,
Op_Assign_Modulo,
Op_Assign_BAnd,
Op_Assign_BOr,
Op_Assign_BXOr,
Op_Assign_LShift,
Op_Assign_RShift,
Op_Increment,
Op_Decrement,
Op_Unary_Plus,
Op_Unary_Minus,
Op_UnaryNot,
Op_Add,
Op_Subtract,
Op_Multiply,
Op_Divide,
Op_Modulo,
Op_BNot,
Op_BAnd,
Op_BOr,
Op_BXOr,
Op_LShift,
Op_RShift,
Op_LAnd,
Op_LOr,
Op_LEqual,
Op_LNot,
Op_Lesser,
Op_Greater,
Op_LesserEqual,
Op_GreaterEqual,
Op_Subscript,
Op_Indirection,
Op_AddressOf,
Op_MemberOfPointer,
Op_PtrToMemOfPtr,
Op_FunctionCall,
Op_Comma,
Op_New,
Op_NewArray,
Op_Delete,
Op_DeleteArray,
Op_NumOps,
Op_UnderlyingType = 0xffffffffu
};
2024-12-07 14:17:02 -08:00
inline Str operator_to_str( Operator op )
{
local_persist Str lookup[47] = {
{ "INVALID", sizeof( "INVALID" ) - 1 },
{ "=", sizeof( "=" ) - 1 },
{ "+=", sizeof( "+=" ) - 1 },
{ "-=", sizeof( "-=" ) - 1 },
{ "*=", sizeof( "*=" ) - 1 },
{ "/=", sizeof( "/=" ) - 1 },
{ "%=", sizeof( "%=" ) - 1 },
{ "&=", sizeof( "&=" ) - 1 },
{ "|=", sizeof( "|=" ) - 1 },
{ "^=", sizeof( "^=" ) - 1 },
{ "<<=", sizeof( "<<=" ) - 1 },
{ ">>=", sizeof( ">>=" ) - 1 },
{ "++", sizeof( "++" ) - 1 },
{ "--", sizeof( "--" ) - 1 },
{ "+", sizeof( "+" ) - 1 },
{ "-", sizeof( "-" ) - 1 },
{ "!", sizeof( "!" ) - 1 },
{ "+", sizeof( "+" ) - 1 },
{ "-", sizeof( "-" ) - 1 },
{ "*", sizeof( "*" ) - 1 },
{ "/", sizeof( "/" ) - 1 },
{ "%", sizeof( "%" ) - 1 },
{ "~", sizeof( "~" ) - 1 },
{ "&", sizeof( "&" ) - 1 },
{ "|", sizeof( "|" ) - 1 },
{ "^", sizeof( "^" ) - 1 },
{ "<<", sizeof( "<<" ) - 1 },
{ ">>", sizeof( ">>" ) - 1 },
{ "&&", sizeof( "&&" ) - 1 },
{ "||", sizeof( "||" ) - 1 },
{ "==", sizeof( "==" ) - 1 },
{ "!=", sizeof( "!=" ) - 1 },
{ "<", sizeof( "<" ) - 1 },
{ ">", sizeof( ">" ) - 1 },
{ "<=", sizeof( "<=" ) - 1 },
{ ">=", sizeof( ">=" ) - 1 },
{ "[]", sizeof( "[]" ) - 1 },
{ "*", sizeof( "*" ) - 1 },
{ "&", sizeof( "&" ) - 1 },
{ "->", sizeof( "->" ) - 1 },
{ "->*", sizeof( "->*" ) - 1 },
{ "()", sizeof( "()" ) - 1 },
{ ",", sizeof( "," ) - 1 },
{ "new", sizeof( "new" ) - 1 },
{ "new[]", sizeof( "new[]" ) - 1 },
{ "delete", sizeof( "delete" ) - 1 },
{ "delete[]", sizeof( "delete[]" ) - 1 },
2024-12-07 14:17:02 -08:00
};
return lookup[op];
2024-12-03 10:51:29 -08:00
}
forceinline Str to_str( Operator op )
2024-12-07 14:17:02 -08:00
{
return operator_to_str( op );
}