public Locator(SSLexLexeme lexeme) { this.Line = lexeme.line() + 1; this.Column = lexeme.offset() + 1; this.Position = (lexeme.index() - lexeme.length()) - 1; if (this.Position < 0) { this.Position = 0; } this.Length = lexeme.length(); }
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); }
private void SetSource(MDXNode node, int start, int end) { try { int line = -1; int column = -1; int position = -1; int num4 = -1; int num5 = start; int num6 = end; while (num5 <= num6) { SSLexLexeme lexeme = base.elementFromProduction(num5).lexeme(); if (lexeme != null) { line = lexeme.line() + 1; column = lexeme.offset() + 1; position = (lexeme.index() - lexeme.length()) - 1; } else { MDXNode node2 = this.ChildNode(num5); if ((node2 != null) && (node2.Locator.Length != 0)) { position = node2.Locator.Position; line = node2.Locator.Line; column = node2.Locator.Column; } } if (position != -1) { break; } num5++; } node.Locator.Line = line; node.Locator.Column = column; while (num6 >= num5) { SSLexLexeme lexeme2 = base.elementFromProduction(num6).lexeme(); if (lexeme2 != null) { num4 = lexeme2.index() - 1; } else { MDXNode node3 = this.ChildNode(num6); if ((node3 != null) && (node3.Locator.Length != 0)) { num4 = node3.Locator.Position + node3.Locator.Length; } } if (num4 != -1) { break; } num6--; } for (num5 = start; num5 <= end; num5++) { SSLexLexeme lexeme3 = base.elementFromProduction(num5).lexeme(); if ((lexeme3 != null) && (lexeme3.Comments != null)) { if (node.Comments == null) { node.Comments = new List <string>(); } foreach (string str in lexeme3.Comments) { node.Comments.Add(str); } lexeme3.Comments.Clear(); } } if ((position != -1) && (num4 != -1)) { node.Locator.Position = position; node.Locator.Length = num4 - position; node.Source = this.m_Source; } } catch (Exception) { } }