yewstack/yew_router

Reenable advanced error reporting in frontend parser

hgzimmerman opened this issue · 1 comments

Description

The current frontend parser doesn't report the error it encountered in a human friendly manner.
Currently, it gives the string that was parsed up until that point, and a list of expected constructs.

A more formalized error type should be reintroduced to re-enable the error syntax:

/invalid/path//
--------------^
Expected x,y,z.

Currently the parser returns a ParserError. The majority of errors that come from here are of the ExpectedOneOf variant. These are useful, but having some concrete reason stated for the error should be done as well.

So the compound error type should really be:

struct ParserError {
    reason: Option<ParseErrorReason>,
    expected: Vec<RouteParserToken>
}