Example #1
0
 private void CheckSetForAggregateFunction(MDXExpNode e, Analyzer analyzer)
 {
     if (e.GetMDXType() == MDXDataType.Set)
     {
         Type type = e.GetType();
         if ((type == typeof(MDXFunctionNode)) || (type == typeof(MDXPropertyNode)))
         {
             MDXBaseFunctionNode n = e as MDXBaseFunctionNode;
             if ((((!n.m_Function.Equals("MTD", StringComparison.InvariantCultureIgnoreCase) && !n.m_Function.Equals("QTD", StringComparison.InvariantCultureIgnoreCase)) && (!n.m_Function.Equals("YTD", StringComparison.InvariantCultureIgnoreCase) && !n.m_Function.Equals("WTD", StringComparison.InvariantCultureIgnoreCase))) && ((!n.m_Function.Equals("PeriodsToDate", StringComparison.InvariantCultureIgnoreCase) && !n.m_Function.Equals("AddCalculatedMembers", StringComparison.InvariantCultureIgnoreCase)) && (!n.m_Function.Equals("PeriodsToDate", StringComparison.InvariantCultureIgnoreCase) && !n.m_Function.Equals("Tail", StringComparison.InvariantCultureIgnoreCase)))) && (((!n.m_Function.Equals("Descendants", StringComparison.InvariantCultureIgnoreCase) && !n.m_Function.Equals("Distinct", StringComparison.InvariantCultureIgnoreCase)) && (!n.m_Function.Equals("Unorder", StringComparison.InvariantCultureIgnoreCase) && !n.m_Function.Equals("Hierarchize", StringComparison.InvariantCultureIgnoreCase))) && ((!n.m_Function.Equals("Children", StringComparison.InvariantCultureIgnoreCase) && !n.m_Function.Equals("MEMBERS", StringComparison.InvariantCultureIgnoreCase)) && (!n.m_Function.Equals("Siblings", StringComparison.InvariantCultureIgnoreCase) && !n.m_Function.Equals("ALLMEMBERS", StringComparison.InvariantCultureIgnoreCase)))))
             {
                 if (!n.m_Function.Equals("StrToSet", StringComparison.InvariantCultureIgnoreCase))
                 {
                     if ((!n.m_Function.Equals("Except", StringComparison.InvariantCultureIgnoreCase) && !n.m_Function.Equals("Union", StringComparison.InvariantCultureIgnoreCase)) && !n.m_Function.Equals("Intersect", StringComparison.InvariantCultureIgnoreCase))
                     {
                         if (!n.m_Function.Equals("CrossJoin", StringComparison.InvariantCultureIgnoreCase))
                         {
                             Message m = new Message(n)
                             {
                                 Id       = 0x1b,
                                 Severity = 5,
                                 Text     = string.Format("Function '{0}' was used inside aggregation function - this disables block computation mode", n.m_Function),
                                 URL      = "http://msdn.microsoft.com/en-us/library/bb934106.aspx"
                             };
                             analyzer.Add(m);
                         }
                         else
                         {
                             foreach (MDXExpNode node2 in n.m_Arguments)
                             {
                                 this.CheckSetForAggregateFunction(node2, analyzer);
                             }
                         }
                     }
                     else
                     {
                         if (n.m_Arguments.Count > 1)
                         {
                             this.CheckSetForAggregateFunction(n.m_Arguments[0], analyzer);
                         }
                         if (n.m_Arguments.Count > 2)
                         {
                             this.CheckSetForAggregateFunction(n.m_Arguments[1], analyzer);
                         }
                     }
                 }
             }
             else if (n.m_Arguments.Count > 1)
             {
                 this.CheckSetForAggregateFunction(n.m_Arguments[0], analyzer);
             }
         }
         else if (type == typeof(MDXBinOpNode))
         {
             MDXBinOpNode node3 = e as MDXBinOpNode;
             if ((!node3.m_Op.Equals("-") && !node3.m_Op.Equals("*")) && (!node3.m_Op.Equals(":") && !node3.m_Op.Equals("+")))
             {
                 Message message2 = new Message(node3)
                 {
                     Id       = 0x1c,
                     Severity = 5,
                     Text     = string.Format("Operator '{0}' was used inside aggregation function - this disables block computation mode", node3.m_Op),
                     URL      = "http://crawlmsdn.microsoft.com/en-us/library/bb934106(SQL.100).aspx"
                 };
                 analyzer.Add(message2);
             }
             if (!node3.Equals(":"))
             {
                 this.CheckSetForAggregateFunction(node3.m_Exp1, analyzer);
                 this.CheckSetForAggregateFunction(node3.m_Exp2, analyzer);
             }
         }
         else if (type == typeof(MDXUnaryOpNode))
         {
             MDXUnaryOpNode node4 = e as MDXUnaryOpNode;
             if (!node4.m_Op.Equals("-"))
             {
                 Message message3 = new Message(node4)
                 {
                     Id       = 0x1d,
                     Severity = 5,
                     Text     = string.Format("Operator '{0}' was used inside aggregation function - this disables block computation mode", node4.m_Op),
                     URL      = "http://crawlmsdn.microsoft.com/en-us/library/bb934106(SQL.100).aspx"
                 };
                 analyzer.Add(message3);
             }
             this.CheckSetForAggregateFunction(node4.m_Exp, analyzer);
         }
         else if (type == typeof(MDXTupleNode))
         {
             MDXTupleNode node5 = e as MDXTupleNode;
             foreach (MDXExpNode node6 in node5.m_List)
             {
                 this.CheckSetForAggregateFunction(node6, analyzer);
             }
         }
         else if (type == typeof(MDXEnumSetNode))
         {
             MDXEnumSetNode node7 = e as MDXEnumSetNode;
             foreach (MDXExpNode node8 in node7.m_List)
             {
                 this.CheckSetForAggregateFunction(node8, analyzer);
             }
         }
     }
 }
