diff --git a/runtime/Java/src/org/antlr/v4/runtime/tree/pattern/ParseTreePatternMatcher.java b/runtime/Java/src/org/antlr/v4/runtime/tree/pattern/ParseTreePatternMatcher.java index 733705908..37bf67e6a 100644 --- a/runtime/Java/src/org/antlr/v4/runtime/tree/pattern/ParseTreePatternMatcher.java +++ b/runtime/Java/src/org/antlr/v4/runtime/tree/pattern/ParseTreePatternMatcher.java @@ -53,7 +53,6 @@ import java.io.StringReader; import java.lang.reflect.Constructor; import java.util.ArrayList; import java.util.Arrays; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -217,8 +216,8 @@ public class ParseTreePatternMatcher { public List tokenize(String pattern) { // make maps for quick look up - Map tokenNameToType = toMap(parser.getTokenNames(), 0); - Map ruleNameToIndex = toMap(parser.getRuleNames(), 0); + Map tokenNameToType = Utils.toMap(parser.getTokenNames()); + Map ruleNameToIndex = Utils.toMap(parser.getRuleNames()); // split pattern into chunks: sea (raw input) and islands (, ) List chunks = split(pattern); @@ -282,14 +281,6 @@ public class ParseTreePatternMatcher { return tokens; } - public static Map toMap(String[] keys, int offset) { - Map m = new HashMap(); - for (int i=0; i = ;" into 4 chunks for tokenizing by tokenize() */ public List split(String pattern) { int p = 0;