aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/parser.h
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2013-05-30 01:46:41 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2014-02-15 15:21:53 +0100
commit78ad52e40992d6e68238dc1574d4ae6c6f922d27 (patch)
treea254003b43ac62957a1cc0a1f8275e527240a135 /src/parser.h
parent1f8d558597098f78aeba4ed5f70824f98dc60060 (diff)
downloadsciteco-78ad52e40992d6e68238dc1574d4ae6c6f922d27.tar.gz
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
Diffstat (limited to 'src/parser.h')
-rw-r--r--src/parser.h44
1 files changed, 40 insertions, 4 deletions
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