Shell: Accept IoNumber as a valid redirection target

This commit is contained in:
Ali Mohammad Pur 2023-09-21 02:36:53 +03:30 committed by Jelle Raaijmakers
parent 0214e9b905
commit 986130d9ea
Notes: sideshowbarker 2024-07-17 16:23:06 +09:00

View file

@ -2073,7 +2073,16 @@ ErrorOr<RefPtr<AST::Node>> Parser::parse_io_file(AST::Position start_position, O
auto io_operator_token = consume();
auto word = TRY(parse_word());
RefPtr<AST::Node> word;
if (peek().type == Token::Type::IoNumber) {
auto token = consume();
word = make_ref_counted<AST::BarewordLiteral>(
token.position.value_or(empty_position()),
token.value);
} else {
word = TRY(parse_word());
}
if (!word) {
m_token_index = start_index;
return nullptr;