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

@ -41,10 +41,10 @@ struct CodeBody;
// These are to offer ease of use and optionally strong type safety for the AST.
struct CodeAttributes;
struct CodeComment;
struct CodeConstructor;
struct CodeDestructor;
struct CodeClass;
struct CodeConstructor;
struct CodeDefine;
struct CodeDestructor;
struct CodeEnum;
struct CodeExec;
struct CodeExtern;
@ -217,14 +217,14 @@ struct AST
uw ArrSpecs_Cap =
(
AST_POD_Size
- sizeof(AST*) * 3
- sizeof(AST*) * 4
- sizeof(StringCached)
- sizeof(CodeT)
- sizeof(ModuleFlag)
- sizeof(u32)
- sizeof(s32)
)
/ sizeof(SpecifierT) - 1; // -1 for 4 extra bytes
/ sizeof(SpecifierT); // -1 for 4 extra bytes
union {
struct
@ -255,7 +255,10 @@ struct AST
};
};
StringCached Content; // Attributes, Comment, Execution, Include
SpecifierT ArrSpecs[AST::ArrSpecs_Cap]; // Specifiers
struct {
SpecifierT ArrSpecs[AST::ArrSpecs_Cap]; // Specifiers
AST* NextSpecs; // Specifiers
};
};
union {
AST* Prev;
@ -310,8 +313,11 @@ struct AST_POD
AST* SpecsFuncSuffix; // Only used with typenames, to store the function suffix if typename is function signature.
};
};
StringCached Content; // Attributes, Comment, Execution, Include
SpecifierT ArrSpecs[AST::ArrSpecs_Cap]; // Specifiers
StringCached Content; // Attributes, Comment, Execution, Include
struct {
SpecifierT ArrSpecs[AST::ArrSpecs_Cap]; // Specifiers
AST* NextSpecs; // Specifiers
};
};
union {
AST* Prev;