Browse Source

Better language determination.

cl-refactor
Gav Wood 11 years ago
parent
commit
75abdad3c4
  1. 16
      alethzero/MainWin.cpp
  2. 2
      liblll/Parser.cpp

16
alethzero/MainWin.cpp

@ -970,22 +970,26 @@ void Main::on_data_textChanged()
} }
else else
{ {
auto asmcode = eth::compileLLLToAsm(src, false);
auto asmcodeopt = eth::compileLLLToAsm(ui->data->toPlainText().toStdString(), true);
m_data = eth::compileLLL(ui->data->toPlainText().toStdString(), true, &errors);
#ifdef ETH_SERPENT #ifdef ETH_SERPENT
if (errors.size())
{
try try
{ {
m_data = eth::asBytes(compile(src)); m_data = eth::asBytes(compile(src));
for (auto& i: errors)
i = "(LLL " + i + ")";
} }
catch (string err) catch (string err)
{ {
errors.push_back("Serpent " + err); errors.push_back("Serpent " + err);
#endif }
auto asmcode = eth::compileLLLToAsm(src, false);
auto asmcodeopt = eth::compileLLLToAsm(ui->data->toPlainText().toStdString(), true);
m_data = compileLLL(ui->data->toPlainText().toStdString(), true, &errors);
lll = "<h4>Opt</h4><pre>" + QString::fromStdString(asmcodeopt).toHtmlEscaped() + "</pre><h4>Pre</h4><pre>" + QString::fromStdString(asmcode).toHtmlEscaped() + "</pre>";
#ifdef ETH_SERPENT
} }
#endif #endif
else
lll = "<h4>Opt</h4><pre>" + QString::fromStdString(asmcodeopt).toHtmlEscaped() + "</pre><h4>Pre</h4><pre>" + QString::fromStdString(asmcode).toHtmlEscaped() + "</pre>";
} }
QString errs; QString errs;
if (errors.size()) if (errors.size())

2
liblll/Parser.cpp

@ -118,6 +118,6 @@ void eth::parseTreeLLL(string const& _s, sp::utree& o_out)
if (!incomment) if (!incomment)
s.push_back(i); s.push_back(i);
} }
qi::phrase_parse(s.cbegin(), s.cend(), element, space, o_out); qi::phrase_parse(s.cbegin(), s.cend(), element, space, qi::skip_flag::dont_postskip, o_out);
} }

Loading…
Cancel
Save