diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2013-03-28 18:33:13 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2014-02-15 15:21:52 +0100 |
commit | c6b6aefd36d49aaf873bca20175b929f828589df (patch) | |
tree | 47e46a9e6c869d9d50c27e0d436911cb8bd63ab9 /src/parser.h | |
parent | d374448af8ab690c810757f73ba44f208db96f30 (diff) | |
download | sciteco-c6b6aefd36d49aaf873bca20175b929f828589df.tar.gz |
String::get_coord() calculates line and column of a string position
* use to get line and column into a stack frame
Diffstat (limited to 'src/parser.h')
-rw-r--r-- | src/parser.h | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/parser.h b/src/parser.h index 8aa7ef5..a829b6d 100644 --- a/src/parser.h +++ b/src/parser.h @@ -44,10 +44,13 @@ public: public: gint pos; + gint line, column; class Frame { public: gint pos; + gint line, column; + virtual ~Frame() {} virtual void display(gint nr) = 0; @@ -69,8 +72,8 @@ public: display(gint nr) { interface.msg(Interface::MSG_INFO, - "#%d in Q-Register \"%s\" at %d", - nr, name, pos); + "#%d in Q-Register \"%s\" at %d (%d:%d)", + nr, name, pos, line, column); } }; @@ -90,8 +93,8 @@ public: display(gint nr) { interface.msg(Interface::MSG_INFO, - "#%d in file \"%s\" at %d", - nr, name, pos); + "#%d in file \"%s\" at %d (%d:%d)", + nr, name, pos, line, column); } }; @@ -101,19 +104,15 @@ public: display(gint nr) { interface.msg(Interface::MSG_INFO, - "#%d in toplevel macro at %d", nr, pos); + "#%d in toplevel macro at %d (%d:%d)", + nr, pos, line, column); } }; Error(const gchar *fmt, ...) G_GNUC_PRINTF(2, 3); ~Error(); - inline void - add_frame(Frame *frame) - { - frame->pos = pos; - frames = g_slist_prepend(frames, frame); - } + void add_frame(Frame *frame); void display_short(void); void display_full(void); |