浏览代码

Shell: Consume the username when parsing '~user'

Otherwise it will stay there and be parsed as a juxtaposition.
Fixes #5798.
AnotherTest 4 年之前
父节点
当前提交
125be2923c
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      Userland/Shell/Parser.cpp

+ 4 - 0
Userland/Shell/Parser.cpp

@@ -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())