replace individual scanner flags with scanner configuration

Change-Id: I3d4522a8bcabcbc139de09e08d44baf2eeae4a59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100882
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
diff --git a/pkg/analyzer/lib/src/dart/scanner/scanner.dart b/pkg/analyzer/lib/src/dart/scanner/scanner.dart
index f68748c..717805d 100644
--- a/pkg/analyzer/lib/src/dart/scanner/scanner.dart
+++ b/pkg/analyzer/lib/src/dart/scanner/scanner.dart
@@ -121,8 +121,8 @@
 
   Token tokenize() {
     fasta.ScannerResult result = fasta.scanString(_contents,
-        enableGtGtGt: enableGtGtGt,
-        enableNonNullable: enableNonNullable,
+        configuration: fasta.ScannerConfiguration(
+            enableGtGtGt: enableGtGtGt, enableNonNullable: enableNonNullable),
         includeComments: _preserveComments,
         scanLazyAssignmentOperators: scanLazyAssignmentOperators);
 
diff --git a/pkg/analyzer/test/generated/parser_fasta_test.dart b/pkg/analyzer/test/generated/parser_fasta_test.dart
index 753fac2..78b62e4 100644
--- a/pkg/analyzer/test/generated/parser_fasta_test.dart
+++ b/pkg/analyzer/test/generated/parser_fasta_test.dart
@@ -1647,9 +1647,10 @@
         featureSet != null && featureSet.isEnabled(Feature.non_nullable);
     ScannerResult result = scanString(content,
         includeComments: true,
-        enableGtGtGt: enableTripleShift,
-        enableGtGtGtEq: enableTripleShift,
-        enableNonNullable: enableNonNullable);
+        configuration: ScannerConfiguration(
+            enableGtGtGt: enableTripleShift,
+            enableGtGtGtEq: enableTripleShift,
+            enableNonNullable: enableNonNullable));
     Token token = result.tokens;
     if (result.hasErrors) {
       // The default recovery strategy used by scanString
diff --git a/pkg/front_end/lib/src/fasta/scanner.dart b/pkg/front_end/lib/src/fasta/scanner.dart
index c377255..a6e262a 100644
--- a/pkg/front_end/lib/src/fasta/scanner.dart
+++ b/pkg/front_end/lib/src/fasta/scanner.dart
@@ -85,28 +85,13 @@
 /// Scan/tokenize the given [source].
 /// If [recover] is null, then the [defaultRecoveryStrategy] is used.
 ScannerResult scanString(String source,
-    {bool enableGtGtGt,
-    bool enableGtGtGtEq,
-    bool enableNonNullable,
-    ScannerConfiguration configuration,
+    {ScannerConfiguration configuration,
     bool includeComments: false,
     bool scanLazyAssignmentOperators: false,
     Recover recover}) {
-  // TODO(brianwilkerson): Remove the parameter `enableGtGtGt` after the feature
-  // has been anabled by default.
   assert(source != null, 'source must not be null');
   StringScanner scanner = new StringScanner(source,
       configuration: configuration, includeComments: includeComments);
-  // TODO(danrubel): remove these flags and use configuration instead.
-  if (enableGtGtGt != null) {
-    scanner.enableGtGtGt = enableGtGtGt;
-  }
-  if (enableGtGtGtEq != null) {
-    scanner.enableGtGtGtEq = enableGtGtGtEq;
-  }
-  if (enableNonNullable != null) {
-    scanner.enableNonNullable = enableNonNullable;
-  }
   return _tokenizeAndRecover(scanner, recover, source: source);
 }
 
diff --git a/pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart b/pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart
index 337a7b7..fd29cd4 100644
--- a/pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart
+++ b/pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart
@@ -46,22 +46,16 @@
   /// Experimental flag for enabling scanning of `>>>`.
   /// See https://github.com/dart-lang/language/issues/61
   /// and https://github.com/dart-lang/language/issues/60
-  ///
-  /// Use [configuration] to set this flag rather than setting it directly.
-  bool enableGtGtGt = false;
+  bool _enableGtGtGt = false;
 
   /// Experimental flag for enabling scanning of `>>>=`.
   /// See https://github.com/dart-lang/language/issues/61
   /// and https://github.com/dart-lang/language/issues/60
-  ///
-  /// Use [configuration] to set this flag rather than setting it directly.
-  bool enableGtGtGtEq = false;
+  bool _enableGtGtGtEq = false;
 
   /// Experimental flag for enabling scanning of NNBD tokens
   /// such as 'required' and 'late'.
-  ///
-  /// Use [configuration] to set this flag rather than setting it directly.
-  bool enableNonNullable = false;
+  bool _enableNonNullable = false;
 
   @override
   LanguageVersionToken languageVersion;
@@ -115,9 +109,9 @@
    */
   set configuration(ScannerConfiguration config) {
     if (config != null) {
-      enableNonNullable = config.enableNonNullable;
-      enableGtGtGt = config.enableGtGtGt;
-      enableGtGtGtEq = config.enableGtGtGtEq;
+      _enableNonNullable = config.enableNonNullable;
+      _enableGtGtGt = config.enableGtGtGt;
+      _enableGtGtGtEq = config.enableGtGtGtEq;
     }
   }
 
@@ -716,9 +710,9 @@
       if (identical($EQ, next)) {
         appendPrecedenceToken(TokenType.GT_GT_EQ);
         return advance();
-      } else if (enableGtGtGt && identical($GT, next)) {
+      } else if (_enableGtGtGt && identical($GT, next)) {
         next = advance();
-        if (enableGtGtGtEq && identical($EQ, next)) {
+        if (_enableGtGtGtEq && identical($EQ, next)) {
           appendPrecedenceToken(TokenType.GT_GT_GT_EQ);
           return advance();
         }
@@ -1136,7 +1130,7 @@
     if (state == null || state.keyword == null) {
       return tokenizeIdentifier(next, start, allowDollar);
     }
-    if (!enableNonNullable &&
+    if (!_enableNonNullable &&
         (state.keyword == Keyword.LATE || state.keyword == Keyword.REQUIRED)) {
       return tokenizeIdentifier(next, start, allowDollar);
     }