Merge pull request #9 from pjeby/whitespace-continued

Handle line continuations in whitespace
diff --git a/unquote.go b/unquote.go
index ba3a0f2..b1b13da 100644
--- a/unquote.go
+++ b/unquote.go
@@ -40,6 +40,18 @@
 		if strings.ContainsRune(splitChars, c) {
 			input = input[l:]
 			continue
+		} else if c == escapeChar {
+			// Look ahead for escaped newline so we can skip over it
+			next := input[l:]
+			if len(next) == 0 {
+				err = UnterminatedEscapeError
+				return
+			}
+			c2, l2 := utf8.DecodeRuneInString(next)
+			if c2 == '\n' {
+				input = next[l2:]
+				continue
+			}
 		}
 
 		var word string
diff --git a/unquote_test.go b/unquote_test.go
index 1444a9f..19c10d9 100644
--- a/unquote_test.go
+++ b/unquote_test.go
@@ -39,6 +39,7 @@
 	{"text with\\\na backslash-escaped newline", []string{"text", "witha", "backslash-escaped", "newline"}},
 	{"text \"with\na\" quoted newline", []string{"text", "with\na", "quoted", "newline"}},
 	{"\"quoted\\d\\\\\\\" text with\\\na backslash-escaped newline\"", []string{"quoted\\d\\\" text witha backslash-escaped newline"}},
+	{"text with an escaped \\\n newline in the middle", []string{"text", "with", "an", "escaped", "newline", "in", "the", "middle"}},
 	{"foo\"bar\"baz", []string{"foobarbaz"}},
 }
 
@@ -50,4 +51,5 @@
 	{"'test'\\''ing", UnterminatedSingleQuoteError},
 	{"\"foo'bar", UnterminatedDoubleQuoteError},
 	{"foo\\", UnterminatedEscapeError},
+	{"   \\", UnterminatedEscapeError},
 }