-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Information can be stored in the Parser::Context. Parse context can be retrieved from the last parsed action by requesting it from the backend.
Failures can be stored in a struct called Parser::Failures. We would need some "salvaging point", I don't know the heuristics for doing so in this language. What I could assume is that some "aspect of the parse context could find at least the "end statement" for some token and use that as a point to keep itself going. This seems to be what many editors do for their intellisense or syntax & semantic highlighting.
CodeFile when its made would take advantage of this. Failures would be left as invalid nodes (as they already are, just that we won't straight up cancel parsing like we are right now...).
This would allow the ability to still scavenge most of a C/C++ file, even if it has content that the parser is not capable of retrieving and allow the user to possibly manually grab from the token assigned to the invalid code.
(Makes it so that not having full support for C++ isn't as huge of a deal breaker).
Failure struct:
namespace Parser
{
struct ParseFailure
{
String Reason;
Code Node;
};
}Possible scanner interface:
CodeFile scan_file( char const* path )
{
using namespace Parser;
CodeFile
result = {};
result.FilePath = String::make( GlobalAllocator, path );
Code code = scan_file( path );
result.CodeRoot = code;
ParseContext context = parser_get_last_context();
result.Tokens = context.Tokens;
result.ParseFailures = context.Failures;
return result;
}Metadata
Metadata
Assignees
Labels
Projects
Status