sh: Ignore double-quotes in arithmetic rather than treating them as quotes.
This provides similar behaviour, but allows a simpler parser. This changes r206473. Exp-run done by: pav (with some other sh(1) changes)
This commit is contained in:
parent
67e109adbe
commit
d94c867339
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=214305
@ -75,6 +75,7 @@ struct synclass synclass[] = {
|
||||
{ "CEOF", "end of file" },
|
||||
{ "CCTL", "like CWORD, except it must be escaped" },
|
||||
{ "CSPCL", "these terminate a word" },
|
||||
{ "CIGN", "character should be ignored" },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
@ -232,7 +233,7 @@ main(int argc __unused, char **argv __unused)
|
||||
add("\n", "CNL");
|
||||
add("\\", "CBACK");
|
||||
add("`", "CBQUOTE");
|
||||
add("\"", "CDQUOTE");
|
||||
add("\"", "CIGN");
|
||||
add("$", "CVAR");
|
||||
add("}", "CENDVAR");
|
||||
add("(", "CLP");
|
||||
|
@ -1224,10 +1224,7 @@ readtoken1(int firstc, char const *initialsyntax, char *eofmark, int striptabs)
|
||||
if (eofmark != NULL && newvarnest == 0)
|
||||
USTPUTC(c, out);
|
||||
else {
|
||||
if (state[level].category == TSTATE_ARITH)
|
||||
state[level].syntax = ARISYNTAX;
|
||||
else
|
||||
state[level].syntax = BASESYNTAX;
|
||||
state[level].syntax = BASESYNTAX;
|
||||
quotef++;
|
||||
}
|
||||
break;
|
||||
@ -1282,6 +1279,8 @@ readtoken1(int firstc, char const *initialsyntax, char *eofmark, int striptabs)
|
||||
break;
|
||||
case CEOF:
|
||||
goto endword; /* exit outer loop */
|
||||
case CIGN:
|
||||
break;
|
||||
default:
|
||||
if (level == 0)
|
||||
goto endword; /* exit outer loop */
|
||||
|
Loading…
Reference in New Issue
Block a user