52 lines
2.3 KiB
Java
52 lines
2.3 KiB
Java
package com.discord.utilities.textprocessing;
|
|
|
|
import com.discord.simpleast.core.parser.ParseSpec;
|
|
import com.discord.simpleast.core.parser.Parser;
|
|
import com.discord.simpleast.core.parser.Rule;
|
|
import com.discord.utilities.textprocessing.Rules;
|
|
import com.discord.utilities.textprocessing.node.BlockQuoteNode;
|
|
import d0.z.d.m;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Pattern;
|
|
/* compiled from: Rules.kt */
|
|
public final class Rules$createBlockQuoteRule$1 extends Rule.BlockRule<T, BlockQuoteNode<T>, S> {
|
|
public final /* synthetic */ Rules this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public Rules$createBlockQuoteRule$1(Rules rules, Pattern pattern) {
|
|
super(pattern);
|
|
this.this$0 = rules;
|
|
}
|
|
|
|
public Matcher match(CharSequence charSequence, String str, S s2) {
|
|
m.checkNotNullParameter(charSequence, "inspectionSource");
|
|
m.checkNotNullParameter(s2, "state");
|
|
if (s2.isInQuote()) {
|
|
return null;
|
|
}
|
|
return super.match(charSequence, str, (String) s2);
|
|
}
|
|
|
|
@Override // com.discord.simpleast.core.parser.Rule.BlockRule, com.discord.simpleast.core.parser.Rule
|
|
public /* bridge */ /* synthetic */ Matcher match(CharSequence charSequence, String str, Object obj) {
|
|
return match(charSequence, str, (String) ((Rules.BlockQuoteState) obj));
|
|
}
|
|
|
|
public ParseSpec<T, S> parse(Matcher matcher, Parser<T, ? super BlockQuoteNode<T>, S> parser, S s2) {
|
|
m.checkNotNullParameter(matcher, "matcher");
|
|
m.checkNotNullParameter(parser, "parser");
|
|
m.checkNotNullParameter(s2, "state");
|
|
int i = matcher.group(1) != null ? 1 : 2;
|
|
Rules.BlockQuoteState newBlockQuoteState = s2.newBlockQuoteState(true);
|
|
BlockQuoteNode blockQuoteNode = new BlockQuoteNode();
|
|
int start = matcher.start(i);
|
|
int end = matcher.end(i);
|
|
m.checkNotNullParameter(blockQuoteNode, "node");
|
|
return new ParseSpec<>(blockQuoteNode, newBlockQuoteState, start, end);
|
|
}
|
|
|
|
@Override // com.discord.simpleast.core.parser.Rule
|
|
public /* bridge */ /* synthetic */ ParseSpec parse(Matcher matcher, Parser parser, Object obj) {
|
|
return parse(matcher, (Parser<T, ? super BlockQuoteNode<T>, Parser>) parser, (Parser) ((Rules.BlockQuoteState) obj));
|
|
}
|
|
}
|