| 782 | } |
| 783 | |
| 784 | bool TokenParser::main_loop(bool break_on_error) |
| 785 | { |
| 786 | for (;;) |
| 787 | { |
| 788 | auto opt_input = m_input_function({}); |
| 789 | if (!opt_input.has_value()) |
| 790 | break; |
| 791 | |
| 792 | auto tokenized_input = tokenize_string(opt_input.release_value()); |
| 793 | if (tokenized_input.is_error()) |
| 794 | { |
| 795 | fprintf(stderr, "banan-sh: %s\n", tokenized_input.error().get_message()); |
| 796 | if (break_on_error) |
| 797 | return false; |
| 798 | continue; |
| 799 | } |
| 800 | |
| 801 | if (auto ret = run(tokenized_input.release_value()); ret.is_error()) |
| 802 | { |
| 803 | fprintf(stderr, "banan-sh: %s\n", ret.error().get_message()); |
| 804 | if (break_on_error) |
| 805 | return false; |
| 806 | continue; |
| 807 | } |
| 808 | } |
| 809 | |
| 810 | return true; |
| 811 | } |
no test coverage detected