busybox/shell/hush_test
Denys Vlasenko 216913c290 ash: parser: Add syntax stack for recursive parsing
This closes 10821.

Upstream patch:

    From: Herbert Xu <herbert@gondor.apana.org.au>
    Date: Fri, 9 Mar 2018 00:14:02 +0800
    parser: Add syntax stack for recursive parsing

    Without a stack of syntaxes we cannot correctly these two cases
    together:

            "${a#'$$'}"
            "${a#"${b-'$$'}"}"

    A recursive parser also helps in some other corner cases such
    as nested arithmetic expansion with paratheses.

    This patch adds a syntax stack allocated from the stack using
    alloca.  As a side-effect this allows us to remove the naked
    backslashes for patterns within double-quotes, which means that
    EXP_QPAT also has to go.

    This patch also fixes removes any backslashes that precede right
    braces when they are present within a parameter expansion context,
    and backslashes that precede double quotes within inner double
    quotes inside a parameter expansion in a here-document context.

    The idea of a recursive parser is based on a patch by Harald van
    Dijk.

    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

var_bash3, var_bash4 and var_bash6 tests are updated
with the output given by bash-4.3.43

With this patch, the following tests now pass for ash:

    dollar_repl_slash_bash2.tests
    squote_in_varexp2.tests
    squote_in_varexp.tests
    var_bash4.tests

function                                             old     new   delta
readtoken1                                          2615    2874    +259
synstack_push                                          -      54     +54
evalvar                                              574     571      -3
rmescapes                                            330     310     -20
subevalvar                                          1279    1258     -21
argstr                                              1146    1107     -39
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/4 up/down: 313/-83)           Total: 230 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-02 13:15:37 +02:00
..
hush-arith ash: parser: Add syntax stack for recursive parsing 2018-04-02 13:15:37 +02:00
hush-bugs hush: fix and_or_and_backgrounding.tests failure 2017-07-15 22:51:55 +02:00
hush-getopts hush: fix "getopts" builtin to not be upset by other builtins calling getopt() 2017-08-29 13:38:30 +02:00
hush-glob hush testsuite: add glob_dir.tests 2016-10-02 15:20:57 +02:00
hush-heredoc hush: add a comment where we differ from bash wrt heredoc EOF mark handling 2018-04-01 18:55:00 +02:00
hush-invert hush testsuite: add many tests from ash testsuite 2016-10-02 17:39:31 +02:00
hush-leak hush: do not use ps -o in leak_argv1; do not hardcode path in negate 2009-08-12 14:21:30 +02:00
hush-misc hush: fix raw ^C handlisg in single-quoted strings 2018-01-13 19:14:27 +01:00
hush-parsing ash,hush: handle a few more bkslash-newline cases 2018-04-01 03:04:55 +02:00
hush-psubst hush: fix handling of \" in quoted/unquoted cmd 2010-09-12 15:05:39 +02:00
hush-quoting ash: parser: Add syntax stack for recursive parsing 2018-04-02 13:15:37 +02:00
hush-read shell: optional support for read -t N.NNN, closes 10101 2017-07-20 16:09:31 +02:00
hush-redir ash,hush: fix "saved" redirected fds still visible in children 2018-03-28 18:35:07 +02:00
hush-signals hush: add support for "set -e" 2017-07-14 13:36:48 +02:00
hush-standalone ash: fix nofork bug where environment is not properly passed to a command 2017-11-03 14:16:25 +01:00
hush-vars ash: parser: Add syntax stack for recursive parsing 2018-04-02 13:15:37 +02:00
hush-z_slow hush: plug a memory leak 2010-01-12 06:47:39 +01:00
.gitignore hush_test: ignore generated files 2009-05-21 17:45:26 -04:00
run-all nofork: fix a bug uncovered by hush testsuite (forgotten fflush) 2017-08-03 19:52:47 +02:00