mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-06 20:37:05 +00:00
implement error recovery in the llvm-mc parser. Feel the power!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74728 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a8185fe50b
commit
b717fb0fe0
@ -40,11 +40,18 @@ bool AsmParser::Run() {
|
|||||||
// Prime the lexer.
|
// Prime the lexer.
|
||||||
Lexer.Lex();
|
Lexer.Lex();
|
||||||
|
|
||||||
while (Lexer.isNot(asmtok::Eof))
|
bool HadError = false;
|
||||||
if (ParseStatement())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
// While we have input, parse each statement.
|
||||||
|
while (Lexer.isNot(asmtok::Eof)) {
|
||||||
|
if (!ParseStatement()) continue;
|
||||||
|
|
||||||
|
// If we had an error, remember it and recover by skipping to the next line.
|
||||||
|
HadError = true;
|
||||||
|
EatToEndOfStatement();
|
||||||
|
}
|
||||||
|
|
||||||
|
return HadError;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EatToEndOfStatement - Throw away the rest of the line for testing purposes.
|
/// EatToEndOfStatement - Throw away the rest of the line for testing purposes.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user