summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2010-10-24 22:25:38 +0000
committerjilles <jilles@FreeBSD.org>2010-10-24 22:25:38 +0000
commit51f0756257f4101578920ca0e00c705dd2e1163b (patch)
treeade424f7898169ec8c5b9d51282690b7751e31e9 /bin
parent58038d3e9e1f45ea4dccdfeb21e3f9bb40ae4950 (diff)
downloadFreeBSD-src-51f0756257f4101578920ca0e00c705dd2e1163b.zip
FreeBSD-src-51f0756257f4101578920ca0e00c705dd2e1163b.tar.gz
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)
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/mksyntax.c3
-rw-r--r--bin/sh/parser.c7
2 files changed, 5 insertions, 5 deletions
diff --git a/bin/sh/mksyntax.c b/bin/sh/mksyntax.c
index e63f0d6..e4c4d14 100644
--- a/bin/sh/mksyntax.c
+++ b/bin/sh/mksyntax.c
@@ -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");
diff --git a/bin/sh/parser.c b/bin/sh/parser.c
index 4c1b272..9500d91 100644
--- a/bin/sh/parser.c
+++ b/bin/sh/parser.c
@@ -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 */
OpenPOWER on IntegriCloud