WIP : better AST::debug_str()

Now its more contexually rich to the ast type, however I need to hookup tokens from parsing to the AST. There needs to be a way for the debug string to lookup the token and provide the contexual line.
Can either pass it ( TokArray* toks ) from the parser on failure (or `CodeFile`)..
Technically there is more than enough room for another Token* ptr. I could add another and specifiers would still have at minimum 14 slots before needing to extended to next specs.
**************... yeah
This commit is contained in:
2023-09-11 23:22:53 -04:00
parent 9495fc2985
commit 4b48b96a79
22 changed files with 635 additions and 158 deletions

View File

@ -120,45 +120,40 @@ Code scan_file( char const* path )
}
#if 0
struct Policy
struct CodeFile
{
// Nothing for now.
using namespace Parser;
String FilePath;
TokArray Tokens;
Array<ParseFailure> ParseFailures;
Code CodeRoot;
};
struct SymbolInfo
namespace Parser
{
StringCached File;
char const* Marker;
Code Signature;
};
struct Scanner
{
struct RequestEntry
struct ParseFailure
{
SymbolInfo Info;
String Reason;
Code Node;
};
}
struct Receipt
{
StringCached File;
Code Defintion;
bool Result;
};
CodeFile scan_file( char const* path )
{
using namespace Parser;
AllocatorInfo MemAlloc;
CodeFile
result = {};
result.FilePath = String::make( GlobalAllocator, path );
static void set_allocator( AllocatorInfo allocator );
Code code = scan_file( path );
result.CodeRoot = code;
Array<FileInfo> Files;
String Buffer;
Array<RequestEntry> Requests;
ParseContext context = parser_get_last_context();
result.Tokens = context.Tokens;
result.ParseFailures = context.Failures;
void add_files( s32 num, char const** files );
void add( SymbolInfo signature, Policy policy );
bool process_requests( Array<Receipt> out_receipts );
};
return result;
}
#endif