Example #1
0
 /// <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()),
     });
Example #2
0
 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
         }),
     });
Example #3
0
        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)));
        }
Example #4
0
 public static TagTypeTag Tag_Held_Type(DynamicTag obj, TagData data)
 {
     return(new TagTypeTag(obj.Internal.GetTagType(data.TagSystem.Types)));
 }
Example #5
0
 public static TagTypeTag Tag_Type(DynamicTag obj, TagData data)
 {
     return(new TagTypeTag(data.TagSystem.Types.Type_Dynamic));
 }
Example #6
0
 public static DynamicTag Tag_Duplicate(DynamicTag obj, TagData data)
 {
     return(new DynamicTag(obj.Internal));
 }
Example #7
0
 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)));
 }
Example #8
0
 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)));
 }
Example #9
0
 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)));
 }
Example #10
0
 public static void SetSubObject(DynamicTag tag, TemplateObject value, string name, ObjectEditSource source)
 {
     DebugVarSetCommand.SetSubObject(tag.Internal, value, source.Entry, source.Queue, name);
 }
Example #11
0
 public static TemplateObject GetSubSettable(DynamicTag tag, string name, ObjectEditSource source)
 {
     return(DebugVarSetCommand.GetSubObject(tag.Internal, source.Entry, source.Queue, name));
 }