From 98d1948ac459d19d7ac28f5e8b652f2709df175f Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Mon, 10 Nov 2014 15:05:55 +0100 Subject: clarified conditions when <;> should yield an error --- src/parser.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src') 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 */ -- cgit v1.2.3