本文整理汇总了C#中Ioke.Lang.IokeObject.SetActivatable方法的典型用法代码示例。如果您正苦于以下问题:C# IokeObject.SetActivatable方法的具体用法?C# IokeObject.SetActivatable怎么用?C# IokeObject.SetActivatable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ioke.Lang.IokeObject
的用法示例。
在下文中一共展示了IokeObject.SetActivatable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public override void Init(IokeObject obj)
{
obj.Kind = "DefaultSyntax";
obj.SetActivatable(true);
obj.RegisterMethod(obj.runtime.NewNativeMethod("returns the name of the syntax",
new TypeCheckingNativeMethod.WithNoArguments("name", obj,
(method, on, args, keywords, _context, message) => {
return _context.runtime.NewText(((DefaultSyntax)IokeObject.dataOf(on)).name);
})));
obj.RegisterMethod(obj.runtime.NewNativeMethod("activates this syntax with the arguments given to call",
new NativeMethod("call", DefaultArgumentsDefinition.builder()
.WithRestUnevaluated("arguments")
.Arguments,
(method, _context, message, on, outer) => {
return Interpreter.Activate(IokeObject.As(on, _context), _context, message, _context.RealContext);
})));
obj.RegisterMethod(obj.runtime.NewNativeMethod("returns the result of activating this syntax without actually doing the replacement or execution part.",
new NativeMethod("expand", DefaultArgumentsDefinition.builder()
.WithRestUnevaluated("arguments")
.Arguments,
(method, _context, message, on, outer) => {
object onAsSyntax = _context.runtime.DefaultSyntax.ConvertToThis(on, message, _context);
return ((DefaultSyntax)IokeObject.dataOf(onAsSyntax)).Expand(IokeObject.As(onAsSyntax, context), context, message, context.RealContext, null);
})));
obj.RegisterMethod(obj.runtime.NewNativeMethod("returns the message chain for this syntax",
new TypeCheckingNativeMethod.WithNoArguments("message", obj,
(method, on, args, keywords, _context, message) => {
return ((AssociatedCode)IokeObject.dataOf(on)).Code;
})));
obj.RegisterMethod(obj.runtime.NewNativeMethod("returns the code for the argument definition",
new TypeCheckingNativeMethod.WithNoArguments("argumentsCode", obj,
(method, on, args, keywords, _context, message) => {
return _context.runtime.NewText(((AssociatedCode)IokeObject.dataOf(on)).ArgumentsCode);
})));
obj.RegisterMethod(obj.runtime.NewNativeMethod("Returns a text inspection of the object",
new TypeCheckingNativeMethod.WithNoArguments("inspect", obj,
(method, on, args, keywords, _context, message) => {
return _context.runtime.NewText(DefaultSyntax.GetInspect(on));
})));
obj.RegisterMethod(obj.runtime.NewNativeMethod("Returns a brief text inspection of the object",
new TypeCheckingNativeMethod.WithNoArguments("notice", obj,
(method, on, args, keywords, _context, message) => {
return _context.runtime.NewText(DefaultSyntax.GetNotice(on));
})));
obj.RegisterMethod(obj.runtime.NewNativeMethod("returns the full code of this syntax, as a Text",
new TypeCheckingNativeMethod.WithNoArguments("code", obj,
(method, on, args, keywords, _context, message) => {
IokeData data = IokeObject.dataOf(on);
if(data is DefaultSyntax) {
return _context.runtime.NewText(((DefaultSyntax)data).CodeString);
} else {
return _context.runtime.NewText(((AliasMethod)data).CodeString);
}
})));
obj.RegisterMethod(obj.runtime.NewNativeMethod("returns idiomatically formatted code for this syntax",
new TypeCheckingNativeMethod.WithNoArguments("formattedCode", obj,
(method, on, args, keywords, _context, message) => {
return _context.runtime.NewText(((AssociatedCode)IokeObject.dataOf(on)).FormattedCode(method));
})));
}
示例2: Init
public override void Init(IokeObject obj)
{
obj.Kind = "DefaultMacro";
obj.SetActivatable(true);
obj.RegisterMethod(obj.runtime.NewNativeMethod("returns the name of the macro",
new TypeCheckingNativeMethod.WithNoArguments("name", obj,
(method, on, args, keywords, _context, message) => {
return _context.runtime.NewText(((DefaultMacro)IokeObject.dataOf(on)).name);
})));
obj.RegisterMethod(obj.runtime.NewNativeMethod("activates this macro with the arguments given to call",
new NativeMethod("call", DefaultArgumentsDefinition.builder()
.WithRestUnevaluated("arguments")
.Arguments,
(method, _context, message, on, outer) => {
return Interpreter.Activate(IokeObject.As(on, _context), _context, message, _context.RealContext);
})));
obj.RegisterMethod(obj.runtime.NewNativeMethod("returns the message chain for this macro",
new TypeCheckingNativeMethod.WithNoArguments("message", obj,
(method, on, args, keywords, _context, message) => {
return ((DefaultMacro)IokeObject.dataOf(on)).Code;
})));
obj.RegisterMethod(obj.runtime.NewNativeMethod("returns the code for the argument definition",
new TypeCheckingNativeMethod.WithNoArguments("argumentsCode", obj,
(method, on, args, keywords, _context, message) => {
return _context.runtime.NewText(((AssociatedCode)IokeObject.dataOf(on)).ArgumentsCode);
})));
obj.RegisterMethod(obj.runtime.NewNativeMethod("Returns a text inspection of the object",
new TypeCheckingNativeMethod.WithNoArguments("inspect", obj,
(method, on, args, keywords, _context, message) => {
return _context.runtime.NewText(DefaultMacro.GetInspect(on));
})));
obj.RegisterMethod(obj.runtime.NewNativeMethod("Returns a brief text inspection of the object",
new TypeCheckingNativeMethod.WithNoArguments("notice", obj,
(method, on, args, keywords, _context, message) => {
return _context.runtime.NewText(DefaultMacro.GetNotice(on));
})));
obj.RegisterMethod(obj.runtime.NewNativeMethod("returns the full code of this macro, as a Text",
new TypeCheckingNativeMethod.WithNoArguments("code", obj,
(method, on, args, keywords, _context, message) => {
IokeData data = IokeObject.dataOf(on);
if(data is DefaultMacro) {
return _context.runtime.NewText(((DefaultMacro)data).CodeString);
} else {
return _context.runtime.NewText(((AliasMethod)data).CodeString);
}
})));
obj.RegisterMethod(obj.runtime.NewNativeMethod("returns idiomatically formatted code for this macro",
new TypeCheckingNativeMethod.WithNoArguments("formattedCode", obj,
(method, on, args, keywords, _context, message) => {
return _context.runtime.NewText(((AssociatedCode)IokeObject.dataOf(on)).FormattedCode(method));
})));
}