Shell: Consume the username when parsing '~user'

Otherwise it will stay there and be parsed as a juxtaposition.
Fixes #5798.
This commit is contained in:
AnotherTest 2021-03-15 11:25:20 +03:30 committed by Andreas Kling
parent f59d58cb76
commit 125be2923c
Notes: sideshowbarker 2024-07-18 21:21:09 +09:00

View file

@ -1686,7 +1686,11 @@ RefPtr<AST::Node> Parser::parse_bareword()
restore_to(rule_start->offset, rule_start->line);
auto ch = consume();
VERIFY(ch == '~');
auto username_length = username.length();
tilde = create<AST::Tilde>(move(username));
// Consume the username (if any)
for (size_t i = 0; i < username_length; ++i)
consume();
}
if (string.is_empty())