mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-11-21 00:51:07 +01:00
35688: Improved attempt to turn case wordcode into text.
This commit is contained in:
parent
f2b2271fbe
commit
290354ff46
2 changed files with 15 additions and 7 deletions
|
|
@ -1,3 +1,8 @@
|
||||||
|
2015-07-05 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||||
|
|
||||||
|
* 35688: Src/text.c: Slightly more nearly definitive version of
|
||||||
|
turning wordcode case statements back to text.
|
||||||
|
|
||||||
2015-07-04 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
2015-07-04 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||||
|
|
||||||
* 35682: Src/text.c, plus Test/A01grammar.ztst: turning case
|
* 35682: Src/text.c, plus Test/A01grammar.ztst: turning case
|
||||||
|
|
|
||||||
17
Src/text.c
17
Src/text.c
|
|
@ -681,7 +681,7 @@ gettext2(Estate state)
|
||||||
case WC_CASE:
|
case WC_CASE:
|
||||||
if (!s) {
|
if (!s) {
|
||||||
Wordcode end = state->pc + WC_CASE_SKIP(code);
|
Wordcode end = state->pc + WC_CASE_SKIP(code);
|
||||||
wordcode nalts, ialts;
|
wordcode ialts;
|
||||||
|
|
||||||
taddstr("case ");
|
taddstr("case ");
|
||||||
taddstr(ecgetstr(state, EC_NODUP, NULL));
|
taddstr(ecgetstr(state, EC_NODUP, NULL));
|
||||||
|
|
@ -695,6 +695,7 @@ gettext2(Estate state)
|
||||||
taddstr("esac");
|
taddstr("esac");
|
||||||
stack = 1;
|
stack = 1;
|
||||||
} else {
|
} else {
|
||||||
|
Wordcode prev_pc;
|
||||||
tindent++;
|
tindent++;
|
||||||
if (tnewlins)
|
if (tnewlins)
|
||||||
taddnl(0);
|
taddnl(0);
|
||||||
|
|
@ -702,7 +703,8 @@ gettext2(Estate state)
|
||||||
taddchr(' ');
|
taddchr(' ');
|
||||||
taddstr("(");
|
taddstr("(");
|
||||||
code = *state->pc++;
|
code = *state->pc++;
|
||||||
nalts = ialts = *state->pc++;
|
prev_pc = state->pc++;
|
||||||
|
ialts = *prev_pc;
|
||||||
while (ialts--) {
|
while (ialts--) {
|
||||||
taddstr(ecgetstr(state, EC_NODUP, NULL));
|
taddstr(ecgetstr(state, EC_NODUP, NULL));
|
||||||
state->pc++;
|
state->pc++;
|
||||||
|
|
@ -713,11 +715,11 @@ gettext2(Estate state)
|
||||||
tindent++;
|
tindent++;
|
||||||
n = tpush(code, 0);
|
n = tpush(code, 0);
|
||||||
n->u._case.end = end;
|
n->u._case.end = end;
|
||||||
n->pop = (state->pc - 2 - nalts + WC_CASE_SKIP(code)
|
n->pop = (prev_pc + WC_CASE_SKIP(code) >= end);
|
||||||
>= end);
|
|
||||||
}
|
}
|
||||||
} else if (state->pc < s->u._case.end) {
|
} else if (state->pc < s->u._case.end) {
|
||||||
wordcode nalts, ialts;
|
Wordcode prev_pc;
|
||||||
|
wordcode ialts;
|
||||||
dec_tindent();
|
dec_tindent();
|
||||||
switch (WC_CASE_TYPE(code)) {
|
switch (WC_CASE_TYPE(code)) {
|
||||||
case WC_CASE_OR:
|
case WC_CASE_OR:
|
||||||
|
|
@ -738,7 +740,8 @@ gettext2(Estate state)
|
||||||
taddchr(' ');
|
taddchr(' ');
|
||||||
taddstr("(");
|
taddstr("(");
|
||||||
code = *state->pc++;
|
code = *state->pc++;
|
||||||
nalts = ialts = *state->pc++;
|
prev_pc = state->pc++;
|
||||||
|
ialts = *prev_pc;
|
||||||
while (ialts--) {
|
while (ialts--) {
|
||||||
taddstr(ecgetstr(state, EC_NODUP, NULL));
|
taddstr(ecgetstr(state, EC_NODUP, NULL));
|
||||||
state->pc++;
|
state->pc++;
|
||||||
|
|
@ -748,7 +751,7 @@ gettext2(Estate state)
|
||||||
taddstr(") ");
|
taddstr(") ");
|
||||||
tindent++;
|
tindent++;
|
||||||
s->code = code;
|
s->code = code;
|
||||||
s->pop = ((state->pc - 2 - nalts + WC_CASE_SKIP(code)) >=
|
s->pop = (prev_pc + WC_CASE_SKIP(code) >=
|
||||||
s->u._case.end);
|
s->u._case.end);
|
||||||
} else {
|
} else {
|
||||||
dec_tindent();
|
dec_tindent();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue