mirror of
https://github.com/Ed94/gencpp.git
synced 2024-11-10 02:54:53 -08:00
Should support parsing full definitions within typedef... (need to make tests)
This commit is contained in:
parent
80b5c9768d
commit
5df21998ef
@ -691,7 +691,6 @@ Names or Content fields are interned strings and thus showed be cached using `ge
|
||||
|
||||
# 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.
|
||||
* Trailing specifiers ( postfix ) for functions (const, override, final)
|
||||
* Make a more robust test suite.
|
||||
|
@ -2530,12 +2530,27 @@ CodeType def_type( StrC name, Code arrayexpr, CodeSpecifier specifiers, CodeAttr
|
||||
|
||||
CodeTypedef def_typedef( StrC name, Code type, CodeAttributes attributes, ModuleFlag mflags )
|
||||
{
|
||||
using namespace ECode;
|
||||
|
||||
name_check( def_typedef, name );
|
||||
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:
|
||||
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;
|
||||
}
|
||||
|
||||
@ -6116,8 +6131,11 @@ CodeTypedef parse_typedef( Parser::TokArray& toks, char const* context )
|
||||
if ( check( TokType::Decl_Enum ) )
|
||||
type = parse_enum( toks, context );
|
||||
|
||||
else if ( check(TokType::Decl_Class ) )
|
||||
type = parse_class( toks, context );
|
||||
|
||||
else if ( check(TokType::Decl_Struct ) )
|
||||
type = parse_enum( toks, context );
|
||||
type = parse_struct( toks, context );
|
||||
|
||||
else if ( check(TokType::Decl_Union) )
|
||||
type = parse_union( toks, context );
|
||||
|
Loading…
Reference in New Issue
Block a user