Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Oct 2010 22:25:39 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r214305 - head/bin/sh
Message-ID:  <201010242225.o9OMPd8u042716@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010242225.o9OMPd8u042716>