1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 11:57:34 +00:00

Shell: Support semicolons for separating commands

This commit is contained in:
Conrad Pankoff 2019-08-30 14:54:05 +10:00 committed by Andreas Kling
parent 3e6a0a0533
commit 6bb6176762
3 changed files with 201 additions and 175 deletions

View file

@ -27,6 +27,10 @@ struct Subcommand {
Vector<Rewiring> rewirings;
};
struct Command {
Vector<Subcommand> subcommands;
};
class Parser {
public:
explicit Parser(const String& input)
@ -34,11 +38,12 @@ public:
{
}
Vector<Subcommand> parse();
Vector<Command> parse();
private:
void commit_token();
void commit_subcommand();
void commit_command();
void do_pipe();
void begin_redirect_read(int fd);
void begin_redirect_write(int fd);
@ -53,6 +58,7 @@ private:
State m_state { Free };
String m_input;
Vector<Command> m_commands;
Vector<Subcommand> m_subcommands;
Vector<String> m_tokens;
Vector<Redirection> m_redirections;