From 78ad52e40992d6e68238dc1574d4ae6c6f922d27 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Thu, 30 May 2013 01:46:41 +0200 Subject: fixed Execute::macro() and Execute::file() exceptions * might throw other exceptions that must be associated with the parent macro level's (stack frame) * add position information to "label not found" errors * Error copy constructors --- src/parser.h | 44 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) (limited to 'src/parser.h') diff --git a/src/parser.h b/src/parser.h index 76cd7c7..f7c9bed 100644 --- a/src/parser.h +++ b/src/parser.h @@ -51,6 +51,7 @@ public: gint pos; gint line, column; + virtual Frame *copy() const = 0; virtual ~Frame() {} virtual void display(gint nr) = 0; @@ -63,6 +64,18 @@ public: QRegFrame(const gchar *_name) : name(g_strdup(_name)) {} + Frame * + copy() const + { + Frame *frame = new QRegFrame(name); + + frame->pos = pos; + frame->line = line; + frame->column = column; + + return frame; + } + ~QRegFrame() { g_free(name); @@ -84,6 +97,18 @@ public: FileFrame(const gchar *_name) : name(g_strdup(_name)) {} + Frame * + copy() const + { + Frame *frame = new FileFrame(name); + + frame->pos = pos; + frame->line = line; + frame->column = column; + + return frame; + } + ~FileFrame() { g_free(name); @@ -100,6 +125,18 @@ public: class ToplevelFrame : public Frame { public: + Frame * + copy() const + { + Frame *frame = new ToplevelFrame; + + frame->pos = pos; + frame->line = line; + frame->column = column; + + return frame; + } + void display(gint nr) { @@ -110,6 +147,7 @@ public: }; Error(const gchar *fmt, ...) G_GNUC_PRINTF(2, 3); + Error(const Error &inst); ~Error(); void add_frame(Frame *frame); @@ -407,10 +445,8 @@ extern gchar escape_char; namespace Execute { void step(const gchar *macro, gint stop_pos) throw (State::Error, ReplaceCmdline); - void macro(const gchar *macro, bool locals = true) - throw (State::Error, ReplaceCmdline); - void file(const gchar *filename, bool locals = true) - throw (State::Error, ReplaceCmdline); + void macro(const gchar *macro, bool locals = true); + void file(const gchar *filename, bool locals = true); } #endif -- cgit v1.2.3