Skip to content

Commit

Permalink
chore: run clang format
Browse files Browse the repository at this point in the history
  • Loading branch information
jahan-addison committed Jan 2, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent a37e46b commit b400512
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions roxas/main.cc
Original file line number Diff line number Diff line change
@@ -14,8 +14,6 @@
* limitations under the License.
*/

/* clang-format off */

#include <cstdlib>
#include <cxxopts.hpp>
#include <iostream>
@@ -32,22 +30,29 @@ int main(int argc, char** argv)
try {
cxxopts::Options options("roxas", "B Compiler in C++");

options.add_options()
("j,json", "Load AST from JSON file", cxxopts::value<std::string>())
("p,python", "Use PythonModuleLoader to load a Parser python module and build an AST", cxxopts::value<bool>()->default_value("false"))
("python-use", "Arguments to pass to python module loader", cxxopts::value<std::vector<std::string>>())
("h,help", "Print usage")
;
options.add_options()(
"j,json", "Load AST from JSON file", cxxopts::value<std::string>())(
"p,python",
"Use PythonModuleLoader to load a Parser python module and build "
"an AST",
cxxopts::value<bool>()->default_value("false"))(
"python-use",
"Arguments to pass to python module loader",
cxxopts::value<std::vector<std::string>>())("h,help",
"Print usage");

auto result = options.parse(argc, argv);
auto python_opt = result["python"].as<bool>();

std::string ast_as_json{};

if (result.count("help")) {
std::cout << "Usage: \n\t-j,--json: Load AST from JSON file\n"
<< "\t-p,--python: Use PythonModuleLoader to load a Parser python module and build an AST\n"
<< "\t--python-use: Arguments to pass to PythonModuleLoader. I.e. --python-use=module,path,env_dir\n";
std::cout
<< "Usage: \n\t-j,--json: Load AST from JSON file\n"
<< "\t-p,--python: Use PythonModuleLoader to load a Parser "
"python module and build an AST\n"
<< "\t--python-use: Arguments to pass to PythonModuleLoader. "
"I.e. --python-use=module,path,env_dir\n";
return EXIT_SUCCESS;
}

@@ -70,7 +75,8 @@ int main(int argc, char** argv)
ast_as_json = python_module.call_method_on_module(
"get_source_program_ast_as_json", { source });
} else {
std::cerr << "Error :: Invalid arguments try -j <json file> or -p --python-use=module,path,env_dir"
std::cerr << "Error :: Invalid arguments try -j <json file> or -p "
"--python-use=module,path,env_dir"
<< std::endl;
return EXIT_FAILURE;
}

0 comments on commit b400512

Please sign in to comment.