#ifndef __phase2_h__ #define __phase2_h__ #include #include #include #include typedef std::unique_ptr command_ptr; typedef std::vector command_ptr_vector; class phase2 { public: typedef std::function pipe_function; void process(const std::string &line); void finish(); virtual void syntax_error(); virtual void parse_accept(); virtual void parse(int, std::string &&); phase2 &operator >>=(pipe_function f) { pipe_to = f; return *this; } private: std::string scratch; int type = 0; bool error = false; bool immediate = false; pipe_function pipe_to; void flush(); bool special(); void classify(); void exec(); command_ptr_vector command_queue; }; #endif