Fix for wrong tokens for GNU/MSVC attribute captures (parse_attributes)

Also a fix for a typo in the readme...
This commit is contained in:
Edward R. Gonzalez 2023-08-08 15:35:06 -04:00
parent c7647ab00f
commit 67d02c1f62
4 changed files with 13 additions and 11 deletions

View File

@ -6,7 +6,7 @@ The library API is a composition of code element constructors.
These build up a code AST to then serialize with a file builder.
This code base attempts follow the [handmade philosophy](https://handmade.network/manifesto),
its not meant to be a black box metaprogramming utility, it should be easy to intergrate into a user's their project domain.
its not meant to be a black box metaprogramming utility, it should be easy to intergrate into a user's project domain.
## Notes

View File

@ -1428,16 +1428,16 @@ CodeAttributes parse_attributes()
else if ( check(TokType::Decl_GNU_Attribute) )
{
eat(TokType::BraceCurly_Open);
eat(TokType::BraceCurly_Open);
eat(TokType::Capture_Start);
eat(TokType::Capture_Start);
while ( left && currtok.Type != TokType::BraceCurly_Close )
while ( left && currtok.Type != TokType::Capture_End )
{
eat(currtok.Type);
}
eat(TokType::BraceCurly_Close);
eat(TokType::BraceCurly_Close);
eat(TokType::Capture_End);
eat(TokType::Capture_End);
s32 len = ( (sptr)prevtok.Text + prevtok.Length ) - (sptr)start.Text;
}
@ -1445,14 +1445,14 @@ CodeAttributes parse_attributes()
else if ( check(TokType::Decl_MSVC_Attribute) )
{
eat( TokType::Decl_MSVC_Attribute );
eat( TokType::BraceCurly_Open);
eat( TokType::Capture_Start);
while ( left && currtok.Type != TokType::BraceCurly_Close )
while ( left && currtok.Type != TokType::Capture_End )
{
eat(currtok.Type);
}
eat(TokType::BraceCurly_Close);
eat(TokType::Capture_End);
s32 len = ( (sptr)prevtok.Text + prevtok.Length ) - (sptr)start.Text;
}

View File

@ -118,6 +118,7 @@ void check_SOA()
{
log_fmt("\ncheck_SOA:");
gen::init();
Builder soa_test = Builder::open( "SOA.gen.hpp" );
soa_test.print( parse_using( code(
@ -136,6 +137,7 @@ void check_SOA()
u64 D;
};
))
, 100
));
soa_test.write();

View File

@ -18,7 +18,7 @@ int gen_main()
check_SOA();
check_singleheader_ast();
// check_singleheader_ast();
return 0;
}