use of net.kodehawa.mantarobot.commands.custom.v3.Parser in project MantaroBot by Mantaro.
the class CustomCommandHandler method handle.
public void handle(boolean preview) {
if (!processResponse())
return;
if (specialHandling())
return;
if (response.startsWith("v3:")) {
CCv3.process(prefixUsed, ctx, new Parser(response.substring(3)).parse(), preview);
return;
}
MessageBuilder builder = new MessageBuilder().setContent(filtered.matcher(response).replaceAll("-filtered regex-"));
builder.setActionRows(ActionRow.of(Button.primary("yes", ctx.getLanguageContext().get("commands.custom.custom_notice")).asDisabled()));
if (preview) {
builder.append("\n\n").append(EmoteReference.WARNING).append("**This is a preview of how a CC with this content would look like, ALL MENTIONS ARE DISABLED ON THIS MODE.**\n").append("`Command preview requested by: ").append(ctx.getAuthor().getAsTag()).append("`");
builder.denyMentions(Message.MentionType.ROLE, Message.MentionType.USER, Message.MentionType.EVERYONE, Message.MentionType.HERE);
} else {
builder.denyMentions(Message.MentionType.ROLE, Message.MentionType.EVERYONE, Message.MentionType.HERE);
}
ctx.send(builder.build());
}
use of net.kodehawa.mantarobot.commands.custom.v3.Parser in project jackrabbit by apache.
the class ParserTest method setUp.
protected void setUp() throws Exception {
super.setUp();
NamePathResolver resolver = new DefaultNamePathResolver(new DummyNamespaceResolver());
QueryObjectModelFactoryImpl factory = new QOMF(resolver);
ValueFactory vf = new ValueFactoryQImpl(QValueFactoryImpl.getInstance(), resolver);
parser = new Parser(factory, vf);
}
use of net.kodehawa.mantarobot.commands.custom.v3.Parser in project sulong by graalvm.
the class BasicNodeFactory method createInlineAssemblerExpression.
@Override
public LLVMExpressionNode createInlineAssemblerExpression(LLVMParserRuntime runtime, String asmExpression, String asmFlags, LLVMExpressionNode[] args, Type[] argTypes, Type retType, LLVMSourceLocation sourceSection) {
Type[] retTypes = null;
int[] retOffsets = null;
if (retType instanceof StructureType) {
// multiple out values
assert args[1] instanceof LLVMAllocaConstInstruction;
LLVMAllocaConstInstruction alloca = (LLVMAllocaConstInstruction) args[1];
retTypes = alloca.getTypes();
retOffsets = alloca.getOffsets();
}
Parser asmParser = new Parser(runtime.getLanguage(), sourceSection, asmExpression, asmFlags, argTypes, retType, retTypes, retOffsets);
LLVMInlineAssemblyRootNode assemblyRoot = asmParser.Parse();
LLVMFunctionDescriptor asm = LLVMFunctionDescriptor.createDescriptor(runtime.getContext(), runtime.getLibrary(), "<asm>", new FunctionType(MetaType.UNKNOWN, new Type[0], false), -1);
asm.declareInSulong(Truffle.getRuntime().createCallTarget(assemblyRoot), false);
LLVMFunctionLiteralNode asmFunction = LLVMFunctionLiteralNodeGen.create(asm);
return new LLVMCallNode(new FunctionType(MetaType.UNKNOWN, argTypes, false), asmFunction, args, sourceSection);
}
Aggregations