mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[yulopti] Sort options by step name, with special options on top of the list
This commit is contained in:
parent
18c0e70ccf
commit
88a7dddfbd
@ -46,10 +46,13 @@
|
|||||||
#include <boost/algorithm/string/predicate.hpp>
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
|
|
||||||
|
#include <range/v3/action/sort.hpp>
|
||||||
|
#include <range/v3/range/conversion.hpp>
|
||||||
#include <range/v3/view/concat.hpp>
|
#include <range/v3/view/concat.hpp>
|
||||||
#include <range/v3/view/drop.hpp>
|
#include <range/v3/view/drop.hpp>
|
||||||
#include <range/v3/view/stride.hpp>
|
#include <range/v3/view/stride.hpp>
|
||||||
|
|
||||||
|
#include <cctype>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -129,7 +132,16 @@ public:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<tuple<char, string>> sortedOptions = views::concat(_optimizationSteps, _extraOptions);
|
vector<tuple<char, string>> sortedOptions =
|
||||||
|
views::concat(_optimizationSteps, _extraOptions) |
|
||||||
|
to<vector<tuple<char, string>>>() |
|
||||||
|
actions::sort([](tuple<char, string> const& _a, tuple<char, string> const& _b) {
|
||||||
|
return (
|
||||||
|
!boost::algorithm::iequals(get<1>(_a), get<1>(_b)) ?
|
||||||
|
boost::algorithm::lexicographical_compare(get<1>(_a), get<1>(_b), boost::algorithm::is_iless()) :
|
||||||
|
tolower(get<0>(_a)) < tolower(get<0>(_b))
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
yulAssert(sortedOptions.size() > 0, "");
|
yulAssert(sortedOptions.size() > 0, "");
|
||||||
size_t rows = (sortedOptions.size() - 1) / _columns + 1;
|
size_t rows = (sortedOptions.size() - 1) / _columns + 1;
|
||||||
@ -161,7 +173,8 @@ public:
|
|||||||
}
|
}
|
||||||
map<char, string> const& abbreviationMap = OptimiserSuite::stepAbbreviationToNameMap();
|
map<char, string> const& abbreviationMap = OptimiserSuite::stepAbbreviationToNameMap();
|
||||||
map<char, string> const& extraOptions = {
|
map<char, string> const& extraOptions = {
|
||||||
{'#', "quit"},
|
// QUIT starts with a non-letter character on purpose to get it to show up on top of the list
|
||||||
|
{'#', ">>> QUIT <<<"},
|
||||||
{',', "VarNameCleaner"},
|
{',', "VarNameCleaner"},
|
||||||
{';', "StackCompressor"}
|
{';', "StackCompressor"}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user