we need not only store into the retrace buffers recursively but also ungetsc

This commit is contained in:
tg 2011-03-13 16:20:45 +00:00
parent 91ec264cb8
commit 4e7d9bdb33
2 changed files with 13 additions and 4 deletions

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.425 2011/03/13 16:03:49 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.426 2011/03/13 16:20:43 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
@ -6958,6 +6958,8 @@ stdin:
TEST=5678; echo ${TEST: $(case 1 in 1) echo 1;; *) echo 2;; esac)}
(( a = $(case 1 in (1) echo 1;; (*) echo 2;; esac) )); echo $a.
(( a = $(case 1 in 1) echo 1;; *) echo 2;; esac) )); echo $a.
a=($(($(case 1 in (1) echo 1;; (*) echo 2;; esac)+10))); echo ${a[0]}.
a=($(($(case 1 in 1) echo 1;; *) echo 2;; esac)+20))); echo ${a[0]}.
expected-stdout:
yes
yes
@ -6969,6 +6971,8 @@ expected-stdout:
678
1.
1.
11.
21.
---
name: comsub-2
description:

11
lex.c
View File

@ -22,7 +22,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.140 2011/03/13 16:07:36 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.141 2011/03/13 16:20:45 tg Exp $");
/*
* states while lexing word
@ -1729,13 +1729,18 @@ arraysub(char **strp)
static void
ungetsc(int c)
{
struct sretrace_info *rp = retrace_info;
if (backslash_skip)
backslash_skip--;
/* Don't unget EOF... */
if (source->str == null && c == '\0')
return;
if (retrace_info && Xlength(retrace_info->xs, retrace_info->xp))
retrace_info->xp--;
while (rp) {
if (Xlength(rp->xs, rp->xp))
rp->xp--;
rp = rp->next;
}
ungetsc_(c);
}
static void