On Saturday, 15 December 2018 at 22:48:01 UTC, Neia Neutuladh wrote:
The way to fix this is to replace the entire parser and get rid of the idea of AST poisoning; at the first error, you give up on parsing the entire file. From there, you can try recovering from specific errors with proper testing.

You can still continue parsing after an error but right now many sub-parsers always return an AstNode instead of null. The parser on null sub parser result could go to the end of the scope or to the next statement, depending on what it expected, and continue from there. That being said this wouldn't always work, e.g when a semi colon or a curly brace misses.

Simple example:

    struct Foo
    {
        int a, b
string c; // error because a type identifier part wasn't expected ... } // ... we're in a aggr body so consume toks past the curly brace

    struct Bar
    {
    }



Reply via email to