aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2014-11-10 15:05:55 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2014-11-10 15:05:55 +0100
commit98d1948ac459d19d7ac28f5e8b652f2709df175f (patch)
tree05b21ae3e1944f8ead91426d25afc8f672b2ddc9 /src
parenta8411ad5dca4cf7d5a796028ee98a0471bad5447 (diff)
downloadsciteco-98d1948ac459d19d7ac28f5e8b652f2709df175f.tar.gz
clarified conditions when <;> should yield an error
Diffstat (limited to 'src')
-rw-r--r--src/parser.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index 9f5be4c..6350174 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -932,6 +932,9 @@ StateStart::custom(gchar chr)
* This way, you may break on search success/failures
* without colon-modifying the search command (or at a
* later point).
+ *
+ * Executing \(lq;\(rq outside of iterations yields an
+ * error.
*/
case ';':
BEGIN_EXEC(this);
@@ -943,9 +946,15 @@ StateStart::custom(gchar chr)
if (IS_FAILURE(rc)) {
expressions.discard_args();
+ /*
+ * FIXME: it would be better accroding to the
+ * TECO standard to throw an error
+ * always when we're not in a loop.
+ * But this is not easy to find out without
+ * modifying the expression stack.
+ */
if (expressions.pop_op() != Expressions::OP_LOOP)
- /* FIXME: what does standard teco say to this */
- throw Error("Cannot break from loop without loop");
+ throw Error("<;> only allowed in iterations");
expressions.pop_num(); /* pc */
expressions.pop_num(); /* counter */