From d94c86733927e85a8585df5d83f08fa10aedc01a Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 24 Oct 2010 22:25:38 +0000 Subject: [PATCH] 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) --- bin/sh/mksyntax.c | 3 ++- bin/sh/parser.c | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/sh/mksyntax.c b/bin/sh/mksyntax.c index e63f0d68248..e4c4d14dc17 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 4c1b2726f78..9500d914559 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 */