コード例 #1
0
ファイル: FilterParser.cs プロジェクト: WildGenie/actools
        private FilterTreeNode NextNodeOr()
        {
            var node = NextNodeNor();

            while (true)
            {
                if (NextMatchIs('|'))
                {
                    node = new FilterTreeNodeOr(node, NextNodeNor());
                }
                else if (NextMatchIs(','))
                {
                    var a = node;
                    var b = NextNodeNor();

                    var av = a as FilterTreeNodeValue;
                    if (av != null)
                    {
                        var bv = b as FilterTreeNodeValue;
                        if (bv != null && bv.Key == null)
                        {
                            bv.Key = av.Key;
                        }
                    }

                    node = new FilterTreeNodeOr(a, b);
                }
                else
                {
                    return(node);
                }
            }
        }
コード例 #2
0
        private FilterTreeNode NextNodeOr()
        {
            var    node         = NextNodeNor();
            var    previousNode = node;
            var    nodeKeySet   = false;
            string nodeKey      = null;
            var    nodeKeyNot   = false;

            while (true)
            {
                if (NextMatchIs('|'))
                {
                    previousNode = NextNodeNor();
                    nodeKeySet   = false;
                    node         = new FilterTreeNodeOr(node, previousNode);
                }
                else if (NextMatchIs(','))
                {
                    var b = NextNodeNor();

                    if (!nodeKeySet)
                    {
                        nodeKeyNot = previousNode is FilterTreeNodeNot;
                        nodeKey    = ((nodeKeyNot ? ((FilterTreeNodeNot)previousNode).A : previousNode) as FilterTreeNodeValue)?.Key;
                        nodeKeySet = nodeKey != null;
                    }

                    if (nodeKey != null)
                    {
                        if (b is FilterTreeNodeValue bv && bv.Key == null)
                        {
                            bv.Key = nodeKey;
                            if (nodeKeyNot)
                            {
                                b = new FilterTreeNodeNot(b);
                            }
                        }
                        else
                        {
                            previousNode = b;
                            nodeKeySet   = false;
                        }
                    }

                    node = new FilterTreeNodeOr(node, b);
                }