Пример #1
0
        public static object[] Parse(Type[] parameterTypes, StringArguments args)
        {
            List <object> arguments = new();
            //for each arg we need to see if its a:
            //1: hyperlink
            //2: Optional arg
            //3: reg arg.
            int index = 1;

            while (index < parameterTypes.Length)
            {
                int oldPos = args.GetCurrentPosition();

                //Is this a hyperlink?
                if (Hyperlink.TryConsume(out dynamic value, parameterTypes[index], args) || ParseArgument(out value, parameterTypes[index], args))
                {
                    index++;
                }

                if (args.IsAtEnd() && index < parameterTypes.Length)
                {
                    //We found a optional arg and we dont have the correct amount of args
                    args.SetCurrentPosition(oldPos);
                    arguments.Add(default);