You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following will be introduced to the parsing API:
namespaceparser {
structStackNode
{
StackNode* Prev;
Token Start;
Token Name; // The name of the AST node (if parsed)
StrC FailedProc; // The name of the procedure that failed
};
// Stack nodes are allocated the error's allocatorstructError
{
String message;
StackNode* context_stack;
};
}
structParseInfo
Arena FileMem;
Arena TokMem;
Arena CodeMem;
FileContents FileContent;
Array<parser::Token> Tokens;
Array<parser::Error> Errors;
// Errors are allocated to a dedicated general arena.
;
CodeBody parse_file( StrC path );
Every time a parse action is completed a parse info will be provided to the user implicitly with the resulting Code AST.
This means the root node AST will always be provided it just may be invalid.
The Code node will have itself distinguished with flag specified in its code flags with CodeFlag_HasParseInfo
The parse info will be a header struct to an allocation that happens initially when using one of the API's parsing functions.
To retrieve the ParseInfo header, a get_parse_info will provide an ease of use to receive it's pointer.=
If any portion of the code content fails to parse, that section of the string will fail and get shelved into an untyped code string. The parser functions will cascade invalidate the relevant context stack with the untyped code string into a untyped AST node. The error message will be stored in the error list while also logging the failure. And, the context stack will be saved to retrieve for later inspection.
All memory arenas used for the file content, tokens, & code will be within the parse info incase the user wants to free related memory. A utility function will be provided for ease of use:
boolfree_parse_allocations( ParseInfo* info );
The text was updated successfully, but these errors were encountered:
Extension of #35
The following will be introduced to the parsing API:
Every time a parse action is completed a parse info will be provided to the user implicitly with the resulting Code AST.
This means the root node AST will always be provided it just may be invalid.
The Code node will have itself distinguished with flag specified in its code flags with
CodeFlag_HasParseInfo
The parse info will be a header struct to an allocation that happens initially when using one of the API's parsing functions.
To retrieve the
ParseInfo
header, aget_parse_info
will provide an ease of use to receive it's pointer.=If any portion of the code content fails to parse, that section of the string will fail and get shelved into an untyped code string. The parser functions will cascade invalidate the relevant context stack with the untyped code string into a untyped AST node. The error message will be stored in the error list while also logging the failure. And, the context stack will be saved to retrieve for later inspection.
All memory arenas used for the file content, tokens, & code will be within the parse info incase the user wants to free related memory. A utility function will be provided for ease of use:
The text was updated successfully, but these errors were encountered: