mirror of
https://github.com/Ed94/gencpp.git
synced 2024-11-10 02:54:53 -08:00
Fixes for test generation (sanity, soa).
This commit is contained in:
parent
108b16739f
commit
f09bb99fdf
@ -97,16 +97,18 @@ namespace Parser
|
|||||||
|
|
||||||
result.append_fmt("\tContext:\n");
|
result.append_fmt("\tContext:\n");
|
||||||
|
|
||||||
char const* current = Tokens.current().Text;
|
Token last_valid = Tokens.Idx >= Tokens.Arr.num() ? Tokens.Arr[Tokens.Arr.num() -1] : Tokens.current();
|
||||||
sptr length = Tokens.current().Length;
|
|
||||||
while ( current != Tokens.Arr.back().Text && *current != '\n' )
|
char const* current = last_valid.Text;
|
||||||
|
sptr length = last_valid.Length;
|
||||||
|
while ( current <= Tokens.Arr.back().Text && *current != '\n' )
|
||||||
{
|
{
|
||||||
current++;
|
current++;
|
||||||
length--;
|
length++;
|
||||||
}
|
}
|
||||||
|
|
||||||
String line = String::make( GlobalAllocator, { length, Tokens.current().Text } );
|
String line = String::make( GlobalAllocator, { length, last_valid.Text } );
|
||||||
result.append_fmt("\t(%d, %d): %s", Tokens.current().Line, Tokens.current().Column, line );
|
result.append_fmt("\t(%d, %d): %s\n", last_valid.Line, last_valid.Column, line );
|
||||||
line.free();
|
line.free();
|
||||||
|
|
||||||
StackNode* curr_scope = Scope;
|
StackNode* curr_scope = Scope;
|
||||||
@ -114,16 +116,16 @@ namespace Parser
|
|||||||
{
|
{
|
||||||
if ( curr_scope->Name )
|
if ( curr_scope->Name )
|
||||||
{
|
{
|
||||||
result.append_fmt("\tProcedure: %s, AST Name: %s\n", curr_scope->ProcName, (StrC)curr_scope->Name );
|
result.append_fmt("\tProcedure: %s, AST Name: %s\n", curr_scope->ProcName.Ptr, (StrC)curr_scope->Name );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result.append_fmt("\tProcedure: %s\n", curr_scope->ProcName );
|
result.append_fmt("\tProcedure: %s\n", curr_scope->ProcName.Ptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
curr_scope = curr_scope->Prev;
|
curr_scope = curr_scope->Prev;
|
||||||
}
|
}
|
||||||
while ( current );
|
while ( curr_scope );
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -901,10 +903,39 @@ Parser::Token parse_identifier()
|
|||||||
|
|
||||||
name.Length = ( (sptr)currtok.Text + currtok.Length ) - (sptr)name.Text;
|
name.Length = ( (sptr)currtok.Text + currtok.Length ) - (sptr)name.Text;
|
||||||
eat( TokType::Identifier );
|
eat( TokType::Identifier );
|
||||||
|
|
||||||
|
if ( check( TokType::Operator ) && currtok.Text[0] == '<' )
|
||||||
|
{
|
||||||
|
eat( TokType::Operator );
|
||||||
|
|
||||||
|
// Template arguments can be complex so were not validating if they are correct.
|
||||||
|
s32 level = 0;
|
||||||
|
while ( left && (currtok.Text[0] != '>' || level > 0 ) )
|
||||||
|
{
|
||||||
|
if ( currtok.Text[0] == '<' )
|
||||||
|
level++;
|
||||||
|
|
||||||
|
else if ( currtok.Text[0] == '>' && level > 0 )
|
||||||
|
level--;
|
||||||
|
|
||||||
|
eat( currtok.Type );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( left == 0 )
|
||||||
|
{
|
||||||
|
log_failure( "Error, unexpected end of template arguments\n%s", Context.to_string() );
|
||||||
|
return { nullptr, 0, TokType::Invalid };
|
||||||
|
}
|
||||||
|
|
||||||
|
eat( TokType::Operator );
|
||||||
|
name.Length = ( (sptr)prevtok.Text + (sptr)prevtok.Length ) - (sptr)name.Text;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( check( TokType::Operator ) && currtok.Text[0] == '<' )
|
if ( check( TokType::Operator ) && currtok.Text[0] == '<' )
|
||||||
{
|
{
|
||||||
|
eat( TokType::Operator );
|
||||||
|
|
||||||
// Template arguments can be complex so were not validating if they are correct.
|
// Template arguments can be complex so were not validating if they are correct.
|
||||||
s32 level = 0;
|
s32 level = 0;
|
||||||
while ( left && (currtok.Text[0] != '>' || level > 0 ) )
|
while ( left && (currtok.Text[0] != '>' || level > 0 ) )
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
cls
|
cls
|
||||||
Invoke-Expression "& $(Join-Path $PSScriptRoot 'build.ci.ps1') $args"
|
Invoke-Expression "& $(Join-Path $PSScriptRoot 'test.gen_build.ci.ps1') $args"
|
||||||
|
@ -12,7 +12,7 @@ int gen_main()
|
|||||||
using namespace gen;
|
using namespace gen;
|
||||||
log_fmt("\ngen_time:");
|
log_fmt("\ngen_time:");
|
||||||
|
|
||||||
check_sanity();
|
// check_sanity();
|
||||||
|
|
||||||
check_SOA();
|
check_SOA();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user