From d82eac3fed6547ddcaac8ecccb15c7f7eaa74d16 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 29 Nov 2016 22:04:51 +0000 Subject: LLL: parseLLL to be less greedy catching exceptions --- liblll/Compiler.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/liblll/Compiler.cpp b/liblll/Compiler.cpp index 0cec7bc8..73a82a35 100644 --- a/liblll/Compiler.cpp +++ b/liblll/Compiler.cpp @@ -99,15 +99,28 @@ std::string dev::eth::compileLLLToAsm(std::string const& _src, bool _opt, std::v string dev::eth::parseLLL(string const& _src) { + bool failed = false; + sp::utree o; + try { - sp::utree o; parseTreeLLL(_src, o); - ostringstream ret; - debugOutAST(ret, o); - killBigints(o); + } + catch (...) + { + failed = true; + } + + ostringstream ret; + debugOutAST(ret, o); + killBigints(o); + + if (failed) + { + return string(); + } + else + { return ret.str(); } - catch (...) {} - return string(); } -- cgit