about summary refs log tree commit diff
path: root/Src/text.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2004-06-22 13:09:55 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2004-06-22 13:09:55 +0000
commitd591334e9d616830fbd24909db2e21ac4b959742 (patch)
tree65b44f10e6995c95605c8a56c3ca0fd9bfe6ad9d /Src/text.c
parent6a1d913bd6214d7ca7f8cf1a82efef1fa4bae101 (diff)
downloadzsh-d591334e9d616830fbd24909db2e21ac4b959742.tar.gz
zsh-d591334e9d616830fbd24909db2e21ac4b959742.tar.xz
zsh-d591334e9d616830fbd24909db2e21ac4b959742.zip
20076, 20084: { ... } always { ... } syntax.
Diffstat (limited to 'Src/text.c')
-rw-r--r--Src/text.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/Src/text.c b/Src/text.c
index 794a04df9..f7d80ae73 100644
--- a/Src/text.c
+++ b/Src/text.c
@@ -350,6 +350,8 @@ gettext2(Estate state)
 		taddnl();
 		n = tpush(code, 1);
 		n->u._subsh.end = state->pc + WC_SUBSH_SKIP(code);
+		/* skip word only use for try/always */
+		state->pc++;
 	    } else {
 		state->pc = s->u._subsh.end;
 		tindent--;
@@ -365,6 +367,8 @@ gettext2(Estate state)
 		taddnl();
 		n = tpush(code, 1);
 		n->u._subsh.end = state->pc + WC_CURSH_SKIP(code);
+		/* skip word only use for try/always */
+		state->pc++;
 	    } else {
 		state->pc = s->u._subsh.end;
 		tindent--;
@@ -721,6 +725,30 @@ gettext2(Estate state)
 	    taddstr("))");
 	    stack = 1;
 	    break;
+	case WC_TRY:
+	    if (!s) {
+		taddstr("{");
+		tindent++;
+		taddnl();
+		n = tpush(code, 0);
+		state->pc++;
+		/* this is the end of the try block alone */
+		n->u._subsh.end = state->pc + WC_CURSH_SKIP(state->pc[-1]);
+	    } else if (!s->pop) {
+		state->pc = s->u._subsh.end;
+		tindent--;
+		taddnl();
+		taddstr("} always {");
+		tindent++;
+		taddnl();
+		s->pop = 1;
+	    } else {
+		tindent--;
+		taddnl();
+		taddstr("}");
+		stack = 1;
+	    }
+	    break;
 	case WC_END:
 	    stack = 1;
 	    break;