Browse Source

Better language determination.

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

26
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
try if (errors.size())
{ {
m_data = eth::asBytes(compile(src)); try
{
m_data = eth::asBytes(compile(src));
for (auto& i: errors)
i = "(LLL " + i + ")";
}
catch (string err)
{
errors.push_back("Serpent " + err);
}
} }
catch (string err)
{
errors.push_back("Serpent " + err);
#endif #endif
auto asmcode = eth::compileLLLToAsm(src, false); else
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>"; lll = "<h4>Opt</h4><pre>" + QString::fromStdString(asmcodeopt).toHtmlEscaped() + "</pre><h4>Pre</h4><pre>" + QString::fromStdString(asmcode).toHtmlEscaped() + "</pre>";
#ifdef ETH_SERPENT
}
#endif
} }
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