fix dollar quotes in here strings and here documents (regression)
This commit is contained in:
parent
40d11a2066
commit
c2e5737fca
21
check.t
21
check.t
@ -1,4 +1,4 @@
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.316 2009/10/04 03:13:06 tg Exp $
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.317 2009/10/04 12:44:18 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 $
|
||||
@ -5363,8 +5363,27 @@ stdin:
|
||||
cat <<EOF
|
||||
dollar = strchr(s, '$'); /* ' */
|
||||
EOF
|
||||
cat <<$'a\tb'
|
||||
a\tb
|
||||
a b
|
||||
expected-stdout:
|
||||
dollar = strchr(s, '$'); /* ' */
|
||||
a\tb
|
||||
---
|
||||
name: dollar-quotes-in-herestrings
|
||||
description:
|
||||
They are, not parsed in here strings either
|
||||
stdin:
|
||||
cat <<<"dollar = strchr(s, '$'); /* ' */"
|
||||
cat <<<'dollar = strchr(s, '\''$'\''); /* '\'' */'
|
||||
x="dollar = strchr(s, '$'); /* ' */"
|
||||
cat <<<"$x"
|
||||
cat <<<$'a\E[0m\tb'
|
||||
expected-stdout:
|
||||
dollar = strchr(s, '$'); /* ' */
|
||||
dollar = strchr(s, '$'); /* ' */
|
||||
dollar = strchr(s, '$'); /* ' */
|
||||
a[0m b
|
||||
---
|
||||
name: dot-needs-argument
|
||||
description:
|
||||
|
5
lex.c
5
lex.c
@ -22,7 +22,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.98 2009/10/02 18:08:34 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.99 2009/10/04 12:44:19 tg Exp $");
|
||||
|
||||
/*
|
||||
* states while lexing word
|
||||
@ -460,7 +460,8 @@ yylex(int cf)
|
||||
*wp++ = '\0';
|
||||
*wp++ = CSUBST;
|
||||
*wp++ = 'X';
|
||||
} else if (c == '\'') {
|
||||
} else if (c == '\'' && (state == SBASE)) {
|
||||
/* XXX which other states are valid? */
|
||||
*wp++ = OQUOTE;
|
||||
ignore_backslash_newline++;
|
||||
PUSH_STATE(SEQUOTE);
|
||||
|
Loading…
Reference in New Issue
Block a user