I need to manually review these as the changes have various errors that are difficult to diagnose why.
I took a break to do handmade hero and now a bit rusty.
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
Interface adding has been adjusted to use ParentType->Next.
Using the AST_Class->Next was bad since that breaks the linked list a body AST would have used for traversal.
strip_formatting suffers from some edge failure with what looks to be escaped character literals (not entirely sure).
I've decided to not remove formatting from unvalidated function bodies since I plan to support parsing its content properly.
However expression values for a statement will fail to have their formatting removed with this.
Since I don't plan to parse those anytime soon, I'll have to fix any edge cases for those at least..
Wanted to make parser implementation easier to sift through, so I emphasized alphabetical order more.
Since I couldn't just strip whitespace from typenames I decided to make the parse_type more aware of the typename's components if it was a function signature.
This ofc lead to the dark & damp hell that is parsing typenames.
Also made initial implementation to support parsing decltype within a typename signature..
The test failure for the singleheader is still a thing, these changes have not addressed that.
Made debug for viewing whitespace in AST::is_equal with String::visualize_whitespace()
Format stripping code is currently confined within parse_define()
I plan to move it to its own function soon, I just want to make sure its finalized first.
Other unvalidated content will need to have an extra check for preprocessed lines.
Example: Function bodies can have a #define <identifier> <definition>. I cannot strip the last <new line> as it will break the semantic importance to distinguish that line.
So it needs to be:
<content before> <new line>
<preprocessed line> <new line>
<content after>
In the content string that is minimally preserved
The NumEntries checks need to be deferred until the end as a final unresolved check on valdiation. As if there really is a discrepancy of entires it should be revealed by the specific entry failing.
Right now the latest failure with the single header check involves a define directive specifically the define does omit whitespace properly and so the check interprets the different cached content to be non-equivalent.
This will happen with all unvalidated aspects of the AST ( expressions, function bodies, etc )
There are two ways to resolve, either make an AST that can tokenize all items (not realistic), or I need to strip non-syntax important whitespace and then cache the string. This would mean removing everything but a single whitespace for all content within a content string. Otherwise, I would have to somehow make sure the content of the string has the exact formatting between both files for the definitions that matter.
AST types with this issue:
* Define Directive
* Pragma Directive
* Comment
* Execution
* Platform Attributes
* Untyped
Comments can technically be left unverified as they do not matter semantically.
When the serialization is first emitted, the content these strings should for the most part be equivalent. However I do see some possible failures for that if a different style of bracket placment is used (between the serialization).
At that point what I could do is just leave those unverified and just emit the content to the user as warning that the ast and the other compared could not be verified.
Those technically can be handled on a per-eye basis, and worst case the tests with the compiler will in the determine if any critical defintions are missing for the user.
Also now doing comment serialization on def_comment directly as parse_comment doesn't need it.
Essentially comment ast types serialize the same way s untyped and execution ASTs
Adding the pragma once and includes the files broke compilation, still diagnosing why.
- Some string functions were moved to the cpp, still need to do some more evaluation of it and the containers...
- Added support for forceinline and neverinline to parsing (untested)
- Added support for specifiers in operator cast such as explicit, inline/forceinline/neverinline, etc.
- Before it only support const.
- Still need to support volatile.
- Forceinline was not supported at all for tokenization, fixed that.
There were multiple issues with comment and newline lexing.
Extended printing functions to support Strings with %S flag (captial 'S').
Allows for length detection. Also made it so that precision for strings is the string length.