Pārlūkot izejas kodu

Shell: Consume the username when parsing '~user'

Otherwise it will stay there and be parsed as a juxtaposition.
Fixes #5798.
AnotherTest 4 gadi atpakaļ
vecāks
revīzija
125be2923c
1 mainītis faili ar 4 papildinājumiem un 0 dzēšanām
  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())