From b58893781bcb8feeba8c4743ae3d5e6083dc010e Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Thu, 8 Nov 2012 04:28:54 +0100 Subject: insert (I) and commands implemented * StateExpectString does not yet handle string building chars --- parser.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'parser.h') diff --git a/parser.h b/parser.h index 8ceb3e2..2798469 100644 --- a/parser.h +++ b/parser.h @@ -39,6 +39,24 @@ protected: } }; +/* + * Super-class for states accepting string arguments + * Opaquely cares about alternative-escape characters, + * string building commands and accumulation into a string + */ +class StateExpectString : public State { +public: + StateExpectString() : State() {} + +private: + virtual State *custom(gchar chr); + +protected: + virtual void initial(void) {} + virtual void process(const gchar *str, gint new_chars) {} + virtual State *done(const gchar *str) = 0; +}; + class StateStart : public State { public: StateStart(); @@ -58,6 +76,13 @@ private: State *custom(gchar chr); }; +class StateInsert : public StateExpectString { +private: + void initial(void); + void process(const gchar *str, gint new_chars); + State *done(const gchar *str); +}; + #include "goto.h" extern gint macro_pc; @@ -66,6 +91,7 @@ extern struct States { StateStart start; StateLabel label; StateControl control; + StateInsert insert; } states; extern enum Mode { -- cgit v1.2.3