discord-jadx/app/src/main/java/c/a/t/a/e.java

84 lines
3.8 KiB
Java

package c.a.t.a;
import c.d.b.a.a;
import com.discord.simpleast.core.node.Node;
import com.discord.simpleast.core.node.StyleNode;
import com.discord.simpleast.core.parser.Rule;
import d0.t.k;
import d0.t.n;
import d0.t.u;
import d0.z.d.m;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.regex.Pattern;
import kotlin.jvm.functions.Function1;
/* compiled from: CodeRules.kt */
public final class e {
public static final Pattern a;
public static final Pattern b;
/* renamed from: c reason: collision with root package name */
public static final Pattern f229c;
public static final Pattern d;
public static final Pattern e;
public static final e f = new e();
static {
Pattern compile = Pattern.compile("^```(?:([\\w+\\-.]+?)?(\\s*\\n))?([^\\n].*?)\\n*```", 32);
m.checkNotNullExpressionValue(compile, "Pattern.compile(\"\"\"^```(…n*```\"\"\", Pattern.DOTALL)");
a = compile;
Pattern compile2 = Pattern.compile("^`([^`]*?)`", 32);
m.checkNotNullExpressionValue(compile2, "Pattern.compile(\"\"\"^`([^`]*?)`\"\"\", Pattern.DOTALL)");
b = compile2;
Pattern compile3 = Pattern.compile("^(?:\\n\\s*)+");
m.checkNotNullExpressionValue(compile3, "Pattern.compile(\"\"\"^(?:\\n\\s*)+\"\"\")");
f229c = compile3;
Pattern compile4 = Pattern.compile("^[\\s\\S]+?(?=\\b|[^0-9A-Za-z\\s\\u00c0-\\uffff]|\\n| {2,}\\n|\\w+:\\S|$)");
m.checkNotNullExpressionValue(compile4, "Pattern.compile(\"\"\"^[\\s\\…|\\n| {2,}\\n|\\w+:\\S|$)\"\"\")");
d = compile4;
Pattern compile5 = Pattern.compile("^\\b\\d+?\\b");
m.checkNotNullExpressionValue(compile5, "Pattern.compile(\"\"\"^\\b\\d+?\\b\"\"\")");
e = compile5;
}
public static Rule d(e eVar, Pattern pattern, int i, StyleNode.a aVar, int i2) {
if ((i2 & 1) != 0) {
i = 0;
}
if ((i2 & 2) != 0) {
aVar = null;
}
m.checkNotNullParameter(pattern, "$this$toMatchGroupRule");
return new d(pattern, i, aVar, pattern);
}
public final <R, S> List<Rule<R, Node<R>, S>> a(f<R> fVar, List<? extends Rule<R, Node<R>, S>> list, String[] strArr, String[] strArr2, String... strArr3) {
String[] strArr4 = (String[]) Arrays.copyOf(strArr, strArr.length);
m.checkNotNullParameter(fVar, "codeStyleProviders");
m.checkNotNullParameter(strArr4, "identifiers");
StringBuilder K = a.K("^\\b(");
K.append(k.joinToString$default(strArr4, "|", (CharSequence) null, (CharSequence) null, 0, (CharSequence) null, (Function1) null, 62, (Object) null));
K.append(")(\\s+\\w+)");
Pattern compile = Pattern.compile(K.toString());
m.checkNotNullExpressionValue(compile, "Pattern.compile(\"\"\"^\\b($…String(\"|\")})(\\s+\\w+)\"\"\")");
Pattern c2 = c((String[]) Arrays.copyOf(strArr2, strArr2.length));
m.checkNotNullExpressionValue(c2, "createWordPattern(*builtIns)");
Pattern c3 = c((String[]) Arrays.copyOf(strArr3, strArr3.length));
m.checkNotNullExpressionValue(c3, "createWordPattern(*keywords)");
return u.plus((Collection) list, (Iterable) n.listOf((Object[]) new Rule[]{new b(fVar, strArr4, compile), d(this, c2, 0, fVar.g, 1), d(this, c3, 0, fVar.d, 1), d(this, e, 0, fVar.f230c, 1), d(this, f229c, 0, null, 3), d(this, d, 0, null, 3)}));
}
public final Pattern b(String str) {
return Pattern.compile("^(?:" + str + ".*?(?=\\n|$))");
}
public final Pattern c(String... strArr) {
m.checkNotNullParameter(strArr, "words");
StringBuilder K = a.K("^\\b(?:");
K.append(k.joinToString$default(strArr, "|", (CharSequence) null, (CharSequence) null, 0, (CharSequence) null, (Function1) null, 62, (Object) null));
K.append(")\\b");
return Pattern.compile(K.toString());
}
}