parser error handling
This commit is contained in:
parent
d4c85a3d86
commit
2484ea9d9c
10 changed files with 119 additions and 72 deletions
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
|
||||
#include <parser/parser.h>
|
||||
|
||||
#include "Private.hpp"
|
||||
|
|
@ -36,7 +35,12 @@ Parser::Result Parser::parse(const tp::String& stream) {
|
|||
ASSERT(parser.valid());
|
||||
|
||||
parser.parse(streamStd.begin(), streamStd.end());
|
||||
auto scope = (BCgen::StatementScope*) parser.user_data();
|
||||
|
||||
return { scope, parser.accepted() && parser.full() };
|
||||
BCgen::StatementScope* out = nullptr;
|
||||
|
||||
if (parser.accepted() && parser.full()) {
|
||||
out = (BCgen::StatementScope*) parser.user_data().statement;
|
||||
}
|
||||
|
||||
return { out, !(parser.accepted() && parser.full()) };
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue