LLL: throw proper ParserException

This commit is contained in:
Alex Beregszaszi 2016-10-15 13:26:16 +01:00
parent 7c7a6de87b
commit 8aa50a004f
3 changed files with 5 additions and 2 deletions

View File

@ -39,6 +39,7 @@ class InvalidName: public CompilerException {};
class InvalidMacroArgs: public CompilerException {}; class InvalidMacroArgs: public CompilerException {};
class InvalidLiteral: public CompilerException {}; class InvalidLiteral: public CompilerException {};
class BareSymbol: public CompilerException {}; class BareSymbol: public CompilerException {};
class ParserException: public CompilerException {};
} }
} }

View File

@ -143,7 +143,8 @@ void dev::eth::parseTreeLLL(string const& _s, sp::utree& o_out)
auto ret = s.cbegin(); auto ret = s.cbegin();
qi::phrase_parse(ret, s.cend(), element, space, qi::skip_flag::dont_postskip, o_out); qi::phrase_parse(ret, s.cend(), element, space, qi::skip_flag::dont_postskip, o_out);
for (auto i = ret; i != s.cend(); ++i) for (auto i = ret; i != s.cend(); ++i)
if (!isspace(*i)) if (!isspace(*i)) {
BOOST_THROW_EXCEPTION(std::exception()); BOOST_THROW_EXCEPTION(ParserException() << errinfo_comment("Non-whitespace left in parser"));
}
} }

View File

@ -24,6 +24,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <libdevcore/Common.h> #include <libdevcore/Common.h>
#include "Exceptions.h"
namespace boost { namespace spirit { class utree; } } namespace boost { namespace spirit { class utree; } }
namespace sp = boost::spirit; namespace sp = boost::spirit;