pregress on fixing regressions with unreal parsing

https://github.com/Ed94/gencpp/issues/64 is required. Resolving it next
This commit is contained in:
2024-12-14 11:24:21 -05:00
parent 683f13deab
commit 3c249d2fae
16 changed files with 439 additions and 161 deletions

View File

@ -0,0 +1,108 @@
// These macros are used in the swtich cases within parser.cpp
#define GEN_PARSER_CLASS_STRUCT_BODY_ALLOWED_MEMBER_TOK_SPECIFIERS_CASES \
case Tok_Spec_Consteval: \
case Tok_Spec_Constexpr: \
case Tok_Spec_Constinit: \
case Tok_Spec_Explicit: \
case Tok_Spec_ForceInline: \
case Tok_Spec_ForceInline_Debuggable: \
case Tok_Spec_Inline: \
case Tok_Spec_Mutable: \
case Tok_Spec_NeverInline: \
case Tok_Spec_Static: \
case Tok_Spec_Volatile: \
case Tok_Spec_Virtual
#define GEN_PARSER_CLASS_STRUCT_BODY_ALLOWED_MEMBER_SPECIFIERS_CASES \
case Spec_Constexpr: \
case Spec_Constinit: \
case Spec_Explicit: \
case Spec_Inline: \
case Spec_ForceInline: \
case Spec_ForceInline_Debuggable: \
case Spec_Mutable: \
case Spec_NeverInline: \
case Spec_Static: \
case Spec_Volatile: \
case Spec_Virtual
#define GEN_PARSER_CLASS_GLOBAL_NSPACE_ALLOWED_MEMBER_TOK_SPECIFIERS_CASES \
case Tok_Spec_Consteval: \
case Tok_Spec_Constexpr: \
case Tok_Spec_Constinit: \
case Tok_Spec_Extern: \
case Tok_Spec_ForceInline: \
case Tok_Spec_ForceInline_Debuggable: \
case Tok_Spec_Global: \
case Tok_Spec_Inline: \
case Tok_Spec_Internal_Linkage: \
case Tok_Spec_NeverInline: \
case Tok_Spec_Static
#define GEN_PARSER_CLASS_GLOBAL_NSPACE_ALLOWED_MEMBER_SPECIFIERS_CASES \
case Spec_Constexpr: \
case Spec_Constinit: \
case Spec_ForceInline: \
case Spec_ForceInline_Debuggable: \
case Spec_Global: \
case Spec_External_Linkage: \
case Spec_Internal_Linkage: \
case Spec_Inline: \
case Spec_Mutable: \
case Spec_NeverInline: \
case Spec_Static: \
case Spec_Volatile
#define GEN_PARSER_FRIEND_ALLOWED_SPECIFIERS_CASES \
case Spec_Const: \
case Spec_Inline: \
case Spec_ForceInline
#define GEN_PARSER_FUNCTION_ALLOWED_SPECIFIERS_CASES \
case Spec_Const: \
case Spec_Consteval: \
case Spec_Constexpr: \
case Spec_External_Linkage: \
case Spec_Internal_Linkage: \
case Spec_ForceInline: \
case Spec_ForceInline_Debuggable: \
case Spec_Inline: \
case Spec_NeverInline: \
case Spec_Static
#define GEN_PARSER_OPERATOR_ALLOWED_SPECIFIERS_CASES \
case Spec_Const: \
case Spec_Constexpr: \
case Spec_ForceInline: \
case Spec_Inline: \
case Spec_NeverInline: \
case Spec_Static
#define GEN_PARSER_TEMPLATE_ALLOWED_SPECIFIERS_CASES \
case Spec_Const: \
case Spec_Constexpr: \
case Spec_Constinit: \
case Spec_External_Linkage: \
case Spec_Global: \
case Spec_Inline: \
case Spec_ForceInline: \
case Spec_ForceInline_Debuggable: \
case Spec_Local_Persist: \
case Spec_Mutable: \
case Spec_Static: \
case Spec_Thread_Local: \
case Spec_Volatile
#define GEN_PARSER_VARIABLE_ALLOWED_SPECIFIER_CASES \
case Spec_Const: \
case Spec_Constexpr: \
case Spec_Constinit: \
case Spec_External_Linkage: \
case Spec_Global: \
case Spec_Inline: \
case Spec_Local_Persist: \
case Spec_Mutable: \
case Spec_Static: \
case Spec_Thread_Local: \
case Spec_Volatile

View File

