| 57 | }; |
| 58 | |
| 59 | arguments parse_args(int const argc, char **const argv) |
| 60 | { |
| 61 | auto app = CLI::App("evm opcode parser/printer"); |
| 62 | auto args = arguments{}; |
| 63 | |
| 64 | app.add_option("filenames", args.filenames, "List of files to process") |
| 65 | ->check(CLI::ExistingFile); |
| 66 | |
| 67 | app.add_flag( |
| 68 | "-b,--binary", |
| 69 | args.binary, |
| 70 | "process input files as binary and show evm opcodes/data as text"); |
| 71 | |
| 72 | app.add_flag("-c,--compile", args.compile, "compile the input files"); |
| 73 | app.add_option( |
| 74 | "--validate", |
| 75 | args.validate, |
| 76 | std::format( |
| 77 | "validate input files (default: {})" |
| 78 | " - reports incorrect errors in some programs", |
| 79 | args.validate)); |
| 80 | |
| 81 | app.add_flag("-v,--verbose", args.verbose, "send debug info to stdout"); |
| 82 | |
| 83 | app.add_flag( |
| 84 | "-s,--stdin", args.stdin, "read from stdin and write to stdout"); |
| 85 | |
| 86 | try { |
| 87 | app.parse(argc, argv); |
| 88 | } |
| 89 | catch (CLI::ParseError const &e) { |
| 90 | std::exit(app.exit(e)); |
| 91 | } |
| 92 | |
| 93 | return args; |
| 94 | } |
| 95 | |
| 96 | std::vector<uint8_t> do_parse( |
| 97 | parser_config const &config, std::string const &filename, |