mirror of
				https://github.com/Ed94/gencpp.git
				synced 2025-10-30 22:40:54 -07:00 
			
		
		
		
	Should support parsing full definitions within typedef... (need to make tests)
This commit is contained in:
		| @@ -691,7 +691,6 @@ Names or Content fields are interned strings and thus showed be cached using `ge | |||||||
|  |  | ||||||
| # TODO | # TODO | ||||||
|  |  | ||||||
| * Support defining & parsing full definitions inside a typedef. (For C patterns) |  | ||||||
| * Implement a context stack for the parsing, allows for accurate scope validation for the AST types. | * Implement a context stack for the parsing, allows for accurate scope validation for the AST types. | ||||||
| * Trailing specifiers ( postfix ) for functions (const, override, final) | * Trailing specifiers ( postfix ) for functions (const, override, final) | ||||||
| * Make a more robust test suite. | * Make a more robust test suite. | ||||||
|   | |||||||
| @@ -2530,13 +2530,28 @@ CodeType def_type( StrC name, Code arrayexpr, CodeSpecifier specifiers, CodeAttr | |||||||
|  |  | ||||||
| CodeTypedef def_typedef( StrC name, Code type, CodeAttributes attributes, ModuleFlag mflags ) | CodeTypedef def_typedef( StrC name, Code type, CodeAttributes attributes, ModuleFlag mflags ) | ||||||
| { | { | ||||||
|  | 	using namespace ECode; | ||||||
|  |  | ||||||
| 	name_check( def_typedef, name ); | 	name_check( def_typedef, name ); | ||||||
| 	null_check( def_typedef, type ); | 	null_check( def_typedef, type ); | ||||||
|  |  | ||||||
| 	if ( type->Type != ECode::Typename ) | 	switch ( type->Type ) | ||||||
| 	{ | 	{ | ||||||
| 		log_failure( "gen::def_typedef: type was not a Typename - %s", type.debug_str() ); | 		case Class: | ||||||
| 		return CodeInvalid; | 		case Class_Fwd: | ||||||
|  | 		case Enum: | ||||||
|  | 		case Enum_Fwd: | ||||||
|  | 		case Enum_Class: | ||||||
|  | 		case Enum_Class_Fwd: | ||||||
|  | 		case Function_Fwd: | ||||||
|  | 		case Struct: | ||||||
|  | 		case Struct_Fwd: | ||||||
|  | 		case Union: | ||||||
|  | 		case Typename: | ||||||
|  | 			break; | ||||||
|  | 		default: | ||||||
|  | 			log_failure( "gen::def_typedef: type was not a Class, Enum, Function Forward, Struct, Typename, or Union - %s", type.debug_str() ); | ||||||
|  | 			return CodeInvalid; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if ( attributes && attributes->Type != ECode::PlatformAttributes ) | 	if ( attributes && attributes->Type != ECode::PlatformAttributes ) | ||||||
| @@ -6116,8 +6131,11 @@ CodeTypedef parse_typedef( Parser::TokArray& toks, char const* context ) | |||||||
| 	if ( check( TokType::Decl_Enum ) ) | 	if ( check( TokType::Decl_Enum ) ) | ||||||
| 		type = parse_enum( toks, context ); | 		type = parse_enum( toks, context ); | ||||||
|  |  | ||||||
|  | 	else if ( check(TokType::Decl_Class ) ) | ||||||
|  | 		type = parse_class( toks, context ); | ||||||
|  |  | ||||||
| 	else if ( check(TokType::Decl_Struct ) ) | 	else if ( check(TokType::Decl_Struct ) ) | ||||||
| 		type = parse_enum( toks, context ); | 		type = parse_struct( toks, context ); | ||||||
|  |  | ||||||
| 	else if ( check(TokType::Decl_Union) ) | 	else if ( check(TokType::Decl_Union) ) | ||||||
| 		type = parse_union( toks, context ); | 		type = parse_union( toks, context ); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user