svn commit: r214305 - head/bin/sh
Jilles Tjoelker
jilles at FreeBSD.org
Sun Oct 24 22:25:39 UTC 2010
Author: jilles
Date: Sun Oct 24 22:25:38 2010
New Revision: 214305
URL: http://svn.freebsd.org/changeset/base/214305
Log:
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)
Modified:
head/bin/sh/mksyntax.c
head/bin/sh/parser.c
Modified: head/bin/sh/mksyntax.c
==============================================================================
--- head/bin/sh/mksyntax.c Sun Oct 24 22:03:21 2010 (r214304)
+++ head/bin/sh/mksyntax.c Sun Oct 24 22:25:38 2010 (r214305)
@@ -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 __un
add("\n", "CNL");
add("\\", "CBACK");
add("`", "CBQUOTE");
- add("\"", "CDQUOTE");
+ add("\"", "CIGN");
add("$", "CVAR");
add("}", "CENDVAR");
add("(", "CLP");
Modified: head/bin/sh/parser.c
==============================================================================
--- head/bin/sh/parser.c Sun Oct 24 22:03:21 2010 (r214304)
+++ head/bin/sh/parser.c Sun Oct 24 22:25:38 2010 (r214305)
@@ -1224,10 +1224,7 @@ readtoken1(int firstc, char const *initi
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 *initi
break;
case CEOF:
goto endword; /* exit outer loop */
+ case CIGN:
+ break;
default:
if (level == 0)
goto endword; /* exit outer loop */
More information about the svn-src-all
mailing list