Example #2
0
 internal override void Analyze(Analyzer analyzer)
 {
     base.Analyze(analyzer);
     if (!base.m_IsCommonSubExpr)
     {
         if (base.m_Function.Contains("."))
         {
             Message m = new Message(this)
             {
                 Id       = 30,
                 Text     = string.Format("The usage of user-defined stored procedure '{0}' will disable block computation mode", base.m_Function),
                 Severity = 3,
                 URL      = "http://sqlblog.com/blogs/mosha/archive/2007/04/19/best-practices-for-server-adomd-net-stored-procedures.aspx"
             };
             analyzer.Add(m);
         }
         if (base.m_Function.StartsWith("StrTo", StringComparison.InvariantCultureIgnoreCase))
         {
             bool flag = false;
             if (((base.m_Arguments.Count >= 2) && (base.m_Arguments[1].GetType() == typeof(MDXFlagNode))) && (base.m_Arguments[1] as MDXFlagNode).GetLabel().Equals("CONSTRAINED"))
             {
                 flag = true;
             }
             if (!flag)
             {
                 Message message2 = new Message(this)
                 {
                     Id       = 0x1f,
                     Text     = string.Format("'{0}' function without CONSTRAINED flag will disable block computation mode", base.m_Function),
                     Severity = 3,
                     URL      = "http://crawlmsdn.microsoft.com/en-us/library/bb934106(SQL.100).aspx"
                 };
                 analyzer.Add(message2);
             }
         }
         if (base.XofY("IIF", "IIF"))
         {
             Message message3 = new Message(this)
             {
                 Id       = 0x20,
                 Text     = string.Format("AS2008 only: Nested IIFs can be rewritten more efficiently as CASE operator", new object[0]),
                 Severity = 2
             };
             analyzer.Add(message3);
         }
         if ((((base.m_Function.Equals("Order", StringComparison.InvariantCultureIgnoreCase) || base.m_Function.Equals("Filter", StringComparison.InvariantCultureIgnoreCase)) || (base.m_Function.StartsWith("Top", StringComparison.InvariantCultureIgnoreCase) || base.m_Function.StartsWith("Bottom", StringComparison.InvariantCultureIgnoreCase))) || (base.m_Function.Equals("NonEmpty", StringComparison.InvariantCultureIgnoreCase) || base.m_Function.Equals("Exists", StringComparison.InvariantCultureIgnoreCase))) && base.XofY(base.m_Function, base.m_Function))
         {
             Message message4 = new Message(this)
             {
                 Id       = 0x21,
                 Text     = string.Format("Calling {0}({0}) is not good for performance, consider rewriting as single {0} call", base.m_Function),
                 Severity = 2
             };
             analyzer.Add(message4);
         }
         if (analyzer.InRHS && base.m_Function.Equals("Order", StringComparison.InvariantCultureIgnoreCase))
         {
             Message message5 = new Message(this)
             {
                 Id       = 0x22,
                 Text     = string.Format("Due to bug in Order function, consider rewriting Order(set,exp,BDESC) as TopCount(set,set.Count,exp)", new object[0]),
                 Severity = 1,
                 URL      = "http://cwebbbi.spaces.live.com/blog/cns!7B84B0F2C239489A!1262.entry"
             };
             analyzer.Add(message5);
         }
         if (base.XofY("Filter", "CrossJoin"))
         {
             Message message6 = new Message(this)
             {
                 Id       = 0x23,
                 Text     = string.Format("Consider rewriting Filter(CrossJoin(set)) as CrossJoin(Filter()) for improved performance", new object[0]),
                 Severity = 1
             };
             analyzer.Add(message6);
         }
         if (base.XofY("Filter", "Order"))
         {
             Message message7 = new Message(this)
             {
                 Id       = 0x24,
                 Text     = string.Format("Consider changing Filter(Order(set)) to Order(Filter()) for better performance", new object[0]),
                 Severity = 3
             };
             analyzer.Add(message7);
         }
         if (base.XofY("NonEmpty", "Order"))
         {
             Message message8 = new Message(this)
             {
                 Id       = 0x25,
                 Text     = string.Format("Consider changing NonEmpty(Order(set)) to Order(NonEmpty()) for better performance", new object[0]),
                 Severity = 3
             };
             analyzer.Add(message8);
         }
         if (base.XofY("Count", "Filter"))
         {
             Message message9 = new Message(this)
             {
                 Id       = 0x26,
                 Text     = string.Format("Consider rewriting Count(Filter(set, cond)) construct as Sum(set, summator) with summator IIF(cond, 1, NULL)", new object[0]),
                 URL      = "http://sqlblog.com/blogs/mosha/archive/2007/11/22/optimizing-count-filter-expressions-in-mdx.aspx",
                 Severity = 2
             };
             analyzer.Add(message9);
         }
         if ((base.m_Function.Equals("Filter", StringComparison.InvariantCultureIgnoreCase) && (base.m_Arguments.Count > 1)) && (base.m_Arguments[1].GetType() == typeof(MDXBinOpNode)))
         {
             bool         flag2 = false;
             MDXBinOpNode node  = base.m_Arguments[1] as MDXBinOpNode;
             if (node.m_Exp1.GetType() == typeof(MDXPropertyNode))
             {
                 MDXPropertyNode node2 = node.m_Exp1 as MDXPropertyNode;
                 if (node2.m_Function.Equals("Properties", StringComparison.InvariantCultureIgnoreCase))
                 {
                     flag2 = true;
                 }
             }
             if (node.m_Exp2.GetType() == typeof(MDXPropertyNode))
             {
                 MDXPropertyNode node3 = node.m_Exp2 as MDXPropertyNode;
                 if (node3.m_Function.Equals("Properties", StringComparison.InvariantCultureIgnoreCase))
                 {
                     flag2 = true;
                 }
             }
             if (flag2)
             {
                 Message message10 = new Message(this)
                 {
                     Id       = 0x27,
                     Text     = string.Format("Consider rewriting Filter(set, h.Properties() {0} ...) using Exists function", node.m_Op),
                     Severity = 2
                 };
                 analyzer.Add(message10);
             }
         }
         if (base.XofY("Rank", "Order"))
         {
             Message message11 = new Message(this)
             {
                 Id       = 40,
                 Text     = string.Format("Consider rewriting Rank(item, Order(set, sort_criteria)) as Rank(item, set, sort_criteria) or using DYNAMIC sets", new object[0]),
                 URL      = "http://sqlblog.com/blogs/mosha/archive/2006/03/14/ranking-in-mdx.aspx",
                 Severity = 5
             };
             analyzer.Add(message11);
         }
         if (base.XofY("Aggregate", ".ALLMEMBERS"))
         {
             Message message12 = new Message(this)
             {
                 Id       = 0x29,
                 Text     = string.Format("Aggregate(<o>.ALLMEMBERS) will break when there will be calculated members. Use Aggregate(<o>.MEMBERS) instead.", new object[0]),
                 Severity = 5
             };
             analyzer.Add(message12);
         }
         if (base.XofY("Tail", "Head") || base.XofY("Head", "Tail"))
         {
             Message message13 = new Message(this)
             {
                 Id       = 0x2a,
                 Text     = string.Format("Consider using MDX function SubSet instead of Tail(Head(...)) construct", new object[0]),
                 Severity = 0
             };
             analyzer.Add(message13);
         }
         if (base.XofY("Count", "Descendants"))
         {
             Message message14 = new Message(this)
             {
                 Id       = 0x2b,
                 Text     = string.Format("If you are trying to count number of members in current selection - consider introducing special measure group for this dimension", new object[0]),
                 URL      = "http://sqlblog.com/blogs/mosha/archive/2007/05/27/counting-days-in-mdx.aspx",
                 Severity = 2
             };
             analyzer.Add(message14);
         }
     }
 }
