diff options
author | Peter Stephenson <pws@zsh.org> | 2015-05-15 10:19:53 +0100 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2015-05-15 10:19:53 +0100 |
commit | 0da0a0b9c735c5bf0702a0f034976c01ae50fa66 (patch) | |
tree | c1e88de241382f2c7010b43fbf15e1fdf3948ae4 /Src/subst.c | |
parent | 59a874f94eea24f3697356d536541aa80b7068bf (diff) | |
download | zsh-0da0a0b9c735c5bf0702a0f034976c01ae50fa66.tar.gz zsh-0da0a0b9c735c5bf0702a0f034976c01ae50fa66.tar.xz zsh-0da0a0b9c735c5bf0702a0f034976c01ae50fa66.zip |
35153: nested math substitution
Diffstat (limited to 'Src/subst.c')
-rw-r--r-- | Src/subst.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Src/subst.c b/Src/subst.c index 5a12e127f..d4a04b8e5 100644 --- a/Src/subst.c +++ b/Src/subst.c @@ -259,10 +259,19 @@ stringsubst(LinkList list, LinkNode node, int pf_flags, int asssub) #endif str--; } else if (c == Inparmath) { - /* Math substitution of the form $((...)) */ + /* + * Math substitution of the form $((...)). + * These can be nested, for goodness sake... + */ + int mathpar = 1; str[-1] = '\0'; - while (*str != Outparmath && *str) + while (mathpar && *str) { str++; + if (*str == Outparmath) + mathpar--; + else if (*str == Inparmath) + mathpar++; + } if (*str != Outparmath) { zerr("failed to find end of math substitution"); return NULL; |