Example #1
0
 private static ImmutableMap<String, JetToken> tokenSetToMap(TokenSet tokens) {
   ImmutableMap.Builder<String, JetToken> builder = ImmutableMap.builder();
   for (IElementType token : tokens.getTypes()) {
     builder.put(token.toString(), (JetToken) token);
   }
   return builder.build();
 }
Example #2
0
  static {
    IElementType[] operations = OPERATIONS.getTypes();
    Set<IElementType> opSet = new HashSet<IElementType>(Arrays.asList(operations));
    IElementType[] usedOperations = ALL_OPERATIONS.getTypes();
    Set<IElementType> usedSet = new HashSet<IElementType>(Arrays.asList(usedOperations));

    if (opSet.size() > usedSet.size()) {
      opSet.removeAll(usedSet);
      assert false : opSet;
    }
    assert usedSet.size() == opSet.size()
        : "Either some ops are unused, or something a non-op is used";

    usedSet.removeAll(opSet);

    assert usedSet.isEmpty() : usedSet.toString();
  }
 public static boolean isFollowedBy(
     @Nullable ASTNode node, IElementType expectedType, TokenSet skipTypes) {
   return isFollowedBy(node, expectedType, skipTypes.getTypes());
 }
 public static boolean isPrecededBy(
     @Nullable ASTNode node, TokenSet expectedTypes, TokenSet skipTypes) {
   return isPrecededBy(node, expectedTypes, skipTypes.getTypes());
 }