summary refs log tree commit diff
path: root/src/mkbuiltins
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2018-03-09 00:14:02 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2018-03-22 00:29:58 +0800
commitab1cecb4047864afb247a6ed691e7f59ce716f2c (patch)
tree4e4914acd4854f273fa7da4af24f7b86c83672fd /src/mkbuiltins
parentparser: use pgetc_eatbnl() in more places (diff)
downloaddash-ab1cecb4047864afb247a6ed691e7f59ce716f2c.tar.gz
dash-ab1cecb4047864afb247a6ed691e7f59ce716f2c.zip
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>
Diffstat (limited to '')
0 files changed, 0 insertions, 0 deletions