sh: Split CNL syntax category to avoid a check on state[level].syntax
No functional change is intended.
This commit is contained in:
parent
729ba386f0
commit
dc0dbd74c4
@ -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");
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user