diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lexer/token.cc | 7 | ||||
| -rw-r--r-- | src/option.cc | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/lexer/token.cc b/src/lexer/token.cc index ab9f263..26ad1f2 100644 --- a/src/lexer/token.cc +++ b/src/lexer/token.cc @@ -54,8 +54,7 @@ void T_lexer::bracket_depth_changer(char c, int &bracket_depth) loggerln("changed depth: {}", bracket_depth); if (bracket_depth < 0) { - cerr << "Ooooops bracket unmatched, quitting" << endl; - exit(-1); // TODO: std::expected or what, rather than quitting + throw T_error{error_code::TOKEN_UNMATCHED_BRACKET, "tokenizer: unmatched bracket(s)"}; } return; } @@ -194,6 +193,10 @@ int T_lexer::tokenizer(const string &s) continue; } } + + if (bracket_depth != 0) + throw T_error{error_code::TOKEN_UNMATCHED_BRACKET, "tokenizer: unmatched bracket(s)"}; + return 0; } diff --git a/src/option.cc b/src/option.cc index 2cae4ef..9396dad 100644 --- a/src/option.cc +++ b/src/option.cc @@ -58,7 +58,7 @@ Usage: ccshell [-hvp] \n\ -v(=<bool>) print additional diagnostic information \n\ -p(=<bool>) do not emit a command prompt \ " << endl; - exit(1); + exit(0); } } |
