EOSERV Bug Tracker > Bug #459: EOPlus Parser Error Recovery

Bug #459: EOPlus Parser Error Recovery

EOPlus Parser Error Recovery
ID #459
Submitter Cirras
Product EOSERV
Severity Feature Request
Status OPEN, NEW
Submitted 10th Mar 2018
Updated 10th Mar 2018
Cirras Submitter 4 years, 48 weeks ago

At the moment the EOPlus Parser implementation will stop parsing any time that it throws a Parser_Error. While this is perfectly effective at eliminating the possibility of cascading errors or other unexpected exceptions, the result is you only get to see the first error. Optimally, the parser would at least give you the majority of the valid errors that exist in the quest file.

Suggested implementation:

void Parser::Consume(std::function<bool(const Token&> f)

{

}

Comments

Cirras Submitter 4 years, 48 weeks ago

Consume() would work similarly to GetTokenIf() except it would get tokens until a particular token is found (for example a closing bracket or a keyword like "action" or "rule"). Then the parser could continue parsing without risk of cascading errors.

Proposed function:

void Parser::Consume(std::function<bool(const Token&> f)

{

Token t;


while (!f(t) && t.type != Token::EndOfFile)

{

this->GetToken(t);

}


this->tok->PutBack(t); //Put the first valid token back.

}

And it could be called like this.

this->Consume([](const Token& t)

{return t.type == Token::Symbol && std::string(t.data) == "}";})

Add Comment

Please don't post unless you have something relevant to the bug to say.
Do not comment to say "thanks" or "fix this please".

Please log in to add comments. EOSERV Bug Tracker > Bug #459: EOPlus Parser Error Recovery