/// <summary> /// Get an integer tag relevant to the specified input, erroring on the command system if invalid input is given (Returns 0 in that case). /// Never null! /// </summary> /// <param name="err">Error call if something goes wrong.</param> /// <param name="input">The input text to create a integer from.</param> /// <returns>The integer tag.</returns> public static IntegerTag For(TemplateObject input, Action <string> err) { return(input switch { IntegerTag itag => itag, IIntegerTagForm itf => new IntegerTag(itf.IntegerForm), DynamicTag dtag => For(dtag.Internal, err), _ => For(err, input.ToString()), });
public static ListTag CreateFor(TemplateObject input) { return(input switch { ListTag ltag => ltag, IListTagForm lform => lform.ListForm, DynamicTag dtag => CreateFor(dtag.Internal), TextTag _ => For(input.ToString()), _ => new ListTag(new List <TemplateObject>() { input }), });
public static DynamicTag Tag_DynamicAnyProcessor(DynamicTag inputObject, TagData data) { string tagName = data.Bits[data.cInd].Key; TemplateObject tagObject = inputObject.Internal; TagType originalType = tagObject.GetTagType(data.TagSystem.Types); TagType objectType = originalType; TagHelpInfo tagHelper; while (!objectType.TagHelpers.TryGetValue(tagName, out tagHelper)) { if (objectType.SubType == null) { throw data.Error("Invalid sub-tag '" + TextStyle.Separate + tagName + TextStyle.Base + "' at sub-tag index " + TextStyle.Separate + data.cInd + TextStyle.Base + " for type '" + TextStyle.Separate + originalType.TypeName + TextStyle.Base + (tagName.Trim().Length == 0 ? "' (stray '.' dot symbol?)!" : "' (sub-tag doesn't seem to exist)!")); } tagObject = objectType.GetNextTypeDown(tagObject); objectType = objectType.SubType; } return(new DynamicTag(tagHelper.RunTagLive(tagObject, data))); }
public static TagTypeTag Tag_Held_Type(DynamicTag obj, TagData data) { return(new TagTypeTag(obj.Internal.GetTagType(data.TagSystem.Types))); }
public static TagTypeTag Tag_Type(DynamicTag obj, TagData data) { return(new TagTypeTag(data.TagSystem.Types.Type_Dynamic)); }
public static DynamicTag Tag_Duplicate(DynamicTag obj, TagData data) { return(new DynamicTag(obj.Internal)); }
public static DynamicTag Divide(DynamicTag first, DynamicTag val, ObjectEditSource source) { return(new DynamicTag(DebugVarSetCommand.Operate(first.Internal, val.Internal, source.Entry, source.Queue, ObjectOperation.DIVIDE))); }
public static DynamicTag Multiply(DynamicTag first, DynamicTag val, ObjectEditSource source) { return(new DynamicTag(DebugVarSetCommand.Operate(first.Internal, val.Internal, source.Entry, source.Queue, ObjectOperation.MULTIPLY))); }
public static DynamicTag Subtract(DynamicTag first, DynamicTag val, ObjectEditSource source) { return(new DynamicTag(DebugVarSetCommand.Operate(first.Internal, val.Internal, source.Entry, source.Queue, ObjectOperation.SUBTRACT))); }
public static void SetSubObject(DynamicTag tag, TemplateObject value, string name, ObjectEditSource source) { DebugVarSetCommand.SetSubObject(tag.Internal, value, source.Entry, source.Queue, name); }
public static TemplateObject GetSubSettable(DynamicTag tag, string name, ObjectEditSource source) { return(DebugVarSetCommand.GetSubObject(tag.Internal, source.Entry, source.Queue, name)); }