diff --git a/parser/parser_test.go b/parser/parser_test.go
index <HASH>..<HASH> 100644
--- a/parser/parser_test.go
+++ b/parser/parser_test.go
@@ -499,6 +499,10 @@ var shellTests = []struct {
 		`1:1: reached EOF without matching $(( with ))`,
 	},
 	{
+		`$((& 0 $(`,
+		`1:1: reached EOF without matching $(( with ))`,
+	},
+	{
 		`$((a'`,
 		`1:1: reached EOF without matching $(( with ))`,
 	},
diff --git a/parser/tokenizer.go b/parser/tokenizer.go
index <HASH>..<HASH> 100644
--- a/parser/tokenizer.go
+++ b/parser/tokenizer.go
@@ -46,6 +46,7 @@ func (p *parser) next() {
 	}
 	if p.npos >= len(p.src) {
 		p.errPass(io.EOF)
+		p.tok = token.EOF
 		return
 	}
 	b := p.src[p.npos]
parser: avoid another $(( ambiguity hang

We have to force tok = EOF because our error logic is not working
properly. Leave this in until we fix it in a cleaner way.