bazel parser: avoid fancy interner

A simple map is fine.

PiperOrigin-RevId: 258214126
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/Parser.java b/src/main/java/com/google/devtools/build/lib/syntax/Parser.java
index 9daa9a3..13cc21c 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/Parser.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/Parser.java
@@ -19,9 +19,7 @@
 import com.google.common.base.Supplier;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Interner;
 import com.google.common.collect.Iterables;
-import com.google.devtools.build.lib.concurrent.BlazeInterners;
 import com.google.devtools.build.lib.events.Event;
 import com.google.devtools.build.lib.events.EventHandler;
 import com.google.devtools.build.lib.events.Location;
@@ -32,6 +30,7 @@
 import com.google.devtools.build.lib.syntax.IfStatement.ConditionalStatements;
 import java.util.ArrayList;
 import java.util.EnumSet;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -162,7 +161,8 @@
   private int errorsCount;
   private boolean recoveryMode;  // stop reporting errors until next statement
 
-  private final Interner<String> stringInterner = BlazeInterners.newStrongInterner();
+  // Intern string literals, as some files contain many literals for the same string.
+  private final Map<String, String> stringInterner = new HashMap<>();
 
   private Parser(Lexer lexer, EventHandler eventHandler) {
     this.lexer = lexer;
@@ -170,6 +170,11 @@
     nextToken();
   }
 
+  private String intern(String s) {
+    String prev = stringInterner.putIfAbsent(s, s);
+    return prev != null ? prev : s;
+  }
+
   private static Location locationFromStatements(Lexer lexer, List<Statement> statements) {
     if (!statements.isEmpty()) {
       return lexer.createLocation(
@@ -605,9 +610,7 @@
     Preconditions.checkState(token.kind == TokenKind.STRING);
     int end = token.right;
     StringLiteral literal =
-        setLocation(
-            new StringLiteral(stringInterner.intern((String) token.value)), token.left, end);
-
+        setLocation(new StringLiteral(intern((String) token.value)), token.left, end);
     nextToken();
     if (token.kind == TokenKind.STRING) {
       reportError(lexer.createLocation(end, token.left),
@@ -960,7 +963,7 @@
       if (x instanceof StringLiteral && y instanceof StringLiteral) {
         StringLiteral left = (StringLiteral) x;
         StringLiteral right = (StringLiteral) y;
-        return new StringLiteral(stringInterner.intern(left.getValue() + right.getValue()));
+        return new StringLiteral(intern(left.getValue() + right.getValue()));
       }
     }
     return new BinaryOperatorExpression(x, op, y);