Snel
A shell implementation for A.U.TH (Operating Systems Lab)
|
#include <sequencer.h>
Public Member Functions | |
Sequencer & | parse (const std::string &input) |
Sequencer & | execute () |
Private Member Functions | |
bool | is_seperator (std::string &s) |
separator trait predicate More... | |
bool | is_pipe (std::string &s) |
pipe trait predicate | |
Private Attributes | |
std::vector< std::vector< Child > > | seq_ {} |
The sequencer data representation. | |
The main object to represent and handle a command flow.
We store commands as vector of vectors of commands. The inner vector represent a command chain. For example the line:
is an input with 2 command chains and result to a:
By storing them in different vector we make the execution model simpler. Each chain can stopped and the sequencer will continue with the next chain etc... So in this example if more
returns false(child::execute() returned true), then uname
will not parsed and executed and the flow will continue to cat
Definition at line 160 of file sequencer.h.
Sequencer & snel::Sequencer::execute | ( | ) |
The main sequencer execution. We recurse for each command chain and each child in the chain and we parse-execute the child
Definition at line 343 of file sequencer.cpp.
|
inlineprivate |
Sequencer & snel::Sequencer::parse | ( | const std::string & | input | ) |
First parsing of each line. We split input in ';' to create command chains and split each chain further to create child tokens. These token will be processed further by the child's make_arguments()
input | The input string to parse |
Definition at line 299 of file sequencer.cpp.