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

69 lines
2.7 KiB
Java

package c.a.t.a;
import android.text.SpannableStringBuilder;
import c0.z.d.m;
import com.discord.simpleast.code.CodeNode;
import com.discord.simpleast.core.node.Node;
import com.discord.simpleast.core.node.StyleNode;
import com.discord.simpleast.core.parser.ParseSpec;
import com.discord.simpleast.core.parser.Parser;
import com.discord.simpleast.core.parser.Rule;
import java.util.Iterator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/* compiled from: CodeRules.kt */
public final class c extends Rule<R, Node<R>, S> {
public final /* synthetic */ StyleNode.a a;
public final /* synthetic */ StyleNode.a b;
/* compiled from: CodeRules.kt */
public static final class a extends Node.a<R> {
public final /* synthetic */ c a;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public a(c cVar, CodeNode codeNode, Node[] nodeArr) {
super(nodeArr);
this.a = cVar;
}
@Override // com.discord.simpleast.core.node.Node.a, com.discord.simpleast.core.node.Node
public void render(SpannableStringBuilder spannableStringBuilder, R r2) {
m.checkNotNullParameter(spannableStringBuilder, "builder");
int length = spannableStringBuilder.length();
super.render(spannableStringBuilder, r2);
Iterator<?> it = this.a.b.get(r2).iterator();
while (it.hasNext()) {
spannableStringBuilder.setSpan(it.next(), length, spannableStringBuilder.length(), 33);
}
}
}
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public c(e eVar, StyleNode.a aVar, StyleNode.a aVar2, Pattern pattern) {
super(pattern);
this.a = aVar;
this.b = aVar2;
}
@Override // com.discord.simpleast.core.parser.Rule
public ParseSpec<R, S> parse(Matcher matcher, Parser<R, ? super Node<R>, S> parser, S s) {
m.checkNotNullParameter(matcher, "matcher");
m.checkNotNullParameter(parser, "parser");
String group = matcher.group(2);
if (group == null) {
group = "";
}
if (group.length() == 0) {
String group2 = matcher.group();
m.checkNotNullExpressionValue(group2, "matcher.group()");
c.a.t.b.a.a aVar = new c.a.t.b.a.a(group2);
m.checkNotNullParameter(aVar, "node");
return new ParseSpec<>(aVar, s);
}
CodeNode codeNode = new CodeNode(new CodeNode.a.b(group), null, this.a);
a aVar2 = new a(this, codeNode, new Node[]{codeNode});
m.checkNotNullParameter(aVar2, "node");
return new ParseSpec<>(aVar2, s);
}
}