Allow newline in string literal

It seems fine to have newline in string literal and it is convinient if
we want to have multiline string literal in someplaces e.g. print,
assert.

Change-Id: Ied7845ad6b6f6548035bd545e5c21dc837769ee7
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/19361
Commit-Queue: David Turner <digit@google.com>
Reviewed-by: David Turner <digit@google.com>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
diff --git a/docs/language.md b/docs/language.md
index 629125e..1ef533e 100644
--- a/docs/language.md
+++ b/docs/language.md
@@ -63,7 +63,8 @@
 ### Strings
 
 Strings are enclosed in double-quotes and use backslash as the escape
-character. The only escape sequences supported are:
+character. They can span multiple lines. The only escape sequences supported
+are:
 
   * `\"` (for literal quote)
   * `\$` (for literal dollars sign)
diff --git a/src/gn/tokenizer.cc b/src/gn/tokenizer.cc
index b68be3c..52e1c75 100644
--- a/src/gn/tokenizer.cc
+++ b/src/gn/tokenizer.cc
@@ -287,9 +287,6 @@
         if (IsCurrentStringTerminator(initial)) {
           Advance();  // Skip past last "
           break;
-        } else if (IsCurrentNewline()) {
-          *err_ = Err(LocationRange(location, GetCurrentLocation()),
-                      "Newline in string constant.");
         }
         Advance();
       }
diff --git a/src/gn/tokenizer_unittest.cc b/src/gn/tokenizer_unittest.cc
index dfec895..5decc68 100644
--- a/src/gn/tokenizer_unittest.cc
+++ b/src/gn/tokenizer_unittest.cc
@@ -70,11 +70,14 @@
 }
 
 TEST(Tokenizer, String) {
-  TokenExpectation strings[] = {{Token::STRING, "\"foo\""},
-                                {Token::STRING, "\"bar\\\"baz\""},
-                                {Token::STRING, "\"asdf\\\\\""}};
-  EXPECT_TRUE(
-      CheckTokenizer("  \"foo\" \"bar\\\"baz\" \"asdf\\\\\" ", strings));
+  TokenExpectation strings[] = {
+      {Token::STRING, "\"foo\""},
+      {Token::STRING, "\"bar\\\"baz\""},
+      {Token::STRING, "\"asdf\\\\\""},
+      {Token::STRING, "\"new\nline\""},
+  };
+  EXPECT_TRUE(CheckTokenizer(
+      "  \"foo\" \"bar\\\"baz\" \"asdf\\\\\" \"new\nline\"", strings));
 }
 
 TEST(Tokenizer, Operator) {