@ -0,0 +1,27 @@
Invalid, INVALID
Consteval, consteval
Constexpr, constexpr
Constinit, constinit
Explicit, explicit
External_Linkage, extern
ForceInline, FORCEINLINE
ForceInline_Debuggable, FORCEINLINE_DEBUGGABLE
Global, global
Inline, inline
Internal_Linkage, internal
Local_Persist, local_persist
Mutable, mutable
NeverInline, neverinline
Ptr, *
Ref, &
Register, register
RValue, &&
Static, static
Thread_Local, thread_local
Virtual, virtual
Const, const
Final, final
NoExceptions, noexcept
Override, override
Pure, = 0
Volatile, volatile
1 Invalid INVALID
2 Consteval consteval
3 Constexpr constexpr
4 Constinit constinit
5 Explicit explicit
6 External_Linkage extern
7 ForceInline FORCEINLINE
8 ForceInline_Debuggable FORCEINLINE_DEBUGGABLE
9 Global global
10 Inline inline
11 Internal_Linkage internal
12 Local_Persist local_persist
13 Mutable mutable
14 NeverInline neverinline
15 Ptr *
16 Ref &
17 Register register
18 RValue &&
19 Static static
20 Thread_Local thread_local
21 Virtual virtual
22 Const const
23 Final final
24 NoExceptions noexcept
25 Override override
26 Pure = 0
27 Volatile volatile

View File

@ -0,0 +1,96 @@
Invalid, "__invalid__"
Access_Private, "private"
Access_Protected, "protected"
Access_Public, "public"
Access_MemberSymbol, "."
Access_StaticSymbol, "::"
Ampersand, "&"
Ampersand_DBL, "&&"
Assign_Classifer, ":"
Attribute_Open, "[["
Attribute_Close, "]]"
BraceCurly_Open, "{"
BraceCurly_Close, "}"
BraceSquare_Open, "["
BraceSquare_Close, "]"
Capture_Start, "("
Capture_End, ")"
Comment, "__comment__"
Comment_End, "__comment_end__"
Comment_Start, "__comment_start__"
Char, "__character__"
Comma, ","
Decl_Class, "class"
Decl_GNU_Attribute, "__attribute__"
Decl_MSVC_Attribute, "__declspec"
Decl_Enum, "enum"
Decl_Extern_Linkage, "extern"
Decl_Friend, "friend"
Decl_Module, "module"
Decl_Namespace, "namespace"
Decl_Operator, "operator"
Decl_Struct, "struct"
Decl_Template, "template"
Decl_Typedef, "typedef"
Decl_Using, "using"
Decl_Union, "union"
Identifier, "__identifier__"
Module_Import, "import"
Module_Export, "export"
NewLine, "__new_line__"
Number, "__number__"
Operator, "__operator__"
Preprocess_Hash, "#"
Preprocess_Define, "define"
Preprocess_If, "if"
Preprocess_IfDef, "ifdef"
Preprocess_IfNotDef, "ifndef"
Preprocess_ElIf, "elif"
Preprocess_Else, "else"
Preprocess_EndIf, "endif"
Preprocess_Include, "include"
Preprocess_Pragma, "pragma"
Preprocess_Content, "__macro_content__"
Preprocess_Macro, "__macro__"
Preprocess_Unsupported, "__unsupported__"
Spec_Alignas, "alignas"
Spec_Const, "const"
Spec_Consteval, "consteval"
Spec_Constexpr, "constexpr"
Spec_Constinit, "constinit"
Spec_Explicit, "explicit"
Spec_Extern, "extern"
Spec_Final, "final"
Spec_ForceInline, "FORCEINLINE"
Spec_ForceInline_Debuggable, "FORCEINLINE_DEBUGGABLE"
Spec_Global, "global"
Spec_Inline, "inline"
Spec_Internal_Linkage, "internal"
Spec_LocalPersist, "local_persist"
Spec_Mutable, "mutable"
Spec_NeverInline, "neverinline"
Spec_Override, "override"
Spec_Static, "static"
Spec_ThreadLocal, "thread_local"
Spec_Volatile, "volatile"
Spec_Virtual, "virtual"
Star, "*"
Statement_End, ";"
StaticAssert, "static_assert"
String, "__string__"
Type_Typename, "typename"
Type_Unsigned, "unsigned"
Type_Signed, "signed"
Type_Short, "short"
Type_Long, "long"
Type_bool, "bool"
Type_char, "char"
Type_int, "int"
Type_double, "double"
Type_MS_int8, "__int8"
Type_MS_int16, "__int16"
Type_MS_int32, "__int32"
Type_MS_int64, "__int64"
Type_MS_W64, "_W64"
Varadic_Argument, "..."
__Attributes_Start, "__attrib_start__"
1 Invalid __invalid__
2 Access_Private private
3 Access_Protected protected
4 Access_Public public
5 Access_MemberSymbol .
6 Access_StaticSymbol ::
7 Ampersand &
8 Ampersand_DBL &&
9 Assign_Classifer :
10 Attribute_Open [[
11 Attribute_Close ]]
12 BraceCurly_Open {
13 BraceCurly_Close }
14 BraceSquare_Open [
15 BraceSquare_Close ]
16 Capture_Start (
17 Capture_End )
18 Comment __comment__
19 Comment_End __comment_end__
20 Comment_Start __comment_start__
21 Char __character__
22 Comma ,
23 Decl_Class class
24 Decl_GNU_Attribute __attribute__
25 Decl_MSVC_Attribute __declspec
26 Decl_Enum enum
27 Decl_Extern_Linkage extern
28 Decl_Friend friend
29 Decl_Module module
30 Decl_Namespace namespace
31 Decl_Operator operator
32 Decl_Struct struct
33 Decl_Template template
34 Decl_Typedef typedef
35 Decl_Using using
36 Decl_Union union
37 Identifier __identifier__
38 Module_Import import
39 Module_Export export
40 NewLine __new_line__
41 Number __number__
42 Operator __operator__
43 Preprocess_Hash #
44 Preprocess_Define define
45 Preprocess_If if
46 Preprocess_IfDef ifdef
47 Preprocess_IfNotDef ifndef
48 Preprocess_ElIf elif
49 Preprocess_Else else
50 Preprocess_EndIf endif
51 Preprocess_Include include
52 Preprocess_Pragma pragma
53 Preprocess_Content __macro_content__
54 Preprocess_Macro __macro__
55 Preprocess_Unsupported __unsupported__
56 Spec_Alignas alignas
57 Spec_Const const
58 Spec_Consteval consteval
59 Spec_Constexpr constexpr
60 Spec_Constinit constinit
61 Spec_Explicit explicit
62 Spec_Extern extern
63 Spec_Final final
64 Spec_ForceInline FORCEINLINE
65 Spec_ForceInline_Debuggable FORCEINLINE_DEBUGGABLE
66 Spec_Global global
67 Spec_Inline inline
68 Spec_Internal_Linkage internal
69 Spec_LocalPersist local_persist
70 Spec_Mutable mutable
71 Spec_NeverInline neverinline
72 Spec_Override override
73 Spec_Static static
74 Spec_ThreadLocal thread_local
75 Spec_Volatile volatile
76 Spec_Virtual virtual
77 Star *
78 Statement_End ;
79 StaticAssert static_assert
80 String __string__
81 Type_Typename typename
82 Type_Unsigned unsigned
83 Type_Signed signed
84 Type_Short short
85 Type_Long long
86 Type_bool bool
87 Type_char char
88 Type_int int
89 Type_double double
90 Type_MS_int8 __int8
91 Type_MS_int16 __int16
92 Type_MS_int32 __int32
93 Type_MS_int64 __int64
94 Type_MS_W64 _W64
95 Varadic_Argument ...
96 __Attributes_Start __attrib_start__

