diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2013-02-03 18:43:12 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2013-02-08 22:25:06 +0100 |
commit | c37e2d75d09145d2236388e5b739c6a41e4f3780 (patch) | |
tree | 019e90415692db23ce3b8d6f416f134c12fc4512 /src/parser.h | |
parent | 8816b7c7aded7ef8defca0bc6a78b2f5887faea6 (diff) | |
download | sciteco-c37e2d75d09145d2236388e5b739c6a41e4f3780.tar.gz |
delegate commandline replacements ("}") to the cmdline macro level
allows commandline editing scripted by macros
Diffstat (limited to 'src/parser.h')
-rw-r--r-- | src/parser.h | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/parser.h b/src/parser.h index 8ee15d7..865cf85 100644 --- a/src/parser.h +++ b/src/parser.h @@ -26,6 +26,15 @@ /* TECO uses only lower 7 bits for commands */ #define MAX_TRANSITIONS 127 +/* thrown as exception, executed at cmdline macro level */ +class ReplaceCmdline { +public: + gchar *new_cmdline; + gint pos; + + ReplaceCmdline(gchar *_new_cmdline); +}; + class State { public: class Error { @@ -86,14 +95,14 @@ protected: public: State(); - static void input(gchar chr) throw (Error); - State *get_next_state(gchar chr) throw (Error); + static void input(gchar chr) throw (Error, ReplaceCmdline); + State *get_next_state(gchar chr) throw (Error, ReplaceCmdline); protected: static bool eval_colon(void); virtual State * - custom(gchar chr) throw (Error) + custom(gchar chr) throw (Error, ReplaceCmdline) { throw SyntaxError(chr); return NULL; @@ -164,7 +173,7 @@ private: tecoBool delete_words(gint64 n); - State *custom(gchar chr) throw (Error); + State *custom(gchar chr) throw (Error, ReplaceCmdline); }; class StateControl : public State { @@ -253,8 +262,10 @@ extern gchar *strings[2]; extern gchar escape_char; namespace Execute { - void step(const gchar *¯o, gint &stop_pos) throw (State::Error); - void macro(const gchar *macro, bool locals = true) throw (State::Error); + void step(const gchar *¯o, gint &stop_pos) + throw (State::Error, ReplaceCmdline); + void macro(const gchar *macro, bool locals = true) + throw (State::Error, ReplaceCmdline); bool file(const gchar *filename, bool locals = true); } |