summaryrefslogtreecommitdiff
path: root/Shell/Parser.cpp
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2020-05-10 11:47:12 +0430
committerAndreas Kling <kling@serenityos.org>2020-05-10 10:23:05 +0200
commit1d0d0e9d0015a18b5c6538a87ba41dcb19d04b03 (patch)
treea0a9e8c614f8358bcf75b19c97e6ce79dcbfff67 /Shell/Parser.cpp
parenta862c230b16a05ca661c71c47f07df4bb1f9276d (diff)
downloadserenity-1d0d0e9d0015a18b5c6538a87ba41dcb19d04b03.zip
Shell: Parse comments
Diffstat (limited to 'Shell/Parser.cpp')
-rw-r--r--Shell/Parser.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/Shell/Parser.cpp b/Shell/Parser.cpp
index e7be78647d..0c1d17eebb 100644
--- a/Shell/Parser.cpp
+++ b/Shell/Parser.cpp
@@ -86,6 +86,19 @@ Vector<Command> Parser::parse()
char ch = m_input.characters()[i];
switch (state()) {
case State::Free:
+ if (ch == '#') {
+ commit_token(Token::Bare);
+
+ while (i < m_input.length()) {
+ ch = m_input.characters()[++i];
+ ++m_position;
+ if (ch == '\n')
+ break;
+ m_token.append(ch);
+ }
+ commit_token(Token::Comment);
+ break;
+ }
if (ch == ' ') {
commit_token(Token::Bare);
break;