From f0f420be3d80366a54598f6742ef73114651f3c4 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Mon, 19 Nov 2012 22:40:31 +0100 Subject: errors when label cannot be found at end of macro invocation * on the command line the line terminating is not accepted when a label was not found --- cmdline.cpp | 7 +++++++ parser.cpp | 5 +++++ qbuffers.cpp | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/cmdline.cpp b/cmdline.cpp index d8e71ac..5d6700f 100644 --- a/cmdline.cpp +++ b/cmdline.cpp @@ -129,6 +129,13 @@ process_edit_cmd(gchar key) case '\x1B': if (cmdline && cmdline[cmdline_len - 1] == '\x1B') { + if (Goto::skip_label) { + interface.msg(Interface::MSG_ERROR, + "Label \"%s\" not found", + Goto::skip_label); + break; + } + if (quit_requested) { /* FIXME */ exit(EXIT_SUCCESS); diff --git a/parser.cpp b/parser.cpp index 5d41b5e..59305bc 100644 --- a/parser.cpp +++ b/parser.cpp @@ -81,8 +81,13 @@ file_execute(const gchar *filename) try { macro_execute(p ? p+1 : macro); + if (Goto::skip_label) + throw State::Error("Label \"%s\" not found", + Goto::skip_label); } catch (...) { g_free(macro); + g_free(Goto::skip_label); + Goto::skip_label = NULL; return false; } g_free(macro); diff --git a/qbuffers.cpp b/qbuffers.cpp index 3c11ab0..e90b505 100644 --- a/qbuffers.cpp +++ b/qbuffers.cpp @@ -164,11 +164,16 @@ QRegister::execute(void) throw (State::Error) try { macro_execute(str); + if (Goto::skip_label) + throw State::Error("Label \"%s\" not found", + Goto::skip_label); } catch (...) { g_free(str); macro_pc = parent_pc; States::current = parent_state; Goto::table = parent_goto_table; + g_free(Goto::skip_label); + Goto::skip_label = NULL; throw; /* forward */ } -- cgit v1.2.3