Update analyzer error code generation

This fixes error code generation when template contains a backslash

Change-Id: If14cbd07605eab454b00c6970d1e21349ac7a662
Reviewed-on: https://dart-review.googlesource.com/75602
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
diff --git a/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart b/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
index 4c26c3a..b2a85e1 100644
--- a/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
+++ b/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
@@ -42,148 +42,149 @@
 
 const ParserErrorCode _CONTINUE_OUTSIDE_OF_LOOP = const ParserErrorCode(
     'CONTINUE_OUTSIDE_OF_LOOP',
-    "A continue statement can't be used outside of a loop or switch statement.",
+    r"A continue statement can't be used outside of a loop or switch statement.",
     correction: "Try removing the continue statement.");
 
 const ParserErrorCode _COVARIANT_AFTER_VAR = const ParserErrorCode(
     'COVARIANT_AFTER_VAR',
-    "The modifier 'covariant' should be before the modifier 'var'.",
+    r"The modifier 'covariant' should be before the modifier 'var'.",
     correction: "Try re-ordering the modifiers.");
 
 const ParserErrorCode _EQUALITY_CANNOT_BE_EQUALITY_OPERAND = const ParserErrorCode(
     'EQUALITY_CANNOT_BE_EQUALITY_OPERAND',
-    "An equality expression can't be an operand of another equality expression.",
+    r"An equality expression can't be an operand of another equality expression.",
     correction: "Try re-writing the expression.");
 
 const ParserErrorCode _EXTERNAL_CLASS = const ParserErrorCode(
-    'EXTERNAL_CLASS', "Classes can't be declared to be 'external'.",
+    'EXTERNAL_CLASS', r"Classes can't be declared to be 'external'.",
     correction: "Try removing the keyword 'external'.");
 
 const ParserErrorCode _EXTERNAL_ENUM = const ParserErrorCode(
-    'EXTERNAL_ENUM', "Enums can't be declared to be 'external'.",
+    'EXTERNAL_ENUM', r"Enums can't be declared to be 'external'.",
     correction: "Try removing the keyword 'external'.");
 
 const ParserErrorCode _IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE =
     const ParserErrorCode('IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE',
-        "Import directives must preceed part directives.",
+        r"Import directives must preceed part directives.",
         correction:
             "Try moving the import directives before the part directives.");
 
 const ParserErrorCode _INVALID_AWAIT_IN_FOR = const ParserErrorCode(
     'INVALID_AWAIT_IN_FOR',
-    "The keyword 'await' isn't allowed for a normal 'for' statement.",
+    r"The keyword 'await' isn't allowed for a normal 'for' statement.",
     correction: "Try removing the keyword, or use a for-each statement.");
 
 const ParserErrorCode _MISSING_PREFIX_IN_DEFERRED_IMPORT =
     const ParserErrorCode('MISSING_PREFIX_IN_DEFERRED_IMPORT',
-        "Deferred imports should have a prefix.",
+        r"Deferred imports should have a prefix.",
         correction: "Try adding a prefix to the import.");
 
 const ParserErrorCode _MISSING_STATEMENT =
