sh: Partially revert r206146, allowing double-quotes in arithmetic.

These do pretty much nothing (except that parentheses are ignored), but
people seem to use them and allowing them does not hurt much.

Single-quotes seem not to be used and cause silently different behaviour
with ksh93 character constants.
This commit is contained in:
Jilles Tjoelker 2010-04-11 12:24:47 +00:00
parent 6d2b7c381b
commit 7f728c60bc
2 changed files with 5 additions and 1 deletions

View File

@ -232,6 +232,7 @@ main(int argc __unused, char **argv __unused)
add("\n", "CNL");
add("\\", "CBACK");
add("`", "CBQUOTE");
add("\"", "CDQUOTE");
add("$", "CVAR");
add("}", "CENDVAR");
add("(", "CLP");

View File

@ -1223,7 +1223,10 @@ readtoken1(int firstc, char const *initialsyntax, char *eofmark, int striptabs)
if (eofmark != NULL && newvarnest == 0)
USTPUTC(c, out);
else {
state[level].syntax = BASESYNTAX;
if (state[level].category == TSTATE_ARITH)
state[level].syntax = ARISYNTAX;
else
state[level].syntax = BASESYNTAX;
quotef++;
}
break;