View File

@ -186,13 +186,13 @@ int gen_main()
CodeBody ecode = gen_ecode ( path_base "enums/ECodeTypes.csv" );
CodeBody eoperator = gen_eoperator ( path_base "enums/EOperator.csv" );
CodeBody especifier = gen_especifier( path_base "enums/ESpecifier.csv" );
CodeBody especifier = gen_especifier( "enums/ESpecifier.csv" );
CodeBody ast_inlines = gen_ast_inlines();
// Note(Ed): The Attribute tokens need to be expanded and regenerated on a per-project/installation of this library for a specific codebase of Unreal.
// We can support an arbitrary set of modules or plugin apis for parsing
// but its up to the user to define them all (This will just provide whats I've used up till now).
CodeBody etoktype = gen_etoktype( path_base "enums/ETokType.csv", "enums/AttributeTokens.csv" );
CodeBody etoktype = gen_etoktype( "enums/ETokType.csv", "enums/AttributeTokens.csv" );
Builder
header = Builder::open( "gen/gen.hpp" );
@ -247,6 +247,7 @@ int gen_main()
Code interface = scan_file( path_base "components/interface.cpp" );
Code upfront = scan_file( path_base "components/interface.upfront.cpp" );
Code lexer = scan_file( path_base "components/lexer.cpp" );
Code parser_case_macros = scan_file( "components/parser_case_macros.cpp" );
Code parser = scan_file( path_base "components/parser.cpp" );
Code parsing_interface = scan_file( path_base "components/interface.parsing.cpp" );
Code untyped = scan_file( path_base "components/interface.untyped.cpp" );
@ -273,6 +274,7 @@ int gen_main()
src.print( upfront );
src.print_fmt( "\n#pragma region Parsing\n\n" );
src.print( lexer );
src.print( parser_case_macros );
src.print( parser );
src.print( parsing_interface );
src.print( untyped );