-    const ParserErrorCode('MISSING_STATEMENT', "Expected a statement.");
+    const ParserErrorCode('MISSING_STATEMENT', r"Expected a statement.");
 
 const ParserErrorCode _MULTIPLE_EXTENDS_CLAUSES = const ParserErrorCode(
     'MULTIPLE_EXTENDS_CLAUSES',
-    "Each class definition can have at most one extends clause.",
+    r"Each class definition can have at most one extends clause.",
     correction:
         "Try choosing one superclass and define your class to implement (or mix in) the others.");
 
 const ParserErrorCode _MULTIPLE_LIBRARY_DIRECTIVES = const ParserErrorCode(
     'MULTIPLE_LIBRARY_DIRECTIVES',
-    "Only one library directive may be declared in a file.",
+    r"Only one library directive may be declared in a file.",
     correction: "Try removing all but one of the library directives.");
 
 const ParserErrorCode _MULTIPLE_ON_CLAUSES = const ParserErrorCode(
     'MULTIPLE_ON_CLAUSES',
-    "Each mixin definition can have at most one on clause.",
+    r"Each mixin definition can have at most one on clause.",
     correction: "Try combining all of the on clauses into a single clause.");
 
 const ParserErrorCode _MULTIPLE_PART_OF_DIRECTIVES = const ParserErrorCode(
     'MULTIPLE_PART_OF_DIRECTIVES',
-    "Only one part-of directive may be declared in a file.",
+    r"Only one part-of directive may be declared in a file.",
     correction: "Try removing all but one of the part-of directives.");
 
 const ParserErrorCode _MULTIPLE_WITH_CLAUSES = const ParserErrorCode(
     'MULTIPLE_WITH_CLAUSES',
-    "Each class definition can have at most one with clause.",
+    r"Each class definition can have at most one with clause.",
     correction: "Try combining all of the with clauses into a single clause.");
 
 const ParserErrorCode _NATIVE_CLAUSE_SHOULD_BE_ANNOTATION = const ParserErrorCode(
     'NATIVE_CLAUSE_SHOULD_BE_ANNOTATION',
-    "Native clause in this form is deprecated.",
+    r"Native clause in this form is deprecated.",
     correction:
         "Try removing this native clause and adding @native() or @native('native-name') before the declaration.");
 
 const ParserErrorCode _PREFIX_AFTER_COMBINATOR = const ParserErrorCode(
     'PREFIX_AFTER_COMBINATOR',
-    "The prefix ('as' clause) should come before any show/hide combinators.",
+    r"The prefix ('as' clause) should come before any show/hide combinators.",
     correction: "Try moving the prefix before the combinators.");
 
 const ParserErrorCode _REDIRECTING_CONSTRUCTOR_WITH_BODY = const ParserErrorCode(
     'REDIRECTING_CONSTRUCTOR_WITH_BODY',
-    "Redirecting constructors can't have a body.",
+    r"Redirecting constructors can't have a body.",
     correction:
         "Try removing the body, or not making this a redirecting constructor.");
 
 const ParserErrorCode _REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR =
     const ParserErrorCode('REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR',
-        "Only factory constructor can specify '=' redirection.",
+        r"Only factory constructor can specify '=' redirection.",
         correction:
             "Try making this a factory constructor, or remove the redirection.");
 
 const ParserErrorCode _STATIC_AFTER_CONST = const ParserErrorCode(
     'STATIC_AFTER_CONST',
-    "The modifier 'static' should be before the modifier 'const'.",
+    r"The modifier 'static' should be before the modifier 'const'.",
     correction: "Try re-ordering the modifiers.");
 
 const ParserErrorCode _STATIC_AFTER_FINAL = const ParserErrorCode(
     'STATIC_AFTER_FINAL',
-    "The modifier 'static' should be before the modifier 'final'.",
+    r"The modifier 'static' should be before the modifier 'final'.",
     correction: "Try re-ordering the modifiers.");
 
 const ParserErrorCode _STATIC_AFTER_VAR = const ParserErrorCode(
     'STATIC_AFTER_VAR',
-    "The modifier 'static' should be before the modifier 'var'.",
+    r"The modifier 'static' should be before the modifier 'var'.",
     correction: "Try re-ordering the modifiers.");
 
 const ParserErrorCode _STATIC_CONSTRUCTOR = const ParserErrorCode(
-    'STATIC_CONSTRUCTOR', "Constructors can't be static.",
+    'STATIC_CONSTRUCTOR', r"Constructors can't be static.",
     correction: "Try removing the keyword 'static'.");
 
 const ParserErrorCode _STATIC_OPERATOR = const ParserErrorCode(
-    'STATIC_OPERATOR', "Operators can't be static.",
+    'STATIC_OPERATOR', r"Operators can't be static.",
     correction: "Try removing the keyword 'static'.");
 
 const ParserErrorCode _SWITCH_HAS_CASE_AFTER_DEFAULT_CASE =
     const ParserErrorCode('SWITCH_HAS_CASE_AFTER_DEFAULT_CASE',
-        "The default case should be the last case in a switch statement.",
+        r"The default case should be the last case in a switch statement.",
         correction:
             "Try moving the default case after the other case clauses.");
 
 const ParserErrorCode _SWITCH_HAS_MULTIPLE_DEFAULT_CASES =
     const ParserErrorCode('SWITCH_HAS_MULTIPLE_DEFAULT_CASES',
-        "The 'default' case can only be declared once.",
+        r"The 'default' case can only be declared once.",
         correction: "Try removing all but one default case.");
 
 const ParserErrorCode _TOP_LEVEL_OPERATOR = const ParserErrorCode(
-    'TOP_LEVEL_OPERATOR', "Operators must be declared within a class.",
+    'TOP_LEVEL_OPERATOR', r"Operators must be declared within a class.",
     correction:
         "Try removing the operator, moving it to a class, or converting it to be a function.");
 
 const ParserErrorCode _TYPEDEF_IN_CLASS = const ParserErrorCode(
-    'TYPEDEF_IN_CLASS', "Typedefs can't be declared inside classes.",
+    'TYPEDEF_IN_CLASS', r"Typedefs can't be declared inside classes.",
     correction: "Try moving the typedef to the top-level.");
 
 const ParserErrorCode _TYPE_ARGUMENTS_ON_TYPE_VARIABLE = const ParserErrorCode(
     'TYPE_ARGUMENTS_ON_TYPE_VARIABLE',
-    "Can't use type arguments with type variable '#name'.",
+    r"Can't use type arguments with type variable '#name'.",
     correction: "Try removing the type arguments.");
 
 const ParserErrorCode _VAR_RETURN_TYPE = const ParserErrorCode(
-    'VAR_RETURN_TYPE', "The return type can't be 'var'.",
+    'VAR_RETURN_TYPE', r"The return type can't be 'var'.",
     correction:
         "Try removing the keyword 'var', or replacing it with the name of the return type.");
 
 const ParserErrorCode _WITH_BEFORE_EXTENDS = const ParserErrorCode(
-    'WITH_BEFORE_EXTENDS', "The extends clause must be before the with clause.",
+    'WITH_BEFORE_EXTENDS',
+    r"The extends clause must be before the with clause.",
     correction: "Try moving the extends clause before the with clause.");
diff --git a/pkg/analyzer/tool/messages/generate.dart b/pkg/analyzer/tool/messages/generate.dart
index 61e3f65..aa7d34c 100644
--- a/pkg/analyzer/tool/messages/generate.dart
+++ b/pkg/analyzer/tool/messages/generate.dart
@@ -122,7 +122,7 @@
       out.writeln('const $className _$errorCode =');
       out.writeln('const $className(');
       out.writeln("'$errorCode',");
-      out.writeln('"${entry['template']}"');
+      out.writeln('r"${entry['template']}"');
       final tip = entry['tip'];
       if (tip is String) {
         out.writeln(',correction: "$tip"');