diff --git a/Project/Source/GasaGen/GasaGen.cpp b/Project/Source/GasaGen/GasaGen.cpp index 3b73540..b20adc1 100644 --- a/Project/Source/GasaGen/GasaGen.cpp +++ b/Project/Source/GasaGen/GasaGen.cpp @@ -54,6 +54,9 @@ int gen_main() PreprocessorDefines.append( get_cached_string(str_DECLARE_MULTICAST_DELEGATE_OneParam)); PreprocessorDefines.append( get_cached_string(str_DECLARE_MULTICAST_DELEGATE_ThreeParams)); PreprocessorDefines.append( get_cached_string(str_DECLARE_MULTICAST_DELEGATE_TwoParams)); + PreprocessorDefines.append( get_cached_string(str_DECLARE_TS_MULTICAST_DELEGATE_OneParam)); + PreprocessorDefines.append( get_cached_string(str_DECLARE_TS_MULTICAST_DELEGATE_TwoParams)); + PreprocessorDefines.append( get_cached_string(str_DECLARE_TS_MULTICAST_DELEGATE_ThreeParams)); PreprocessorDefines.append( get_cached_string(str_DEFINE_ACTORDESC_TYPE)); PreprocessorDefines.append( get_cached_string(str_DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL)); PreprocessorDefines.append( get_cached_string(str_ENUM_CLASS_FLAGS)); @@ -76,6 +79,7 @@ int gen_main() PreprocessorDefines.append( get_cached_string(str_UPARAM)); PreprocessorDefines.append( get_cached_string(str_UPROPERTY)); PreprocessorDefines.append( get_cached_string(str_USTRUCT)); + PreprocessorDefines.append( get_cached_string(str_UE_REQUIRES)); } gen_UGasaAttributeSet(); @@ -84,9 +88,9 @@ int gen_main() // gen_netslime_interfaces(); // One offs - if (0) + if (1) { - ue_parse_testing(); + // ue_parse_testing(); swap_SBlueprintActionMenu_Construct(); } return 0; diff --git a/Project/Source/GasaGen/GasaGenCommon.cpp b/Project/Source/GasaGen/GasaGenCommon.cpp index b2e8d3a..652db9f 100644 --- a/Project/Source/GasaGen/GasaGenCommon.cpp +++ b/Project/Source/GasaGen/GasaGenCommon.cpp @@ -36,6 +36,9 @@ constexpr StrC str_DECLARE_LOG_CATEGORY_EXTERN = txt(" constexpr StrC str_DECLARE_MULTICAST_DELEGATE_OneParam = txt("DECLARE_MULTICAST_DELEGATE_OneParam("); constexpr StrC str_DECLARE_MULTICAST_DELEGATE_ThreeParams = txt("DECLARE_MULTICAST_DELEGATE_ThreeParams("); constexpr StrC str_DECLARE_MULTICAST_DELEGATE_TwoParams = txt("DECLARE_MULTICAST_DELEGATE_TwoParams("); +constexpr StrC str_DECLARE_TS_MULTICAST_DELEGATE_OneParam = txt("DECLARE_TS_MULTICAST_DELEGATE_OneParam("); +constexpr StrC str_DECLARE_TS_MULTICAST_DELEGATE_TwoParams = txt("DECLARE_TS_MULTICAST_DELEGATE_TwoParams("); +constexpr StrC str_DECLARE_TS_MULTICAST_DELEGATE_ThreeParams = txt("DECLARE_TS_MULTICAST_DELEGATE_ThreeParams("); constexpr StrC str_DEFINE_ACTORDESC_TYPE = txt("DEFINE_ACTORDESC_TYPE("); constexpr StrC str_DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL = txt("DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL("); constexpr StrC str_ENUM_CLASS_FLAGS = txt("ENUM_CLASS_FLAGS("); @@ -58,6 +61,7 @@ constexpr StrC str_UMETA = txt(" constexpr StrC str_UPARAM = txt("UPARAM("); constexpr StrC str_UPROPERTY = txt("UPROPERTY("); constexpr StrC str_USTRUCT = txt("USTRUCT("); +constexpr StrC str_UE_REQUIRES = txt("UE_REQUIRES("); constexpr StrC str_GASA_API = txt("GASA_API"); diff --git a/Project/Source/GasaGen/gen.cpp b/Project/Source/GasaGen/gen.cpp index e610387..d28b2a3 100644 --- a/Project/Source/GasaGen/gen.cpp +++ b/Project/Source/GasaGen/gen.cpp @@ -2314,6 +2314,11 @@ void CodeParam::to_string( String& result ) else if ( ast->ValueType ) result.append_fmt( " %S", ast->ValueType.to_string() ); + if ( ast->PostNameMacro ) + { + result.append_fmt(" %S", ast->PostNameMacro.to_string() ); + } + if ( ast->Value ) result.append_fmt( " = %S", ast->Value.to_string() ); @@ -9708,10 +9713,11 @@ namespace parser return { nullptr }; } - Code macro = { nullptr }; - CodeType type = { nullptr }; - Code value = { nullptr }; - Token name = NullToken; + Code macro = { nullptr }; + CodeType type = { nullptr }; + Code value = { nullptr }; + Token name = NullToken; + Code post_name_macro = { nullptr }; if ( check( TokType::Varadic_Argument ) ) { @@ -9752,6 +9758,15 @@ namespace parser // ( } + // Unreal has yet another type of macro: + // template::Value)> + // class T ... and then ^this^ UE_REQUIRES shows up + // So we need to consume that. + if ( check( TokType::Preprocess_Macro )) + { + post_name_macro = parse_simple_preprocess( ETokType::Preprocess_Macro ); + } + // In template captures you can have a typename have direct assignment without a name // typename = typename ... // Which would result in a static value type from a struct expansion (traditionally) @@ -9855,6 +9870,15 @@ namespace parser // ( = , } + // Unreal has yet another type of macro: + // template::Value)> + // class T ... and then ^this^ UE_REQUIRES shows up + // So we need to consume that. + if ( check( TokType::Preprocess_Macro )) + { + post_name_macro = parse_simple_preprocess( ETokType::Preprocess_Macro ); + } + // In template captures you can have a typename have direct assignment without a name // typename = typename ... // Which would result in a static value type from a struct expansion (traditionally) diff --git a/Project/Source/GasaGen/gen.hpp b/Project/Source/GasaGen/gen.hpp index 26fa9b1..5307239 100644 --- a/Project/Source/GasaGen/gen.hpp +++ b/Project/Source/GasaGen/gen.hpp @@ -830,7 +830,7 @@ struct AST union { AST* ArrExpr; // Typename - AST* Body; // Class, Constructr, Destructor, Enum, Friend, Function, Namespace, Struct, Union + AST* Body; // Class, Constructor, Destructor, Enum, Friend, Function, Namespace, Struct, Union AST* Declaration; // Friend, Template AST* Value; // Parameter, Variable }; @@ -840,6 +840,7 @@ struct AST AST* NextVar; // Variable; Possible way to handle comma separated variables declarations. ( , NextVar->Specs NextVar->Name NextVar->ArrExpr = // NextVar->Value ) AST* SuffixSpecs; // Only used with typenames, to store the function suffix if typename is function signature. ( May not be needed ) + AST* PostNameMacro; // Only used with parameters for specifically UE_REQUIRES (Thanks Unreal) }; }; @@ -921,6 +922,7 @@ struct AST_POD AST* NextVar; // Variable; Possible way to handle comma separated variables declarations. ( , NextVar->Specs NextVar->Name NextVar->ArrExpr = // NextVar->Value ) AST* SuffixSpecs; // Only used with typenames, to store the function suffix if typename is function signature. ( May not be needed ) + AST* PostNameMacro; // Only used with parameters for specifically UE_REQUIRES (Thanks Unreal) }; }; @@ -2630,7 +2632,8 @@ struct AST_Param CodeType ValueType; Code Macro; Code Value; - char _PAD_PROPERTIES_3_[sizeof( AST* )]; + Code PostNameMacro; // Thanks Unreal + // char _PAD_PROPERTIES_3_[sizeof( AST* )]; }; };