public static object[] to_linear(HitomiDataAdvancedQuery query)
        {
            var querys = new object[100];
            var stack  = new Stack <HitomiDataAdvancedQuery>();
            var pos    = new Stack <int>();
            var max    = 1;

            stack.Push(query);
            pos.Push(1);

            while (stack.Count > 0)
            {
                var pop = stack.Pop();
                var ps  = pos.Pop();

                max        = Math.Max(max, ps);
                querys[ps] = pop;

                if (pop.left_query != null)
                {
                    stack.Push(pop.left_query);
                    pos.Push(ps * 2);
                }
                if (pop.right_query != null)
                {
                    stack.Push(pop.right_query);
                    pos.Push(ps * 2 + 1);
                }
            }

            return(querys.Take(max + 1).ToArray());
        }
        public static HitomiDataAdvancedQuery make_tree(string query_string)
        {
            var stack   = new Stack <HitomiDataAdvancedQuery>();
            var postfix = to_postfix(query_string);

            while (postfix.Count > 0)
            {
                string token = postfix.Pop();

                switch (token[0])
                {
                case '(': break;

                case '-':
                {
                    var s1 = stack.Pop();
                    var s2 = stack.Pop();
                    stack.Push(new HitomiDataAdvancedQuery
                        {
                            combination = HitomiDataAdvancedQueryCombinationOption.Difference,
                            left_query  = s2,
                            right_query = s1,
                            is_operator = true
                        });
                }
                break;

                case '|':
                {
                    var s1 = stack.Pop();
                    var s2 = stack.Pop();
                    stack.Push(new HitomiDataAdvancedQuery
                        {
                            combination = HitomiDataAdvancedQueryCombinationOption.Combination,
                            left_query  = s2,
                            right_query = s1,
                            is_operator = true
                        });
                }
                break;

                case '&':
                case '+':
                {
                    var s1 = stack.Pop();
                    var s2 = stack.Pop();
                    stack.Push(new HitomiDataAdvancedQuery
                        {
                            combination = HitomiDataAdvancedQueryCombinationOption.Default,
                            left_query  = s2,
                            right_query = s1,
                            is_operator = true
                        });
                }
                break;

                case '~':
                {
                    var s = stack.Pop();
                    s.option = HitomiDataAdvancedQueryTokenOption.Complement;
                    stack.Push(s);
                }
                break;

                default:
                    var query_node = new HitomiDataAdvancedQuery
                    {
                        token       = token,
                        token_type  = HitomiDataAdvancedQueryTokenType.Common,
                        is_operator = false
                    };
                    if (token.Contains(':'))
                    {
                        if (token_dic.ContainsKey(token.Split(':')[0]))
                        {
                            query_node.token_type = token_dic[token.Split(':')[0]];
                        }
                        else
                        {
                            query_node.token_type = HitomiDataAdvancedQueryTokenType.None;
                        }
                        query_node.token = token.Split(':')[1];
                    }
                    stack.Push(query_node);
                    break;
                }
            }

            return(stack.Pop());
        }