2014-10-25 15:13:40 +00:00
|
|
|
/*
|
2016-11-18 23:13:20 +00:00
|
|
|
This file is part of solidity.
|
2014-10-25 15:13:40 +00:00
|
|
|
|
2016-11-18 23:13:20 +00:00
|
|
|
solidity is free software: you can redistribute it and/or modify
|
2014-10-25 15:13:40 +00:00
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
2016-11-18 23:13:20 +00:00
|
|
|
solidity is distributed in the hope that it will be useful,
|
2014-10-25 15:13:40 +00:00
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2016-11-18 23:13:20 +00:00
|
|
|
along with solidity. If not, see <http://www.gnu.org/licenses/>.
|
2014-10-25 15:13:40 +00:00
|
|
|
*/
|
2020-07-17 14:54:12 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0
|
2014-10-25 15:13:40 +00:00
|
|
|
/**
|
|
|
|
* @author Christian <c@ethdev.com>
|
|
|
|
* @date 2014
|
2014-10-25 16:30:43 +00:00
|
|
|
* Solidity commandline compiler.
|
2014-10-25 15:13:40 +00:00
|
|
|
*/
|
2014-10-10 14:37:54 +00:00
|
|
|
|
2019-03-28 12:07:52 +00:00
|
|
|
#include <solc/CommandLineInterface.h>
|
2021-08-09 09:36:29 +00:00
|
|
|
|
|
|
|
#include <liblangutil/Exceptions.h>
|
|
|
|
|
2019-03-28 12:07:52 +00:00
|
|
|
#include <boost/exception/all.hpp>
|
2021-08-09 09:36:29 +00:00
|
|
|
|
2015-08-19 23:09:39 +00:00
|
|
|
#include <iostream>
|
|
|
|
|
2021-08-09 09:36:29 +00:00
|
|
|
using namespace solidity;
|
2014-12-08 15:42:56 +00:00
|
|
|
|
2016-08-30 11:29:37 +00:00
|
|
|
|
2014-10-10 14:37:54 +00:00
|
|
|
int main(int argc, char** argv)
|
|
|
|
{
|
2021-08-09 09:36:29 +00:00
|
|
|
try
|
|
|
|
{
|
2023-08-23 02:51:26 +00:00
|
|
|
solidity::frontend::CommandLineInterface cli(std::cin, std::cout, std::cerr);
|
2021-10-12 12:16:29 +00:00
|
|
|
return cli.run(argc, argv) ? 0 : 1;
|
2021-08-09 09:36:29 +00:00
|
|
|
}
|
|
|
|
catch (smtutil::SMTLogicError const& _exception)
|
|
|
|
{
|
2023-08-23 02:51:26 +00:00
|
|
|
std::cerr << "SMT logic error:" << std::endl;
|
|
|
|
std::cerr << boost::diagnostic_information(_exception);
|
2022-10-18 19:43:41 +00:00
|
|
|
return 2;
|
2021-08-09 09:36:29 +00:00
|
|
|
}
|
|
|
|
catch (langutil::UnimplementedFeatureError const& _exception)
|
|
|
|
{
|
2023-08-23 02:51:26 +00:00
|
|
|
std::cerr << "Unimplemented feature:" << std::endl;
|
|
|
|
std::cerr << boost::diagnostic_information(_exception);
|
2022-10-18 19:43:41 +00:00
|
|
|
return 2;
|
2021-08-09 09:36:29 +00:00
|
|
|
}
|
|
|
|
catch (langutil::InternalCompilerError const& _exception)
|
2015-08-19 23:09:39 +00:00
|
|
|
{
|
2023-08-23 02:51:26 +00:00
|
|
|
std::cerr << "Internal compiler error:" << std::endl;
|
|
|
|
std::cerr << boost::diagnostic_information(_exception);
|
2022-10-18 19:43:41 +00:00
|
|
|
return 2;
|
2021-08-09 09:36:29 +00:00
|
|
|
}
|
|
|
|
catch (...)
|
|
|
|
{
|
2023-08-23 02:51:26 +00:00
|
|
|
std::cerr << "Uncaught exception:" << std::endl;
|
|
|
|
std::cerr << boost::current_exception_diagnostic_information() << std::endl;
|
2022-10-18 19:43:41 +00:00
|
|
|
return 2;
|
2015-08-19 23:09:39 +00:00
|
|
|
}
|
2014-10-10 14:37:54 +00:00
|
|
|
}
|