{"action":"created","comment":{"url":"https://api.github.com/repos/ethereum/cpp-ethereum/pulls/comments/28855887","id":28855887,"diff_hunk":"@@ -0,0 +1,124 @@\n+/*\n+\tThis file is part of cpp-ethereum.\n+\n+\tcpp-ethereum is free software: you can redistribute it and/or modify\n+\tit under the terms of the GNU General Public License as published by\n+\tthe Free Software Foundation, either version 3 of the License, or\n+\t(at your option) any later version.\n+\n+\tcpp-ethereum is distributed in the hope that it will be useful,\n+\tbut WITHOUT ANY WARRANTY; without even the implied warranty of\n+\tMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+\tGNU General Public License for more details.\n+\n+\tYou should have received a copy of the GNU General Public License\n+\talong with cpp-ethereum.  If not, see <http://www.gnu.org/licenses/>.\n+*/\n+/**\n+ * @author Christian <c@ethdev.com>\n+ * @date 2014\n+ * JSON interface for the solidity compiler to be used from Javascript.\n+ */\n+\n+#include <string>\n+#include <iostream>\n+#include <json/json.h>\n+#include <libdevcore/Common.h>\n+#include <libdevcore/CommonData.h>\n+#include <libdevcore/CommonIO.h>\n+#include <libevmcore/Instruction.h>\n+#include <libsolidity/Scanner.h>\n+#include <libsolidity/Parser.h>\n+#include <libsolidity/ASTPrinter.h>\n+#include <libsolidity/NameAndTypeResolver.h>\n+#include <libsolidity/Exceptions.h>\n+#include <libsolidity/CompilerStack.h>\n+#include <libsolidity/SourceReferenceFormatter.h>\n+#include <libsolidity/ASTJsonConverter.h>\n+\n+using namespace std;\n+using namespace dev;\n+using namespace solidity;\n+\n+string formatError(Exception const& _exception, string const& _name, CompilerStack const& _compiler)\n+{\n+\tostringstream errorOutput;\n+\tSourceReferenceFormatter::printExceptionInformation(errorOutput, _exception, _name, _compiler);\n+\n+\tJson::Value output(Json::objectValue);\n+\toutput[\"error\"] = errorOutput.str();\n+\treturn Json::FastWriter().write(output);\n+}\n+\n+string compile(string _input, bool optimize)\n+{\n+\tStringMap sources;\n+\tsources[\"\"] = _input;\n+\n+\tJson::Value output(Json::objectValue);\n+\tCompilerStack compiler;\n+\ttry\n+\t{\n+\t\tcompiler.compile(_input, optimize);\n+\t}\n+\tcatch (ParserError const& exception)\n+\t{\n+\t\treturn formatError(exception, \"Parser error\", compiler);\n+\t}\n+\tcatch (DeclarationError const& exception)\n+\t{\n+\t\treturn formatError(exception, \"Declaration error\", compiler);\n+\t}\n+\tcatch (TypeError const& exception)\n+\t{\n+\t\treturn formatError(exception, \"Type error\", compiler);\n+\t}\n+\tcatch (CompilerError const& exception)\n+\t{\n+\t\treturn formatError(exception, \"Compiler error\", compiler);\n+\t}\n+\tcatch (InternalCompilerError const& exception)\n+\t{\n+\t\treturn formatError(exception, \"Internal compiler error\", compiler);\n+\t}\n+\tcatch (Exception const& exception)\n+\t{\n+\t\toutput[\"error\"] = \"Exception during compilation: \" + boost::diagnostic_information(exception);\n+\t\treturn Json::FastWriter().write(output);\n+\t}\n+\tcatch (...)\n+\t{\n+\t\toutput[\"error\"] = \"Unknown exception during compilation.\";\n+\t\treturn Json::FastWriter().write(output);\n+\t}\n+\n+\toutput[\"contracts\"] = Json::Value(Json::objectValue);\n+\tfor (string const& contractName: compiler.getContractNames())\n+\t{\n+\t\tJson::Value contractData(Json::objectValue);\n+\t\tcontractData[\"solidity_interface\"] = compiler.getSolidityInterface(contractName);\n+\t\tcontractData[\"interface\"] = compiler.getInterface(contractName);\n+\t\tcontractData[\"bytecode\"] = toHex(compiler.getBytecode(contractName));\n+\t\tcontractData[\"opcodes\"] = eth::disassemble(compiler.getBytecode(contractName));\n+\t\tostringstream unused;\n+\t\tcontractData[\"assembly\"] = compiler.streamAssembly(unused, contractName, sources);\n+\t\toutput[\"contracts\"][contractName] = contractData;\n+\t}\n+\n+\toutput[\"sources\"] = Json::Value(Json::objectValue);\n+\toutput[\"sources\"][\"\"] = Json::Value(Json::objectValue);\n+\toutput[\"sources\"][\"\"][\"AST\"] = ASTJsonConverter(compiler.getAST(\"\")).json();\n+\n+\treturn Json::FastWriter().write(output);\n+}\n+\n+static string outputBuffer;\n+\n+extern \"C\"\n+{\n+extern char const* compileJSON(char const* _input, bool optimize)","path":"solc/jsonCompiler.cpp","position":119,"original_position":119,"commit_id":"308de4e1bb695f6a19152b130e053589ce7d2167","original_commit_id":"308de4e1bb695f6a19152b130e053589ce7d2167","user":{"login":"LianaHus","id":9685356,"avatar_url":"https://avatars.githubusercontent.com/u/9685356?v=3","gravatar_id":"","url":"https://api.github.com/users/LianaHus","html_url":"https://github.com/LianaHus","followers_url":"https://api.github.com/users/LianaHus/followers","following_url":"https://api.github.com/users/LianaHus/following{/other_user}","gists_url":"https://api.github.com/users/LianaHus/gists{/gist_id}","starred_url":"https://api.github.com/users/LianaHus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LianaHus/subscriptions","organizations_url":"https://api.github.com/users/LianaHus/orgs","repos_url":"https://api.github.com/users/LianaHus/repos","events_url":"https://api.github.com/users/LianaHus/events{/privacy}","received_events_url":"https://api.github.com/users/LianaHus/received_events","type":"User","site_admin":false},"body":"optimize -> _optimize","created_at":"2015-04-22T09:17:25Z","updated_at":"2015-04-22T09:17:25Z","html_url":"https://github.com/ethereum/cpp-ethereum/pull/1709#discussion_r28855887","pull_request_url":"https://api.github.com/repos/ethereum/cpp-ethereum/pulls/1709","_links":{"self":{"href":"https://api.github.com/repos/ethereum/cpp-ethereum/pulls/comments/28855887"},"html":{"href":"https://github.com/ethereum/cpp-ethereum/pull/1709#discussion_r28855887"},"pull_request":{"href":"https://api.github.com/repos/ethereum/cpp-ethereum/pulls/1709"}}},"pull_request":{"url":"https://api.github.com/repos/ethereum/cpp-ethereum/pulls/1709","id":33838420,"html_url":"https://github.com/ethereum/cpp-ethereum/pull/1709","diff_url":"https://github.com/ethereum/cpp-ethereum/pull/1709.diff","patch_url":"https://github.com/ethereum/cpp-ethereum/pull/1709.patch","issue_url":"https://api.github.com/repos/ethereum/cpp-ethereum/issues/1709","number":1709,"state":"open","locked":false,"title":"JSON compiler.","user":{"login":"chriseth","id":9073706,"avatar_url":"https://avatars.githubusercontent.com/u/9073706?v=3","gravatar_id":"","url":"https://api.github.com/users/chriseth","html_url":"https://github.com/chriseth","followers_url":"https://api.github.com/users/chriseth/followers","following_url":"https://api.github.com/users/chriseth/following{/other_user}","gists_url":"https://api.github.com/users/chriseth/gists{/gist_id}","starred_url":"https://api.github.com/users/chriseth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chriseth/subscriptions","organizations_url":"https://api.github.com/users/chriseth/orgs","repos_url":"https://api.github.com/users/chriseth/repos","events_url":"https://api.github.com/users/chriseth/events{/privacy}","received_events_url":"https://api.github.com/users/chriseth/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-04-22T09:01:53Z","updated_at":"2015-04-22T09:17:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"60c31310200353a8e0d905ee8990de08153a8145","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ethereum/cpp-ethereum/pulls/1709/commits","review_comments_url":"https://api.github.com/repos/ethereum/cpp-ethereum/pulls/1709/comments","review_comment_url":"https://api.github.com/repos/ethereum/cpp-ethereum/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ethereum/cpp-ethereum/issues/1709/comments","statuses_url":"https://api.github.com/repos/ethereum/cpp-ethereum/statuses/308de4e1bb695f6a19152b130e053589ce7d2167","head":{"label":"chriseth:sol_compileToJSON","ref":"sol_compileToJSON","sha":"308de4e1bb695f6a19152b130e053589ce7d2167","user":{"login":"chriseth","id":9073706,"avatar_url":"https://avatars.githubusercontent.com/u/9073706?v=3","gravatar_id":"","url":"https://api.github.com/users/chriseth","html_url":"https://github.com/chriseth","followers_url":"https://api.github.com/users/chriseth/followers","following_url":"https://api.github.com/users/chriseth/following{/other_user}","gists_url":"https://api.github.com/users/chriseth/gists{/gist_id}","starred_url":"https://api.github.com/users/chriseth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chriseth/subscriptions","organizations_url":"https://api.github.com/users/chriseth/orgs","repos_url":"https://api.github.com/users/chriseth/repos","events_url":"https://api.github.com/users/chriseth/events{/privacy}","received_events_url":"https://api.github.com/users/chriseth/received_events","type":"User","site_admin":false},"repo":{"id":24932538,"name":"cpp-ethereum","full_name":"chriseth/cpp-ethereum","owner":{"login":"chriseth","id":9073706,"avatar_url":"https://avatars.githubusercontent.com/u/9073706?v=3","gravatar_id":"","url":"https://api.github.com/users/chriseth","html_url":"https://github.com/chriseth","followers_url":"https://api.github.com/users/chriseth/followers","following_url":"https://api.github.com/users/chriseth/following{/other_user}","gists_url":"https://api.github.com/users/chriseth/gists{/gist_id}","starred_url":"https://api.github.com/users/chriseth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chriseth/subscriptions","organizations_url":"https://api.github.com/users/chriseth/orgs","repos_url":"https://api.github.com/users/chriseth/repos","events_url":"https://api.github.com/users/chriseth/events{/privacy}","received_events_url":"https://api.github.com/users/chriseth/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chriseth/cpp-ethereum","description":"Gavin Wood's C++ implementation of the Ethereum yellowpaper.","fork":true,"url":"https://api.github.com/repos/chriseth/cpp-ethereum","forks_url":"https://api.github.com/repos/chriseth/cpp-ethereum/forks","keys_url":"https://api.github.com/repos/chriseth/cpp-ethereum/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chriseth/cpp-ethereum/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chriseth/cpp-ethereum/teams","hooks_url":"https://api.github.com/repos/chriseth/cpp-ethereum/hooks","issue_events_url":"https://api.github.com/repos/chriseth/cpp-ethereum/issues/events{/number}","events_url":"https://api.github.com/repos/chriseth/cpp-ethereum/events","assignees_url":"https://api.github.com/repos/chriseth/cpp-ethereum/assignees{/user}","branches_url":"https://api.github.com/repos/chriseth/cpp-ethereum/branches{/branch}","tags_url":"https://api.github.com/repos/chriseth/cpp-ethereum/tags","blobs_url":"https://api.github.com/repos/chriseth/cpp-ethereum/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chriseth/cpp-ethereum/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chriseth/cpp-ethereum/git/refs{/sha}","trees_url":"https://api.github.com/repos/chriseth/cpp-ethereum/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chriseth/cpp-ethereum/statuses/{sha}","languages_url":"https://api.github.com/repos/chriseth/cpp-ethereum/languages","stargazers_url":"https://api.github.com/repos/chriseth/cpp-ethereum/stargazers","contributors_url":"https://api.github.com/repos/chriseth/cpp-ethereum/contributors","subscribers_url":"https://api.github.com/repos/chriseth/cpp-ethereum/subscribers","subscription_url":"https://api.github.com/repos/chriseth/cpp-ethereum/subscription","commits_url":"https://api.github.com/repos/chriseth/cpp-ethereum/commits{/sha}","git_commits_url":"https://api.github.com/repos/chriseth/cpp-ethereum/git/commits{/sha}","comments_url":"https://api.github.com/repos/chriseth/cpp-ethereum/comments{/number}","issue_comment_url":"https://api.github.com/repos/chriseth/cpp-ethereum/issues/comments{/number}","contents_url":"https://api.github.com/repos/chriseth/cpp-ethereum/contents/{+path}","compare_url":"https://api.github.com/repos/chriseth/cpp-ethereum/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chriseth/cpp-ethereum/merges","archive_url":"https://api.github.com/repos/chriseth/cpp-ethereum/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chriseth/cpp-ethereum/downloads","issues_url":"https://api.github.com/repos/chriseth/cpp-ethereum/issues{/number}","pulls_url":"https://api.github.com/repos/chriseth/cpp-ethereum/pulls{/number}","milestones_url":"https://api.github.com/repos/chriseth/cpp-ethereum/milestones{/number}","notifications_url":"https://api.github.com/repos/chriseth/cpp-ethereum/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chriseth/cpp-ethereum/labels{/name}","releases_url":"https://api.github.com/repos/chriseth/cpp-ethereum/releases{/id}","created_at":"2014-10-08T09:01:35Z","updated_at":"2015-03-02T16:58:54Z","pushed_at":"2015-04-22T09:01:33Z","git_url":"git://github.com/chriseth/cpp-ethereum.git","ssh_url":"git@github.com:chriseth/cpp-ethereum.git","clone_url":"https://github.com/chriseth/cpp-ethereum.git","svn_url":"https://github.com/chriseth/cpp-ethereum","homepage":"www.gavwood.com/Paper.pdf","size":43363,"stargazers_count":2,"watchers_count":2,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":2,"default_branch":"develop"}},"base":{"label":"ethereum:develop","ref":"develop","sha":"6de330dd2da5f570f21761e1b170900fe32b350e","user":{"login":"ethereum","id":6250754,"avatar_url":"https://avatars.githubusercontent.com/u/6250754?v=3","gravatar_id":"","url":"https://api.github.com/users/ethereum","html_url":"https://github.com/ethereum","followers_url":"https://api.github.com/users/ethereum/followers","following_url":"https://api.github.com/users/ethereum/following{/other_user}","gists_url":"https://api.github.com/users/ethereum/gists{/gist_id}","starred_url":"https://api.github.com/users/ethereum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethereum/subscriptions","organizations_url":"https://api.github.com/users/ethereum/orgs","repos_url":"https://api.github.com/users/ethereum/repos","events_url":"https://api.github.com/users/ethereum/events{/privacy}","received_events_url":"https://api.github.com/users/ethereum/received_events","type":"Organization","site_admin":false},"repo":{"id":15460666,"name":"cpp-ethereum","full_name":"ethereum/cpp-ethereum","owner":{"login":"ethereum","id":6250754,"avatar_url":"https://avatars.githubusercontent.com/u/6250754?v=3","gravatar_id":"","url":"https://api.github.com/users/ethereum","html_url":"https://github.com/ethereum","followers_url":"https://api.github.com/users/ethereum/followers","following_url":"https://api.github.com/users/ethereum/following{/other_user}","gists_url":"https://api.github.com/users/ethereum/gists{/gist_id}","starred_url":"https://api.github.com/users/ethereum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethereum/subscriptions","organizations_url":"https://api.github.com/users/ethereum/orgs","repos_url":"https://api.github.com/users/ethereum/repos","events_url":"https://api.github.com/users/ethereum/events{/privacy}","received_events_url":"https://api.github.com/users/ethereum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ethereum/cpp-ethereum","description":"Gavin Wood's C++ implementation of the Ethereum yellowpaper.","fork":false,"url":"https://api.github.com/repos/ethereum/cpp-ethereum","forks_url":"https://api.github.com/repos/ethereum/cpp-ethereum/forks","keys_url":"https://api.github.com/repos/ethereum/cpp-ethereum/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ethereum/cpp-ethereum/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ethereum/cpp-ethereum/teams","hooks_url":"https://api.github.com/repos/ethereum/cpp-ethereum/hooks","issue_events_url":"https://api.github.com/repos/ethereum/cpp-ethereum/issues/events{/number}","events_url":"https://api.github.com/repos/ethereum/cpp-ethereum/events","assignees_url":"https://api.github.com/repos/ethereum/cpp-ethereum/assignees{/user}","branches_url":"https://api.github.com/repos/ethereum/cpp-ethereum/branches{/branch}","tags_url":"https://api.github.com/repos/ethereum/cpp-ethereum/tags","blobs_url":"https://api.github.com/repos/ethereum/cpp-ethereum/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ethereum/cpp-ethereum/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ethereum/cpp-ethereum/git/refs{/sha}","trees_url":"https://api.github.com/repos/ethereum/cpp-ethereum/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ethereum/cpp-ethereum/statuses/{sha}","languages_url":"https://api.github.com/repos/ethereum/cpp-ethereum/languages","stargazers_url":"https://api.github.com/repos/ethereum/cpp-ethereum/stargazers","contributors_url":"https://api.github.com/repos/ethereum/cpp-ethereum/contributors","subscribers_url":"https://api.github.com/repos/ethereum/cpp-ethereum/subscribers","subscription_url":"https://api.github.com/repos/ethereum/cpp-ethereum/subscription","commits_url":"https://api.github.com/repos/ethereum/cpp-ethereum/commits{/sha}","git_commits_url":"https://api.github.com/repos/ethereum/cpp-ethereum/git/commits{/sha}","comments_url":"https://api.github.com/repos/ethereum/cpp-ethereum/comments{/number}","issue_comment_url":"https://api.github.com/repos/ethereum/cpp-ethereum/issues/comments{/number}","contents_url":"https://api.github.com/repos/ethereum/cpp-ethereum/contents/{+path}","compare_url":"https://api.github.com/repos/ethereum/cpp-ethereum/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ethereum/cpp-ethereum/merges","archive_url":"https://api.github.com/repos/ethereum/cpp-ethereum/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ethereum/cpp-ethereum/downloads","issues_url":"https://api.github.com/repos/ethereum/cpp-ethereum/issues{/number}","pulls_url":"https://api.github.com/repos/ethereum/cpp-ethereum/pulls{/number}","milestones_url":"https://api.github.com/repos/ethereum/cpp-ethereum/milestones{/number}","notifications_url":"https://api.github.com/repos/ethereum/cpp-ethereum/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ethereum/cpp-ethereum/labels{/name}","releases_url":"https://api.github.com/repos/ethereum/cpp-ethereum/releases{/id}","created_at":"2013-12-26T21:26:06Z","updated_at":"2015-04-22T05:59:04Z","pushed_at":"2015-04-22T09:01:54Z","git_url":"git://github.com/ethereum/cpp-ethereum.git","ssh_url":"git@github.com:ethereum/cpp-ethereum.git","clone_url":"https://github.com/ethereum/cpp-ethereum.git","svn_url":"https://github.com/ethereum/cpp-ethereum","homepage":"www.gavwood.com/Paper.pdf","size":94655,"stargazers_count":454,"watchers_count":454,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":155,"mirror_url":null,"open_issues_count":142,"forks":155,"open_issues":142,"watchers":454,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/ethereum/cpp-ethereum/pulls/1709"},"html":{"href":"https://github.com/ethereum/cpp-ethereum/pull/1709"},"issue":{"href":"https://api.github.com/repos/ethereum/cpp-ethereum/issues/1709"},"comments":{"href":"https://api.github.com/repos/ethereum/cpp-ethereum/issues/1709/comments"},"review_comments":{"href":"https://api.github.com/repos/ethereum/cpp-ethereum/pulls/1709/comments"},"review_comment":{"href":"https://api.github.com/repos/ethereum/cpp-ethereum/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ethereum/cpp-ethereum/pulls/1709/commits"},"statuses":{"href":"https://api.github.com/repos/ethereum/cpp-ethereum/statuses/308de4e1bb695f6a19152b130e053589ce7d2167"}}}}