2021-12-17 21:59:34 +00:00
|
|
|
package b.a.t.a;
|
2021-07-24 02:37:17 +00:00
|
|
|
|
|
|
|
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;
|
2021-11-02 06:38:17 +00:00
|
|
|
import d0.g0.w;
|
|
|
|
import d0.z.d.m;
|
2021-07-24 02:37:17 +00:00
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Objects;
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
import kotlin.jvm.functions.Function3;
|
|
|
|
/* compiled from: CodeRules.kt */
|
|
|
|
public final class a extends Rule<R, Node<R>, S> {
|
|
|
|
public final /* synthetic */ Map a;
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
/* renamed from: b reason: collision with root package name */
|
|
|
|
public final /* synthetic */ StyleNode.a f282b;
|
|
|
|
public final /* synthetic */ Function3 c;
|
2021-07-24 02:37:17 +00:00
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public a(e eVar, Map map, StyleNode.a aVar, Function3 function3, Pattern pattern) {
|
|
|
|
super(pattern);
|
|
|
|
this.a = map;
|
2021-12-17 21:59:34 +00:00
|
|
|
this.f282b = aVar;
|
|
|
|
this.c = function3;
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.simpleast.core.parser.Rule
|
2021-11-02 06:38:17 +00:00
|
|
|
public ParseSpec<R, S> parse(Matcher matcher, Parser<R, ? super Node<R>, S> parser, S s2) {
|
2021-07-24 02:37:17 +00:00
|
|
|
CodeNode.a aVar;
|
|
|
|
m.checkNotNullParameter(matcher, "matcher");
|
|
|
|
m.checkNotNullParameter(parser, "parser");
|
|
|
|
String group = matcher.group(1);
|
|
|
|
String group2 = matcher.group(3);
|
|
|
|
if (group2 == null) {
|
|
|
|
group2 = "";
|
|
|
|
}
|
|
|
|
String group3 = matcher.group(2);
|
|
|
|
List list = null;
|
|
|
|
boolean z2 = false;
|
|
|
|
if (group3 != null) {
|
|
|
|
z2 = w.contains$default((CharSequence) group3, '\n', false, 2, (Object) null);
|
|
|
|
}
|
|
|
|
if (group != null) {
|
|
|
|
list = (List) this.a.get(group);
|
|
|
|
}
|
|
|
|
if (list != null) {
|
2021-11-02 06:38:17 +00:00
|
|
|
List parse = parser.parse(group2, s2, list);
|
2021-07-24 02:37:17 +00:00
|
|
|
Objects.requireNonNull(parse, "null cannot be cast to non-null type kotlin.collections.List<com.discord.simpleast.core.node.Node<R>>");
|
2022-01-13 08:07:50 +00:00
|
|
|
aVar = new CodeNode.a.C0175a(group2, parse);
|
2021-07-24 02:37:17 +00:00
|
|
|
} else {
|
|
|
|
aVar = new CodeNode.a.b(group2);
|
|
|
|
}
|
2021-12-17 21:59:34 +00:00
|
|
|
Node node = (Node) this.c.invoke(new CodeNode(aVar, group, this.f282b), Boolean.valueOf(z2), s2);
|
2021-07-24 02:37:17 +00:00
|
|
|
m.checkNotNullParameter(node, "node");
|
2021-11-02 06:38:17 +00:00
|
|
|
return new ParseSpec<>(node, s2);
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|