busybox/shell/ash_test/ash-quoting
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
..
bkslash_case1.right ash : fix double-quoted "\z" handling 2018-02-13 14:44:11 +01:00
bkslash_case1.tests ash : fix double-quoted "\z" handling 2018-02-13 14:44:11 +01:00
bkslash_in_varexp1.right shell: tweak bkslash_in_varexp.tests, add bkslash_in_varexp1.tests 2018-03-02 18:12:12 +01:00
bkslash_in_varexp1.tests shell: tweak bkslash_in_varexp.tests, add bkslash_in_varexp1.tests 2018-03-02 18:12:12 +01:00
bkslash_in_varexp.right shell: two new tests, both fail for ash and hush 2018-03-02 17:13:22 +01:00
bkslash_in_varexp.tests shell: tweak bkslash_in_varexp.tests, add bkslash_in_varexp1.tests 2018-03-02 18:12:12 +01:00
dollar_repl_slash_bash1.right
dollar_repl_slash_bash1.tests hush testsuite: add many tests from ash testsuite 2016-10-02 17:39:31 +02:00
dollar_repl_slash_bash2.right ash,hush: new test dollar_repl_slash_bash2.tests 2018-03-30 23:25:24 +02:00
dollar_repl_slash_bash2.tests ash,hush: new test dollar_repl_slash_bash2.tests 2018-03-30 23:25:24 +02:00
dollar_squote_bash1.right
dollar_squote_bash1.tests
dollar_squote_bash2.right
dollar_squote_bash2.tests
mode_x.right ash: add LINENO support 2018-01-27 22:02:05 +01:00
mode_x.tests ash: improve set -x to quote strings as necessary 2017-07-21 13:20:14 +02:00
quoted_punct.right ash: fix escaping of a few characters (broken by last commits) 2017-07-05 22:19:28 +02:00
quoted_punct.tests ash: fix escaping of a few characters (broken by last commits) 2017-07-05 22:19:28 +02:00
squote_in_varexp1.right hush: fix a='a\\'; echo "${a%\\\\}" 2018-03-02 20:48:36 +01:00
squote_in_varexp1.tests hush: fix a='a\\'; echo "${a%\\\\}" 2018-03-02 20:48:36 +01:00
squote_in_varexp2.right hush: fix a='a\\'; echo "${a%\\\\}" 2018-03-02 20:48:36 +01:00
squote_in_varexp2.tests hush: fix a='a\\'; echo "${a%\\\\}" 2018-03-02 20:48:36 +01:00
squote_in_varexp3.right ash: parser: Add syntax stack for recursive parsing 2018-04-02 13:15:37 +02:00
squote_in_varexp3.tests ash: parser: Add syntax stack for recursive parsing 2018-04-02 13:15:37 +02:00
squote_in_varexp.right shell: two new tests, both fail for ash and hush 2018-03-02 17:13:22 +01:00
squote_in_varexp.tests shell: two new tests, both fail for ash and hush 2018-03-02 17:13:22 +01:00
unicode_8x_chars.right ash: fix matching of unicode greek letter rho (cf 81) and similar cases 2017-07-05 19:10:21 +02:00
unicode_8x_chars.tests ash: fix matching of unicode greek letter rho (cf 81) and similar cases 2017-07-05 19:10:21 +02:00