about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-05-18 12:06:43 +0100
committerPeter Stephenson <pws@zsh.org>2015-05-18 12:06:43 +0100
commit2d6569e5906ad504ecc66a3b0114cd284afd81a1 (patch)
tree241431dc698721381c643541595708f9dce3ce93
parent52aeb9aaeb4799b760138a7c34b18ede4b47242a (diff)
downloadzsh-2d6569e5906ad504ecc66a3b0114cd284afd81a1.tar.gz
zsh-2d6569e5906ad504ecc66a3b0114cd284afd81a1.tar.xz
zsh-2d6569e5906ad504ecc66a3b0114cd284afd81a1.zip
35184: Additional case fix for 35168.
Lexical analysis flags got screwed up after a "|", so we
didn't parse patterns properly, in particular those with parentheses.
-rw-r--r--ChangeLog3
-rw-r--r--Src/parse.c2
-rw-r--r--Test/A01grammar.ztst15
3 files changed, 18 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 8848ce237..ef4029436 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2015-05-18  Peter Stephenson  <p.stephenson@samsung.com>
 
+	* 35184: Src/parse.c, Test/A01grammar.ztst: fix pattern parsing
+	after "|" in 35168.
+
 	* 35168: Completion/Unix/Command/_ant,
 	Completion/Unix/Command/_cp, Completion/Unix/Command/_locate,
 	Completion/Unix/Command/_make, Completion/Unix/Command/_tar,
diff --git a/Src/parse.c b/Src/parse.c
index c938d2dce..c48669995 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -1174,8 +1174,6 @@ par_case(int *cmplx)
 	if (!strcmp(tokstr, "esac"))
 	    break;
 	str = dupstring(tokstr);
-	incasepat = 0;
-	incmdpos = 1;
 	type = WC_CASE_OR;
 	pp = ecadd(0);
 	palts = ecadd(0);
diff --git a/Test/A01grammar.ztst b/Test/A01grammar.ztst
index 1ba0a54d7..41fb48688 100644
--- a/Test/A01grammar.ztst
+++ b/Test/A01grammar.ztst
@@ -543,6 +543,7 @@
   . ./bad_syntax
 126: Attempt to "." file with bad syntax.
 ?./bad_syntax:2: parse error near `\n'
+# `
 
   echo 'false' >dot_false
   . ./dot_false
@@ -650,3 +651,17 @@
 >Pattern matched five
 >Pattern matched six
 >Character class matched abecedinarian
+
+  case grumph in
+    ( no | (grumph) )
+    print 1 OK
+    ;;
+  esac
+  case snruf in
+    ( fleer | (|snr(|[au]f)) )
+    print 2 OK
+    ;;
+  esac
+0: case patterns within words
+>1 OK
+>2 OK