2
0
Fork 0
mirror of https://github.com/fish-shell/fish-shell synced 2025-02-13 04:33:33 +00:00

Also allow unclosed quotes in some places

See 
This commit is contained in:
Johannes Altmanninger 2021-02-09 22:36:27 +01:00
parent 38b95defbd
commit 86707378cc
2 changed files with 8 additions and 2 deletions

View file

@ -1112,7 +1112,8 @@ class ast_t::populator_t {
if (!token.allows_token(peek_token().type)) {
const auto &peek = peek_token();
if ((flags_ & parse_flag_leave_unterminated) &&
peek.tok_error == tokenizer_error_t::unterminated_subshell) {
(peek.tok_error == tokenizer_error_t::unterminated_quote ||
peek.tok_error == tokenizer_error_t::unterminated_subshell)) {
return;
}
@ -1140,7 +1141,8 @@ class ast_t::populator_t {
const auto &peek = peek_token();
if ((flags_ & parse_flag_leave_unterminated) &&
peek.tok_error == tokenizer_error_t::unterminated_subshell) {
(peek.tok_error == tokenizer_error_t::unterminated_quote ||
peek.tok_error == tokenizer_error_t::unterminated_subshell)) {
return;
}

View file

@ -4798,6 +4798,10 @@ static void test_new_parser_ad_hoc() {
errors.clear();
ast = ast_t::parse(L"for x in (", parse_flag_leave_unterminated, &errors);
do_test(errors.size() == 1 && errors.at(0).code == parse_error_tokenizer_unterminated_subshell);
errors.clear();
ast = ast_t::parse(L"begin; echo '", parse_flag_leave_unterminated, &errors);
do_test(errors.size() == 1 && errors.at(0).code == parse_error_tokenizer_unterminated_quote);
}
static void test_new_parser_errors() {