summary refs log tree commit diff
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2009-02-22 19:47:52 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2009-02-22 19:47:52 +0800
commit22e8fb41be2bfd0e6757c80d6365af9080a3b4a1 (patch)
tree911ba3e5f5f5971ee505704a323e43fcc0d03b88
parent[JOBS] Do not close stderr when /dev/tty fails to open (diff)
downloaddash-22e8fb41be2bfd0e6757c80d6365af9080a3b4a1.tar.gz
dash-22e8fb41be2bfd0e6757c80d6365af9080a3b4a1.zip
[PARSER] Allow newlines after var name in for statements
POSIX allows newlines before the "in" keyword in for statements
so we should too.

Thanks to Maximilian Bernöcker for reporting this.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--ChangeLog1
-rw-r--r--src/parser.c4
2 files changed, 3 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index dcb7182..d7e0f79 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@
 	* Fix dowait signal race.
 	* Remove EXSIG.
 	* Do not close stderr when /dev/tty fails to open.
+	* Allow newlines after var name in for statements.
 
 2009-01-14  Herbert Xu <herbert@gondor.apana.org.au>
 
diff --git a/src/parser.c b/src/parser.c
index ab66f30..425c457 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -357,7 +357,7 @@ TRACE(("expecting DO got %s %s\n", tokname[got], got == TWORD ? wordtext : ""));
 		n1 = (union node *)stalloc(sizeof (struct nfor));
 		n1->type = NFOR;
 		n1->nfor.var = wordtext;
-		checkkwd = CHKKWD | CHKALIAS;
+		checkkwd = CHKNL | CHKKWD | CHKALIAS;
 		if (readtoken() == TIN) {
 			app = &ap;
 			while (readtoken() == TWORD) {
@@ -383,7 +383,7 @@ TRACE(("expecting DO got %s %s\n", tokname[got], got == TWORD ? wordtext : ""));
 			 * Newline or semicolon here is optional (but note
 			 * that the original Bourne shell only allowed NL).
 			 */
-			if (lasttoken != TNL && lasttoken != TSEMI)
+			if (lasttoken != TSEMI)
 				tokpushback++;
 		}
 		checkkwd = CHKNL | CHKKWD | CHKALIAS;
e 2020-04-05Error on invalid ISUPPORT values 1.2June McEnroe 2020-04-05Only set RCS on FreeBSDJune McEnroe 2020-04-05Log bans and unbansJune McEnroe 2020-04-05Parse mode types from ISUPPORTJune McEnroe 2020-04-05Add unscoop matchers for ban/unban eventsJune McEnroe The IRC and Textual matchers miss bans mixed with other mode changes, but those are rare. 2020-04-05Check unscoop regexps with make testJune McEnroe 2020-04-05Add unscoop -n flag for checking regexpsJune McEnroe 2020-04-05Add Ban and Unban event typesJune McEnroe 2020-04-02Update styleJune McEnroe Replacing declarations followed by while loops with for loops and generating the short option string from the long options. 2020-03-31Update unscoop catgirl matchersJune McEnroe I'm not concerned about keeping the old matchers since I'm almost entirely certain I was the only one who ever used the old version of catgirl, and I already imported those logs. 2020-03-31Fix writing verbose to stderrJune McEnroe 2020-03-02Include <>/-/* around nicks in scoop coloring 1.1June McEnroe 2020-03-02Replace .mk files with configure scriptJune McEnroe 2020-02-28Implement the causal.agency/consumer capabilityJune McEnroe 2020-02-22Include <>/-/* around nicks in coloringJune McEnroe 2020-02-22Use (almost) the full range of IRC colors for nicksJune McEnroe