diff options
author | Jilles Tjoelker <jilles@FreeBSD.org> | 2018-05-21 21:52:48 +0000 |
---|---|---|
committer | Jilles Tjoelker <jilles@FreeBSD.org> | 2018-05-21 21:52:48 +0000 |
commit | dc0dbd74c4187216f1c3b6a1eb705a6b63e9811b (patch) | |
tree | bcb3d6d7668bc0e830295b58b3eca5fbdc07512c /bin | |
parent | 729ba386f0d607f1412e44747a3b0f7fa67c9290 (diff) | |
download | src-dc0dbd74c4187216f1c3b6a1eb705a6b63e9811b.tar.gz src-dc0dbd74c4187216f1c3b6a1eb705a6b63e9811b.zip |
sh: Split CNL syntax category to avoid a check on state[level].syntax
No functional change is intended.
Notes
Notes:
svn path=/head/; revision=334008
Diffstat (limited to 'bin')
-rw-r--r-- | bin/sh/mksyntax.c | 7 | ||||
-rw-r--r-- | bin/sh/parser.c | 5 |
2 files changed, 7 insertions, 5 deletions
diff --git a/bin/sh/mksyntax.c b/bin/sh/mksyntax.c index 4df13c3db530..24b118f64cbf 100644 --- a/bin/sh/mksyntax.c +++ b/bin/sh/mksyntax.c @@ -65,6 +65,7 @@ struct synclass { static const struct synclass synclass[] = { { "CWORD", "character is nothing special" }, { "CNL", "newline character" }, + { "CQNL", "newline character in quotes" }, { "CBACK", "a backslash character" }, { "CSBACK", "a backslash character in single quotes" }, { "CSQUOTE", "single quote" }, @@ -185,7 +186,7 @@ main(int argc __unused, char **argv __unused) fputs("\n/* syntax table used when in double quotes */\n", cfile); init("dqsyntax"); add_default(); - add("\n", "CNL"); + add("\n", "CQNL"); add("\\", "CBACK"); add("\"", "CENDQUOTE"); add("`", "CBQUOTE"); @@ -198,7 +199,7 @@ main(int argc __unused, char **argv __unused) fputs("\n/* syntax table used when in single quotes */\n", cfile); init("sqsyntax"); add_default(); - add("\n", "CNL"); + add("\n", "CQNL"); add("\\", "CSBACK"); add("'", "CENDQUOTE"); /* ':/' for tilde expansion, '-^]' for [a\-x] pattern ranges */ @@ -208,7 +209,7 @@ main(int argc __unused, char **argv __unused) fputs("\n/* syntax table used when in arithmetic */\n", cfile); init("arisyntax"); add_default(); - add("\n", "CNL"); + add("\n", "CQNL"); add("\\", "CBACK"); add("`", "CBQUOTE"); add("\"", "CIGN"); diff --git a/bin/sh/parser.c b/bin/sh/parser.c index 01b96dc07c74..be0ddf6b4146 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -1434,9 +1434,10 @@ readtoken1(int firstc, char const *initialsyntax, const char *eofmark, switch(synentry) { case CNL: /* '\n' */ - if (level == 0 && - state[level].syntax == BASESYNTAX) + if (level == 0) goto endword; /* exit outer loop */ + /* FALLTHROUGH */ + case CQNL: USTPUTC(c, out); plinno++; if (doprompt) |