From dad1cb18b60ecce925f4ed234553a43fa6c81447 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Thu, 22 Mar 2018 21:41:24 +0800 Subject: parser: Allow newlines within parameter substitution On Fri, Mar 16, 2018 at 11:27:22AM +0800, Herbert Xu wrote: > On Thu, Mar 15, 2018 at 10:49:15PM +0100, Harald van Dijk wrote: > > > > Okay, it can be trivially modified to something that does work in other > > shells (even if it were actually executed), but gets rejected at parse time > > by dash: > > > > if false; then > > : ${$+ > > } > > fi > > That's just a bug in dash's parser with ${} in general, because > it bombs out without the if clause too: > > : ${$+ > } This patch fixes the parsing of newlines with parameter substitution. Signed-off-by: Herbert Xu --- src/parser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/parser.c b/src/parser.c index ae76400..6a8a4a4 100644 --- a/src/parser.c +++ b/src/parser.c @@ -924,7 +924,8 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */ switch(synstack->syntax[c]) { case CNL: /* '\n' */ - if (synstack->syntax == BASESYNTAX) + if (synstack->syntax == BASESYNTAX && + !synstack->varnest) goto endword; /* exit outer loop */ USTPUTC(c, out); nlprompt(); -- cgit 1.4.1 in/cash/arith.h?id=03470766d32782746fd158efab144d9e588ffb0d&follow=1'>diff
Commit message (Collapse)Author
2019-02-12Unify *up scripts into one up.shJune McEnroe
2019-02-12Use a proper fread-realloc loop in hiJune McEnroe
2019-02-12Don't match Rust raw strings inside other stringsJune McEnroe
2019-02-12Add Rust to hiJune McEnroe
This also fixes the block comment pattern to match /* **/ correctly.
2019-02-12Call setlocale in hiJune McEnroe
2019-02-11Install html with -CJune McEnroe
2019-02-10Avoid excessive tags in ttpreJune McEnroe
2019-02-10Generate html for binsJune McEnroe
2019-02-10Use italic for underline in nvim man modeJune McEnroe
This doesn't yet work in Terminal.app: <https://github.com/neovim/neovim/issues/9598>.
2019-02-10Add plain text "language" to hiJune McEnroe
2019-02-10Don't match DQ string inside SQ stringJune McEnroe
2019-02-10Skip only one character if a match fails due to parentJune McEnroe
Really it should skip forward until the parent changes, but this is simpler.
2019-02-10Remove pattend from hiJune McEnroe
2019-02-10Replace uses of pattend with newline patternsJune McEnroe
2019-02-10Add hi debug outputJune McEnroe
2019-02-10Actually do HTML &quot; escapingJune McEnroe
2019-02-10Set git commit.verboseJune McEnroe
2019-02-10Add back missing static keywordJune McEnroe