diff options
author | AnotherTest <ali.mpfard@gmail.com> | 2020-05-10 11:47:12 +0430 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-10 10:23:05 +0200 |
commit | 1d0d0e9d0015a18b5c6538a87ba41dcb19d04b03 (patch) | |
tree | a0a9e8c614f8358bcf75b19c97e6ce79dcbfff67 /Shell/Parser.cpp | |
parent | a862c230b16a05ca661c71c47f07df4bb1f9276d (diff) | |
download | serenity-1d0d0e9d0015a18b5c6538a87ba41dcb19d04b03.zip |
Shell: Parse comments
Diffstat (limited to 'Shell/Parser.cpp')
-rw-r--r-- | Shell/Parser.cpp | 13 |
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; |