mirror of
https://github.com/Ed94/gencpp.git
synced 2024-11-12 20:04:52 -08:00
Ed_
050b00f28a
Adding the pragma once and includes the files broke compilation, still diagnosing why. - Some string functions were moved to the cpp, still need to do some more evaluation of it and the containers... - Added support for forceinline and neverinline to parsing (untested) - Added support for specifiers in operator cast such as explicit, inline/forceinline/neverinline, etc. - Before it only support const. - Still need to support volatile. - Forceinline was not supported at all for tokenization, fixed that.
80 lines
2.0 KiB
C++
80 lines
2.0 KiB
C++
#pragma once
|
|
|
|
// This is the non-bootstraped version of the EOperator. This will be obsolete once bootstrap is stress tested.
|
|
|
|
namespace EOperator
|
|
{
|
|
# define Define_Operators \
|
|
Entry( Invalid, INVALID ) \
|
|
Entry( Assign, = ) \
|
|
Entry( Assign_Add, += ) \
|
|
Entry( Assign_Subtract, -= ) \
|
|
Entry( Assign_Multiply, *= ) \
|
|
Entry( Assign_Divide, /= ) \
|
|
Entry( Assign_Modulo, %= ) \
|
|
Entry( Assign_BAnd, &= ) \
|
|
Entry( Assign_BOr, |= ) \
|
|
Entry( Assign_BXOr, ^= ) \
|
|
Entry( Assign_LShift, <<= ) \
|
|
Entry( Assign_RShift, >>= ) \
|
|
Entry( Increment, ++ ) \
|
|
Entry( Decrement, -- ) \
|
|
Entry( Unary_Plus, + ) \
|
|
Entry( Unary_Minus, - ) \
|
|
Entry( UnaryNot, ! ) \
|
|
Entry( Add, + ) \
|
|
Entry( Subtract, - ) \
|
|
Entry( Multiply, * ) \
|
|
Entry( Divide, / ) \
|
|
Entry( Modulo, % ) \
|
|
Entry( BNot, ~ ) \
|
|
Entry( BAnd, & ) \
|
|
Entry( BOr, | ) \
|
|
Entry( BXOr, ^ ) \
|
|
Entry( LShift, << ) \
|
|
Entry( RShift, >> ) \
|
|
Entry( LAnd, && ) \
|
|
Entry( LOr, || ) \
|
|
Entry( LEqual, == ) \
|
|
Entry( LNot, != ) \
|
|
Entry( Lesser, < ) \
|
|
Entry( Greater, > ) \
|
|
Entry( LesserEqual, <= ) \
|
|
Entry( GreaterEqual, >= ) \
|
|
Entry( Subscript, [] ) \
|
|
Entry( Indirection, * ) \
|
|
Entry( AddressOf, & ) \
|
|
Entry( MemberOfPointer, -> ) \
|
|
Entry( PtrToMemOfPtr, ->* ) \
|
|
Entry( FunctionCall, () )
|
|
|
|
enum Type : u32
|
|
{
|
|
# define Entry( Type_, Token_ ) Type_,
|
|
Define_Operators
|
|
# undef Entry
|
|
Comma,
|
|
|
|
Num_Ops,
|
|
};
|
|
|
|
inline
|
|
StrC to_str( Type op )
|
|
{
|
|
local_persist
|
|
StrC lookup[ Num_Ops ] = {
|
|
# define Entry( Type_, Token_ ) { sizeof(stringize(Token_)), stringize(Token_) },
|
|
Define_Operators
|
|
# undef Entry
|
|
txt(",")
|
|
};
|
|
|
|
return lookup[ op ];
|
|
}
|
|
|
|
# undef Define_Operators
|
|
}
|
|
using OperatorT = EOperator::Type;
|
|
using EOperator::to_str;
|
|
|