summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2018-04-03 00:40:25 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2018-04-19 18:19:29 +0800
commit6348e861b20d0b90275970af7357ac35ef956f16 (patch)
tree4f0d2e94ecf3ceecb14eba8a601fd4ffa8e00114 /src
parentman: correct typos, iff -> if (diff)
downloaddash-6348e861b20d0b90275970af7357ac35ef956f16.tar.gz
dash-6348e861b20d0b90275970af7357ac35ef956f16.zip
parser: Fix parsing of ${}
dash -c 'echo ${}' should print "Bad subtitution" but instead
fails with "Syntax error: Missing '}'".  This is caused by us
reading an extra character beyond the right brace.  This patch
fixes it so that this construct only fails during expansion rather
than during parsing.

Fixes: 3df3edd13389 ("[PARSER] Report substition errors at...")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r--src/parser.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/parser.c b/src/parser.c
index 6a8a4a4..efa8060 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -1262,7 +1262,7 @@ varname:
 				STPUTC(c, out);
 				c = pgetc_eatbnl();
 			} while (is_digit(c));
-		} else {
+		} else if (c != '}') {
 			int cc = c;
 
 			c = pgetc_eatbnl();
@@ -1290,7 +1290,8 @@ varname:
 			}
 
 			USTPUTC(cc, out);
-		}
+		} else
+			goto badsub;
 
 		if (subtype == 0) {
 			int cc = c;
rl/commit/input.c?h=twitch&id=da8deff7679431267dbb6aee91305f1ea62de91f&follow=1'>Handle errors from editFn, etc.June McEnroe 2022-02-19Reimplement text macrosJune McEnroe 2022-02-19Factor out input handling to input.cJune McEnroe 2022-02-19Factor out window management to window.cJune McEnroe 2022-02-19Enable -Wmissing-prototypesJune McEnroe In other words, warn when a function is missing static. I don't see why this isn't in -Wextra. 2022-02-19Fix edit.[ch] license notice additional permissionsJune McEnroe 2022-02-19Run line editing testsJune McEnroe I know, it feels wrong. 2022-02-18Implement new line editing "library"June McEnroe Losing tab complete and text macros, for now. This new implementation works on an instance of a struct and does not interact with the rest of catgirl, making it possible to copy into another project. Unlike existing line editing libraries, this one is entirely abstract and can be rendered externally. My goal with this library is to be able to implement vi mode. Since it operates on struct instances rather than globals, it might also be possible to give catgirl separate line editing buffers for each window, which would be a nice UX improvement. 2022-02-18Simplify cursor positioning in inputJune McEnroe Do some extra work by adding the portion before the cursor to the input window twice, but simplify the interaction with the split point. This fixes the awkward behaviour when moving the cursor across colour codes where the code would be partially interpreted up to the cursor. 2022-02-18Fix M-f orderingJune McEnroe 2022-02-12Move sandman build to scripts/MakefileJune McEnroe 2022-02-12Use compat_readpassphrase.c on LinuxJune McEnroe 2022-02-12Copy RPP defines from oconfigureJune McEnroe