Example #3
0
        public override SSYaccStackElement reduce(int q_prod, int q_size)
        {
            string    canonicalName;
            MDXObject obj2;
            bool      flag;

            if (this.m_Cancel)
            {
                base.doError();
                return(null);
            }
            if (this.m_ColorCodeOnly)
            {
                return(this.ColorCodeReduce(q_prod, q_size));
            }
            MDXStackElem elem = (MDXStackElem)this.stackElement();

            switch (q_prod)
            {
            case 1:
                this.m_Node = this.ChildNode(1);
                return(elem);

            case 2:
                this.m_Node = this.ChildNode(0);
                return(elem);

            case 3:
            {
                MDXScriptNode    node64 = new MDXScriptNode();
                MDXStatementNode stmt   = (MDXStatementNode)this.ChildNode(0);
                node64.Add(stmt);
                elem.SetNode(node64);
                return(elem);
            }

            case 4:
            case 6:
            {
                MDXScriptNode    node66 = (MDXScriptNode)this.ChildNode(0);
                MDXStatementNode node67 = (MDXStatementNode)this.ChildNode(2);
                if (q_prod == 6)
                {
                    node66.Add(new MDXGoNode());
                }
                node66.Add(node67);
                elem.SetNode(node66);
                return(elem);
            }

            case 5:
                elem.SetNode(this.ChildNode(0));
                return(elem);

            case 7:
                elem.SetNode(this.ChildNode(0));
                this.SetSource(elem.GetNode(), 1);
                return(elem);

            case 8:
                elem.SetNode(this.ChildNode(0));
                this.SetSource(elem.GetNode(), 1);
                return(elem);

            case 9:
                elem.SetNode(null);
                return(elem);

            case 10:
            {
                this.ColorKeyword(0);
                MDXSelectNode       select      = this.ChildNode(3) as MDXSelectNode;
                MDXExpListNode      returnattrs = this.ChildNode(4) as MDXExpListNode;
                MDXDrillThroughNode node81      = new MDXDrillThroughNode(select, returnattrs);
                this.SetSource(node81, 5);
                elem.SetNode(node81);
                return(elem);
            }

            case 11:
                elem.SetNode(this.ChildNode(0));
                return(elem);

            case 12:
            {
                this.ColorKeyword(0);
                MDXCalculateNode node76 = new MDXCalculateNode();
                this.SetSource(node76, 1);
                elem.SetNode(node76);
                return(elem);
            }

            case 13:
                elem.SetNode(this.ChildNode(0));
                this.SetSource(elem.GetNode(), 1);
                return(elem);

            case 14:
                elem.SetNode(this.ChildNode(0));
                this.SetSource(elem.GetNode(), 1);
                return(elem);

            case 15:
                elem.SetNode(this.ChildNode(0));
                this.SetSource(elem.GetNode(), 1);
                return(elem);

            case 0x10:
            {
                MDXFreezeNode node95 = new MDXFreezeNode();
                elem.SetNode(node95);
                this.SetSource(elem.GetNode(), 1);
                return(elem);
            }

            case 0x11:
                this.ColorKeyword(0);
                this.ColorKeyword(2);
                this.ColorKeyword(4);
                this.ColorKeyword(5);
                elem.SetNode(null);
                return(elem);

            case 0x12:
            {
                this.ColorKeyword(1);
                this.ColorKeyword(3);
                MDXWithListNode withs = (MDXWithListNode)this.ChildNode(0);
                MDXAxesListNode axes  = (MDXAxesListNode)this.ChildNode(2);
                MDXWhereNode where = (MDXWhereNode)this.ChildNode(5);
                MDXSelectNode      subselect = null;
                MDXStringConstNode cube      = null;
                if (this.ChildNode(4).GetType() != typeof(MDXSelectNode))
                {
                    cube = this.ChildNode(4) as MDXStringConstNode;
                }
                else
                {
                    subselect = this.ChildNode(4) as MDXSelectNode;
                }
                MDXExpListNode cellprops = this.ChildNode(6) as MDXExpListNode;
                MDXSelectNode  node42    = new MDXSelectNode(withs, axes, where, subselect, cube, cellprops);
                this.SetSource(node42, 7);
                elem.SetNode(node42);
                return(elem);
            }

            case 0x13:
            {
                this.ColorKeyword(0);
                MDXWithListNode node77 = this.ChildNode(2) as MDXWithListNode;
                MDXCreateNode   node78 = new MDXCreateNode(node77, this.ChildNode(1) != null);
                this.SetSource(node78, 3);
                elem.SetNode(node78);
                return(elem);
            }

            case 20:
            {
                this.ColorKeyword(0);
                MDXIDNode         name    = this.ChildNode(2) as MDXIDNode;
                MDXIDNode         exp     = new MDXIDNode("NULL");
                MDXWithMemberNode t       = new MDXWithMemberNode(name, exp, null, true);
                MDXWithListNode   node107 = new MDXWithListNode();
                node107.Add(t);
                MDXCreateNode node108 = new MDXCreateNode(node107, this.ChildNode(1) != null);
                elem.SetNode(node108);
                this.SetSource(elem.GetNode(), 3);
                return(elem);
            }

            case 0x15:
            {
                this.ColorKeyword(0);
                MDXWithMemberNode node101 = new MDXWithMemberNode(this.ChildExpNode(2), this.ChildExpNode(4), null, true);
                MDXWithListNode   node102 = new MDXWithListNode();
                node102.Add(node101);
                MDXCreateNode node103 = new MDXCreateNode(node102, this.ChildNode(1) != null);
                elem.SetNode(node103);
                this.SetSource(elem.GetNode(), 5);
                return(elem);
            }

            case 0x16:
                this.ColorKeyword(0);
                this.ColorKeyword(1);
                this.ColorKeyword(3);
                this.ColorKeyword(4);
                return(elem);

            case 0x17:
            {
                this.ColorKeyword(0);
                this.ColorKeyword(4);
                this.ColorKeyword(5);
                MDXScriptNode   script = this.ChildNode(3) as MDXScriptNode;
                MDXEndScopeNode node97 = new MDXEndScopeNode();
                this.SetSource(node97, 4, 5);
                MDXScopeNode node98 = new MDXScopeNode(this.ChildExpNode(1), script, node97);
                elem.SetNode(node98);
                this.SetSource(elem.GetNode(), 6);
                return(elem);
            }

            case 0x18:
            {
                MDXAssignmentNode node99 = new MDXAssignmentNode(null, this.ChildExpNode(0), this.ChildExpNode(2));
                elem.SetNode(node99);
                this.SetSource(elem.GetNode(), 3);
                return(elem);
            }

            case 0x19:
            {
                MDXAssignmentNode node100 = new MDXAssignmentNode(this.LexChildString(0), this.ChildExpNode(2), this.ChildExpNode(5));
                elem.SetNode(node100);
                this.SetSource(elem.GetNode(), 6);
                return(elem);
            }

            case 0x1a:
                this.ColorKeyword(0);
                return(elem);

            case 0x1b:
                this.ColorKeyword(0);
                return(elem);

            case 0x1c:
            {
                this.ColorKeyword(0);
                this.ColorKeyword(1);
                this.ColorKeyword(3);
                string               str10  = this.LexChildString(2);
                MDXSelectNode        node82 = this.ChildNode(4) as MDXSelectNode;
                MDXCreateSubcubeNode node83 = new MDXCreateSubcubeNode(str10, node82);
                this.SetSource(node83, 5);
                elem.SetNode(node83);
                return(elem);
            }

            case 0x1d:
            {
                this.ColorKeyword(0);
                this.ColorKeyword(1);
                this.ColorKeyword(3);
                string               str11  = this.LexChildString(2);
                MDXSelectNode        node84 = this.ChildNode(5) as MDXSelectNode;
                MDXCreateSubcubeNode node85 = new MDXCreateSubcubeNode(str11, node84);
                this.SetSource(node85, 7);
                elem.SetNode(node85);
                return(elem);
            }

            case 30:
            {
                MDXWithListNode node43 = new MDXWithListNode();
                this.SetSource(node43, 0);
                elem.SetNode(node43);
                return(elem);
            }

            case 0x1f:
            {
                this.ColorKeyword(0);
                MDXWithListNode node44 = (MDXWithListNode)this.ChildNode(1);
                this.SetSource(node44, 2);
                elem.SetNode(node44);
                return(elem);
            }

            case 0x20:
            {
                MDXWithListNode node45 = new MDXWithListNode();
                elem.SetNode(node45);
                return(elem);
            }

            case 0x21:
            {
                MDXWithListNode node46 = (MDXWithListNode)this.ChildNode(0);
                MDXWithNode     node47 = (MDXWithNode)this.ChildNode(1);
                node46.Add(node47);
                this.SetSource(node46, 0, 1);
                elem.SetNode(node46);
                return(elem);
            }

            case 0x22:
            {
                this.ColorKeyword(0);
                this.ColorKeyword(2);
                MDXListNode <MDXCalcPropNode> calcprops = this.ChildNode(4) as MDXListNode <MDXCalcPropNode>;
                MDXWithMemberNode             node49    = new MDXWithMemberNode(this.ChildExpNode(1), this.ChildExpNode(3), calcprops, false);
                this.SetSource(node49, 5);
                node49.HandleSingleQuotes();
                elem.SetNode(node49);
                return(elem);
            }

            case 0x23:
            case 0x24:
            {
                this.ColorKeyword(1);
                this.ColorKeyword(3);
                MDXWithSetNode node50 = new MDXWithSetNode(this.ChildExpNode(2), this.ChildExpNode(4), null, 0x24 == q_prod);
                this.SetSource(node50, 5);
                node50.HandleSingleQuotes();
                elem.SetNode(node50);
                return(elem);
            }

            case 0x25:
            {
                this.ColorKeyword(0);
                this.ColorKeyword(1);
                this.ColorKeyword(3);
                this.ColorKeyword(5);
                string scope = this.LexChildString(4);
                MDXWithCalcCellNode node51 = new MDXWithCalcCellNode(this.ChildExpNode(2), scope, this.ChildExpNode(6), null);
                this.SetSource(node51, 8);
                elem.SetNode(node51);
                return(elem);
            }

            case 0x26:
            case 0x30:
            case 0x33:
            case 0x3a:
            case 60:
            case 0x40:
            case 0x42:
            case 0x44:
            case 70:
                return(elem);

            case 0x27:
                this.ColorKeyword(0);
                return(elem);

            case 40:
                this.ColorKeyword(0);
                return(elem);

            case 0x29:
            {
                MDXListNode <MDXCalcPropNode> node68 = new MDXListNode <MDXCalcPropNode>();
                elem.SetNode(node68);
                return(elem);
            }

            case 0x2a:
            {
                MDXExpNode      node69 = this.ChildExpNode(4);
                MDXCalcPropNode node70 = new MDXCalcPropNode(this.LexChildString(2), node69);
                this.SetSource(node70, 2, 4);
                MDXListNode <MDXCalcPropNode> node71 = this.ChildNode(0) as MDXListNode <MDXCalcPropNode>;
                node71.Add(node70);
                this.SetSource(node71, 5);
                elem.SetNode(node71);
                return(elem);
            }

            case 0x2b:
            {
                MDXAxesListNode node52 = new MDXAxesListNode();
                elem.SetNode(node52);
                return(elem);
            }

            case 0x2c:
                elem.SetNode(this.ChildNode(0));
                this.SetSource(elem.GetNode(), 1);
                return(elem);

            case 0x2d:
            {
                MDXAxesListNode node53 = new MDXAxesListNode();
                MDXAxisNode     node54 = (MDXAxisNode)this.ChildNode(0);
                node53.Add(node54);
                this.SetSource(node53, 1);
                elem.SetNode(node53);
                return(elem);
            }

            case 0x2e:
            {
                MDXAxesListNode node55 = (MDXAxesListNode)this.ChildNode(0);
                MDXAxisNode     node56 = (MDXAxisNode)this.ChildNode(2);
                node55.Add(node56);
                this.SetSource(node55, 3);
                elem.SetNode(node55);
                return(elem);
            }

            case 0x2f:
            {
                this.ColorKeyword(4);
                MDXExpNode      set    = this.ChildExpNode(1);
                MDXNonEmptyNode node58 = null;
                if (this.ChildNode(0) != null)
                {
                    node58 = this.ChildNode(0) as MDXNonEmptyNode;
                    this.SetSource(node58, 2);
                    node58.SetSet(set);
                    set = node58;
                }
                MDXExpListNode     dimprops = this.ChildNode(3) as MDXExpListNode;
                MDXStringConstNode node60   = (MDXStringConstNode)this.ChildNode(5);
                MDXAxisNode        node61   = new MDXAxisNode(node60.GetString(), set, dimprops, this.ChildExpNode(2));
                this.SetSource(node61, 6);
                elem.SetNode(node61);
                return(elem);
            }

            case 0x31:
                this.ColorKeyword(0);
                this.ColorKeyword(1);
                elem.SetNode(this.ChildNode(2));
                return(elem);

            case 50:
                this.ColorKeyword(0);
                elem.SetNode(this.ChildNode(1));
                return(elem);

            case 0x34:
            {
                this.ColorKeyword(0);
                MDXEmptyNode node109 = new MDXEmptyNode();
                elem.SetNode(node109);
                return(elem);
            }

            case 0x35:
            {
                MDXStringConstNode node72 = new MDXStringConstNode(this.LexChildString(0));
                this.SetSource(node72, 1);
                elem.SetNode(node72);
                return(elem);
            }

            case 0x36:
            {
                MDXStringConstNode node73 = new MDXStringConstNode(this.LexChildString(0));
                this.SetSource(node73, 1);
                elem.SetNode(node73);
                return(elem);
            }

            case 0x37:
            {
                MDXStringConstNode node74 = new MDXStringConstNode(this.LexChildString(2));
                this.SetSource(node74, 4);
                elem.SetNode(node74);
                return(elem);
            }

            case 0x38:
            {
                MDXStringConstNode node62 = new MDXStringConstNode(this.LexChildString(0));
                this.SetSource(node62, 1);
                elem.SetNode(node62);
                return(elem);
            }

            case 0x39:
                elem.SetNode(this.ChildNode(1));
                return(elem);

            case 0x3b:
            {
                this.ColorKeyword(0);
                this.ColorKeyword(1);
                MDXNonEmptyNode node111 = new MDXNonEmptyNode();
                elem.SetNode(node111);
                return(elem);
            }

            case 0x3d:
                this.ColorKeyword(0);
                elem.SetNode(this.ChildExpNode(1));
                return(elem);

            case 0x3e:
                elem.SetNode(null);
                return(elem);

            case 0x3f:
            {
                this.ColorKeyword(0);
                MDXWhereNode node63 = new MDXWhereNode();
                node63.Set(this.ChildExpNode(1));
                this.SetSource(node63, 2);
                elem.SetNode(node63);
                return(elem);
            }

            case 0x41:
                this.ColorKeyword(0);
                this.ColorKeyword(1);
                elem.SetNode(this.ChildNode(2));
                return(elem);

            case 0x43:
                this.ColorKeyword(0);
                return(elem);

            case 0x45:
                this.ColorKeyword(0);
                return(elem);

            case 0x47:
                elem.SetNode(this.ChildNode(1));
                return(elem);

            case 0x48:
            {
                MDXIDNode node114 = new MDXIDNode(this.LexChildString(0));
                elem.SetNode(node114);
                this.SetSource(elem.GetNode(), 1);
                return(elem);
            }

            case 0x49:
            {
                string  term    = this.LexChildString(2);
                MDXNode node115 = this.ChildNode(0);
                node115.CheckType(typeof(MDXIDNode));
                MDXIDNode node116 = (MDXIDNode)node115;
                node116.AppendName(term);
                elem.SetNode(node116);
                this.SetSource(elem.GetNode(), 3);
                return(elem);
            }

            case 0x4a:
                elem.SetNode(this.ChildNode(1));
                this.SetSource(elem.GetNode(), 3);
                return(elem);

            case 0x4b:
            {
                MDXExpListNode list   = (MDXExpListNode)this.ChildNode(1);
                MDXTupleNode   node29 = new MDXTupleNode(list);
                this.SetSource(node29, 3);
                elem.SetNode(node29);
                return(elem);
            }

            case 0x4c:
            {
                MDXExpListNode node30 = (MDXExpListNode)this.ChildNode(1);
                MDXTupleNode   node31 = new MDXTupleNode(node30);
                this.SetSource(node31, 5);
                elem.SetNode(node31);
                return(elem);
            }

            case 0x4d:
                elem.SetNode(this.ChildNode(0));
                this.SetSource(elem.GetNode(), 1);
                return(elem);

            case 0x4e:
            case 0x4f:
            {
                string             str  = this.LexChildString(0).Remove(0, 1);
                MDXStringConstNode node = new MDXStringConstNode(str.Remove(str.Length - 1, 1))
                {
                    SingleQuote = q_prod == 0x4e
                };
                elem.SetNode(node);
                this.SetSource(elem.GetNode(), 1);
                return(elem);
            }

            case 80:
            {
                MDXParamNode node110 = new MDXParamNode(this.LexChildString(0));
                elem.SetNode(node110);
                this.SetSource(elem.GetNode(), 1);
                return(elem);
            }

            case 0x51:
            case 0x52:
            case 0x53:
            case 0x54:
            case 0x55:
            {
                MDXExpNode     node2 = this.ChildExpNode(1);
                MDXUnaryOpNode node3 = new MDXUnaryOpNode(this.LexChildString(0), node2);
                elem.SetNode(node3);
                this.SetSource(elem.GetNode(), 2);
                return(elem);
            }

            case 0x56:
            case 0x57:
            case 0x58:
            case 0x59:
            case 90:
            case 0x5b:
            case 0x5c:
            case 0x5d:
            case 0x5e:
            case 0x5f:
            case 0x60:
            case 0x61:
            case 0x62:
            case 0x63:
            case 100:
            case 0x65:
            {
                MDXExpNode   node4 = this.ChildExpNode(0);
                MDXExpNode   node5 = this.ChildExpNode(2);
                MDXBinOpNode node6 = new MDXBinOpNode(this.LexChildString(1), node4, node5);
                this.SetSource(node6, 3);
                elem.SetNode(node6);
                return(elem);
            }

            case 0x66:
            case 0x67:
                this.ColorSome(0, Color.Maroon);
                //this.ColorKeyword(0);
                canonicalName = this.LexChildString(0);
                flag          = MDXParserObjects.s_ObjectsMap.TryGetValue(canonicalName, out obj2);
                if (!flag)
                {
                    canonicalName = StringUtil.CamelCase(canonicalName);
                    break;
                }
                canonicalName = obj2.CanonicalName;
                break;

            case 0x68:
            case 0x69:
            {
                MDXObject      obj4;
                MDXExpNode     node14 = this.ChildExpNode(0);
                string         key    = this.LexChildString(2);
                MDXExpListNode node15 = (MDXExpListNode)this.ChildNode(4);
                if (!MDXParserObjects.s_ObjectsMap.TryGetValue(key, out obj4) || (((obj4.SyntaxForm != MDXSyntaxForm.Method) && ((obj4.SyntaxForm != MDXSyntaxForm.Property) || (obj4.ReturnType != MDXDataType.Set))) && ((obj4.SyntaxForm != MDXSyntaxForm.Property) || (obj4.ReturnType != MDXDataType.Level))))
                {
                    if (node14.GetType() != typeof(MDXIDNode))
                    {
                        Message m = new Message(base.elementFromProduction(2).lexeme())
                        {
                            Text = string.Format("Unrecognized MDX method '{0}'", key)
                        };
                        throw new MDXParserException(m);
                    }
                    key = StringUtil.CamelCase(key);
                    MDXIDNode       node17 = node14 as MDXIDNode;
                    MDXFunctionNode node18 = new MDXFunctionNode(string.Format("{0}.{1}", node17.GetLabel(), key), node15, null, false);
                    this.SetSource(node18, 6);
                    elem.SetNode(node18);
                    return(elem);
                }
                node15.Insert(0, node14);
                MDXPropertyNode node16 = new MDXPropertyNode(obj4.CanonicalName, node15, obj4);
                this.SetSource(node16, 6);
                elem.SetNode(node16);
                return(elem);
            }

            case 0x6a:
            case 0x6b:
            {
                MDXObject  obj3;
                string     str3   = this.LexChildString(2);
                MDXExpNode node10 = this.ChildExpNode(0);
                if (!MDXParserObjects.s_ObjectsMap.TryGetValue(str3, out obj3) || (obj3.SyntaxForm != MDXSyntaxForm.Property))
                {
                    node10.CheckType(typeof(MDXIDNode));
                    MDXIDNode node13 = (MDXIDNode)node10;
                    node13.AppendName(str3);
                    MDXDataType dt = this.m_CubeInfo.DetermineType(node13.GetMDX(-1));
                    node13.SetMDXType(dt);
                    elem.SetNode(node13);
                    this.SetSource(node13, 3);
                    return(elem);
                }
                this.ColorKeyword(2);
                MDXExpListNode args = new MDXExpListNode();
                args.Add(node10);
                MDXPropertyNode node12 = new MDXPropertyNode(obj3.CanonicalName, args, obj3);
                elem.SetNode(node12);
                this.SetSource(node12, 3);
                SSLexLexeme lexeme = base.elementFromProduction(2).lexeme();
                node12.Locator.Line   = lexeme.line() + 1;
                node12.Locator.Column = lexeme.offset() + 1;
                return(elem);
            }

            case 0x6c:
            {
                string str6 = this.LexChildString(0);
                if (!MDXParserObjects.IsFlag(str6))
                {
                    MDXIDNode node20 = new MDXIDNode(str6);
                    elem.SetNode(node20);
                }
                else
                {
                    this.ColorKeyword(0);
                    MDXFlagNode node19 = new MDXFlagNode(str6.ToUpper());
                    elem.SetNode(node19);
                }
                this.SetSource(elem.GetNode(), 1);
                return(elem);
            }

            case 0x6d:
            {
                string          str7   = this.LexChildString(0).ToUpper();
                string          str8   = StringUtil.CamelCase(this.LexChildString(2));
                MDXExpListNode  node32 = (MDXExpListNode)this.ChildNode(4);
                MDXFunctionNode node33 = new MDXFunctionNode(string.Format("{0}!{1}", str7, str8), node32, null, false);
                this.SetSource(node33, 6);
                elem.SetNode(node33);
                return(elem);
            }

            case 110:
            {
                MDXExpListNode node34 = (MDXExpListNode)this.ChildNode(1);
                MDXEnumSetNode node35 = new MDXEnumSetNode(node34);
                this.SetSource(node35, 3);
                elem.SetNode(node35);
                return(elem);
            }

            case 0x6f:
            {
                this.ColorKeyword(1);
                MDXExpNode   node112 = this.ChildExpNode(0);
                string       alias   = this.LexChildString(2);
                MDXAliasNode node113 = new MDXAliasNode(node112, alias);
                elem.SetNode(node113);
                this.SetSource(node113, 3);
                return(elem);
            }

            case 0x70:
            {
                this.ColorKeyword(0);
                this.ColorKeyword(4);
                MDXEmptyNode node86 = new MDXEmptyNode();
                elem.SetNode(node86);
                return(elem);
            }

            case 0x71:
            {
                this.ColorKeyword(0);
                this.ColorKeyword(3);
                MDXListNode <MDXWhenNode> whenlist = this.ChildNode(1) as MDXListNode <MDXWhenNode>;
                MDXExpNode  elseexp = this.ChildExpNode(2);
                MDXCaseNode node89  = new MDXCaseNode(whenlist, elseexp);
                elem.SetNode(node89);
                this.SetSource(elem.GetNode(), 4);
                return(elem);
            }

            case 0x72:
            {
                MDXListNode <MDXWhenNode> node90 = new MDXListNode <MDXWhenNode>();
                MDXWhenNode node91 = this.ChildNode(0) as MDXWhenNode;
                node90.Add(node91);
                elem.SetNode(node90);
                this.SetSource(elem.GetNode(), 1);
                return(elem);
            }

            case 0x73:
            {
                MDXListNode <MDXWhenNode> node92 = this.ChildNode(0) as MDXListNode <MDXWhenNode>;
                MDXWhenNode node93 = this.ChildNode(1) as MDXWhenNode;
                node92.Add(node93);
                elem.SetNode(node92);
                this.SetSource(elem.GetNode(), 2);
                return(elem);
            }

            case 0x74:
            {
                this.ColorKeyword(0);
                this.ColorKeyword(2);
                MDXWhenNode node94 = new MDXWhenNode(this.ChildExpNode(1), this.ChildExpNode(3));
                elem.SetNode(node94);
                this.SetSource(elem.GetNode(), 4);
                return(elem);
            }

            case 0x75:
                elem.SetNode(null);
                return(elem);

            case 0x76:
                this.ColorKeyword(0);
                elem.SetNode(this.ChildNode(1));
                return(elem);

            case 0x77:
            {
                MDXExpListNode node21 = new MDXExpListNode();
                elem.SetNode(node21);
                return(elem);
            }

            case 120:
                elem.SetNode(this.ChildNode(0));
                this.SetSource(elem.GetNode(), 1);
                return(elem);

            case 0x79:
            {
                MDXExpListNode node22 = new MDXExpListNode();
                MDXExpNode     node23 = this.ChildExpNode(0);
                node22.Add(node23);
                this.SetSource(node22, 1);
                elem.SetNode(node22);
                return(elem);
            }

            case 0x7a:
            {
                MDXExpListNode node24 = (MDXExpListNode)this.ChildNode(0);
                MDXExpNode     node25 = this.ChildExpNode(2);
                node24.Add(node25);
                this.SetSource(node24, 3);
                elem.SetNode(node24);
                return(elem);
            }

            case 0x7b:
            {
                MDXExpListNode node26 = (MDXExpListNode)this.ChildNode(0);
                MDXExpNode     node27 = this.ChildExpNode(3);
                node26.Add(new MDXEmptyNode());
                node26.Add(node27);
                this.SetSource(node26, 4);
                elem.SetNode(node26);
                return(elem);
            }

            case 0x7c:
            {
                MDXIntegerConstNode node7 = new MDXIntegerConstNode(this.LexChildString(0));
                elem.SetNode(node7);
                this.SetSource(elem.GetNode(), 1);
                return(elem);
            }

            case 0x7d:
            {
                MDXFloatConstNode node75 = new MDXFloatConstNode(this.LexChildString(0));
                this.SetSource(node75, 1);
                elem.SetNode(node75);
                return(elem);
            }

            default:
                return(elem);
            }
            MDXExpListNode  expList = (MDXExpListNode)this.ChildNode(2);
            MDXFunctionNode node9   = new MDXFunctionNode(canonicalName, expList, obj2, flag);

            this.SetSource(node9, 4);
            elem.SetNode(node9);
            return(elem);
        }