2016-01-30 03:23:14 +00:00
|
|
|
|
|
|
|
#ifndef __phase2_h__
|
|
|
|
#define __phase2_h__
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <functional>
|
|
|
|
|
|
|
|
class phase2 {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2016-08-16 20:47:20 +00:00
|
|
|
typedef std::function<void(int, std::string &&)> next_function_type;
|
2016-01-30 17:44:42 +00:00
|
|
|
|
2016-08-16 20:47:20 +00:00
|
|
|
phase2() = default;
|
2016-01-30 17:44:42 +00:00
|
|
|
|
2016-08-16 20:47:20 +00:00
|
|
|
void parse(std::string &&);
|
2016-01-30 03:23:14 +00:00
|
|
|
void finish();
|
|
|
|
|
2016-08-16 20:47:20 +00:00
|
|
|
void reset();
|
|
|
|
void abort() { reset(); }
|
2016-01-30 03:23:14 +00:00
|
|
|
|
2016-08-16 20:47:20 +00:00
|
|
|
bool continuation() const { return false; }
|
2016-01-31 05:41:02 +00:00
|
|
|
|
2016-08-16 20:47:20 +00:00
|
|
|
void set_next(next_function_type &&fx) { _then = std::move(fx); }
|
2016-02-05 17:42:22 +00:00
|
|
|
|
2016-01-30 03:23:14 +00:00
|
|
|
private:
|
|
|
|
|
2016-08-16 20:47:20 +00:00
|
|
|
void parse(int type, std::string &&s);
|
2016-01-30 17:44:42 +00:00
|
|
|
|
2016-01-30 03:23:14 +00:00
|
|
|
std::string scratch;
|
|
|
|
int type = 0;
|
2016-06-26 17:04:32 +00:00
|
|
|
int pcount = 0;
|
2016-01-30 03:23:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
void flush();
|
|
|
|
bool special();
|
2016-07-23 15:54:46 +00:00
|
|
|
int classify();
|
2016-01-30 03:23:14 +00:00
|
|
|
void exec();
|
|
|
|
|
2016-08-16 20:47:20 +00:00
|
|
|
next_function_type _then;
|
2016-01-30 03:23:14 +00:00
|
|
|
};
|
|
|
|
|
2016-01-30 17:44:42 +00:00
|
|
|
|
2016-01-30 03:23:14 +00:00
|
|
|
#endif
|