• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Ast.BinaryOperatorExpression类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ICSharpCode.NRefactory.Ast.BinaryOperatorExpression的典型用法代码示例。如果您正苦于以下问题:C# BinaryOperatorExpression类的具体用法?C# BinaryOperatorExpression怎么用?C# BinaryOperatorExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BinaryOperatorExpression类属于ICSharpCode.NRefactory.Ast命名空间,在下文中一共展示了BinaryOperatorExpression类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: VisitBinaryOperatorExpression

            public override object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data)
            {
                if (binaryOperatorExpression.Op == BinaryOperatorType.LogicalOr)
                    UnlockWith(binaryOperatorExpression);

                return base.VisitBinaryOperatorExpression(binaryOperatorExpression, data);
            }
开发者ID:timdams,项目名称:strokes,代码行数:7,代码来源:OperatorOrAchievement.cs


示例2: VisitBinaryOperatorExpression

		public override object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data)
		{
			switch (binaryOperatorExpression.Op) {
				case BinaryOperatorType.NullCoalescing:
					return binaryOperatorExpression.Right.AcceptVisitor(this, data);
				case BinaryOperatorType.DivideInteger:
					return resolver.ProjectContent.SystemTypes.Int32;
				case BinaryOperatorType.Concat:
					return resolver.ProjectContent.SystemTypes.String;
				case BinaryOperatorType.Equality:
				case BinaryOperatorType.InEquality:
				case BinaryOperatorType.ReferenceEquality:
				case BinaryOperatorType.ReferenceInequality:
				case BinaryOperatorType.LogicalAnd:
				case BinaryOperatorType.LogicalOr:
				case BinaryOperatorType.LessThan:
				case BinaryOperatorType.LessThanOrEqual:
				case BinaryOperatorType.GreaterThan:
				case BinaryOperatorType.GreaterThanOrEqual:
					return resolver.ProjectContent.SystemTypes.Boolean;
				default:
					return MemberLookupHelper.GetCommonType(resolver.ProjectContent,
					                                        binaryOperatorExpression.Left.AcceptVisitor(this, data) as IReturnType,
					                                        binaryOperatorExpression.Right.AcceptVisitor(this, data) as IReturnType);
			}
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:26,代码来源:TypeVisitor.cs


示例3: GetCastExpression

        private CastExpression GetCastExpression(BinaryOperatorExpression binaryOperatorExpression)
        {
            TypeReference leftType = GetExpressionType(binaryOperatorExpression.Left);

            CastExpression castedUnsignedShift = new CastExpression(new TypeReference("u" + leftType.Type), binaryOperatorExpression, CastType.Cast);
            ParenthesizedExpression parenthesizedCastedUnsignedShift = new ParenthesizedExpression(castedUnsignedShift);
            return new CastExpression(new TypeReference(leftType.Type), parenthesizedCastedUnsignedShift, CastType.Cast);
        }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:8,代码来源:UnsignedShiftTransformer.cs


示例4: BuildCondition

		/// <summary>
		/// Turns "(a.b as T).d.e" into "(a != null) && (a.b is T) && ((a.b as T).d != null)"
		/// </summary>
		Expression BuildCondition(Expression targetExpr)
		{
			var parts = GetConditionParts(targetExpr);
			Expression condition = null;
			foreach (var part in parts) {
				if (condition == null) {
					// first
					condition = new ParenthesizedExpression(part);
				} else {
					condition = new BinaryOperatorExpression(new ParenthesizedExpression(part), BinaryOperatorType.LogicalAnd, condition);
				}
			}
			return condition;
		}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:17,代码来源:CheckMemberNotNull.cs


示例5: AddInteger

		/// <summary>
		/// Returns the existing expression plus the specified integer value.
		/// The old <paramref name="expr"/> object is not modified, but might be a subobject on the new expression
		/// (and thus its parent property is modified).
		/// </summary>
		public static Expression AddInteger(Expression expr, int value)
		{
			PrimitiveExpression pe = expr as PrimitiveExpression;
			if (pe != null && pe.Value is int) {
				int newVal = (int)pe.Value + value;
				return new PrimitiveExpression(newVal, newVal.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
			}
			BinaryOperatorExpression boe = expr as BinaryOperatorExpression;
			if (boe != null && boe.Op == BinaryOperatorType.Add) {
				// clone boe:
				boe = new BinaryOperatorExpression(boe.Left, boe.Op, boe.Right);
				
				boe.Right = AddInteger(boe.Right, value);
				if (boe.Right is PrimitiveExpression && ((PrimitiveExpression)boe.Right).Value is int) {
					int newVal = (int)((PrimitiveExpression)boe.Right).Value;
					if (newVal == 0) {
						return boe.Left;
					} else if (newVal < 0) {
						((PrimitiveExpression)boe.Right).Value = -newVal;
						boe.Op = BinaryOperatorType.Subtract;
					}
				}
				return boe;
			}
			if (boe != null && boe.Op == BinaryOperatorType.Subtract) {
				pe = boe.Right as PrimitiveExpression;
				if (pe != null && pe.Value is int) {
					int newVal = (int)pe.Value - value;
					if (newVal == 0)
						return boe.Left;
					
					// clone boe:
					boe = new BinaryOperatorExpression(boe.Left, boe.Op, boe.Right);
					
					if (newVal < 0) {
						newVal = -newVal;
						boe.Op = BinaryOperatorType.Add;
					}
					boe.Right = new PrimitiveExpression(newVal, newVal.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
					return boe;
				}
			}
			BinaryOperatorType opType = BinaryOperatorType.Add;
			if (value < 0) {
				value = -value;
				opType = BinaryOperatorType.Subtract;
			}
			return new BinaryOperatorExpression(expr, opType, new PrimitiveExpression(value, value.ToString(System.Globalization.NumberFormatInfo.InvariantInfo)));
		}
开发者ID:XQuantumForceX,项目名称:Reflexil,代码行数:54,代码来源:Expression.cs


示例6: VisitBinaryOperatorExpression

 public override object VisitBinaryOperatorExpression(BinaryOperatorExpression binary, object data)
 {
     int? myPrecedence = GetPrecedence(binary);
     if (GetPrecedence(binary.Left) > myPrecedence) {
         binary.Left = Deparenthesize(binary.Left);
     }
     if (GetPrecedence(binary.Right) > myPrecedence) {
         binary.Right = Deparenthesize(binary.Right);
     }
     // Associativity
     if (GetPrecedence(binary.Left) == myPrecedence && myPrecedence.HasValue) {
         binary.Left = Deparenthesize(binary.Left);
     }
     return base.VisitBinaryOperatorExpression(binary, data);
 }
开发者ID:almazik,项目名称:ILSpy,代码行数:15,代码来源:RemoveParenthesis.cs


示例7: VisitBinaryOperatorExpression

		/// <summary>
		/// We have to replace code such as:
		///		doc.FirstName ?? ""
		/// Into 
		///		doc.FirstName != null ? doc.FirstName : ""
		/// Because we use DynamicNullObject instead of null, and that preserve the null coallasing semantics.
		/// </summary>
		public override object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data)
		{
			if(binaryOperatorExpression.Op==BinaryOperatorType.NullCoalescing)
			{
				var node = new ConditionalExpression(
					new BinaryOperatorExpression(binaryOperatorExpression.Left, BinaryOperatorType.ReferenceInequality,
					                             new PrimitiveExpression(null, null)),
					binaryOperatorExpression.Left,
					binaryOperatorExpression.Right
					);
				ReplaceCurrentNode(node);
				return null;
			}

			return base.VisitBinaryOperatorExpression(binaryOperatorExpression, data);
		}
开发者ID:nzdunic,项目名称:ravendb,代码行数:23,代码来源:TransformNullCoalasingOperatorTransformer.cs


示例8: GenerateCode

		public override void GenerateCode(List<AbstractNode> nodes, IList items)
		{
			TypeReference intReference = new TypeReference("System.Int32");
			MethodDeclaration method = new MethodDeclaration("GetHashCode", Modifiers.Public | Modifiers.Override, intReference, null, null);
			Expression expr = CallGetHashCode(new IdentifierExpression(currentClass.Fields[0].Name));
			for (int i = 1; i < currentClass.Fields.Count; i++) {
				IdentifierExpression identifier = new IdentifierExpression(currentClass.Fields[i].Name);
				expr = new BinaryOperatorExpression(expr, BinaryOperatorType.ExclusiveOr,
				                                    CallGetHashCode(identifier));
			}
			method.Body = new BlockStatement();
			method.Body.AddChild(new ReturnStatement(expr));
			nodes.Add(method);
			
			TypeReference boolReference = new TypeReference("System.Boolean");
			TypeReference objectReference = new TypeReference("System.Object");
			
			method = new MethodDeclaration("Equals", Modifiers.Public | Modifiers.Override, boolReference, null, null);
			method.Parameters.Add(new ParameterDeclarationExpression(objectReference, "obj"));
			method.Body = new BlockStatement();
			
			TypeReference currentType = ConvertType(currentClass.DefaultReturnType);
			expr = new TypeOfIsExpression(new IdentifierExpression("obj"), currentType);
			expr = new ParenthesizedExpression(expr);
			expr = new UnaryOperatorExpression(expr, UnaryOperatorType.Not);
			method.Body.AddChild(new IfElseStatement(expr, new ReturnStatement(new PrimitiveExpression(false, "false"))));
			
			expr = new BinaryOperatorExpression(new ThisReferenceExpression(),
			                                    BinaryOperatorType.Equality,
			                                    new IdentifierExpression("obj"));
			method.Body.AddChild(new IfElseStatement(expr, new ReturnStatement(new PrimitiveExpression(true, "true"))));
			
			VariableDeclaration var = new VariableDeclaration("my" + currentClass.Name,
			                                                  new CastExpression(currentType, new IdentifierExpression("obj"), CastType.Cast),
			                                                  currentType);
			method.Body.AddChild(new LocalVariableDeclaration(var));
			
			expr = TestEquality(var.Name, currentClass.Fields[0]);
			for (int i = 1; i < currentClass.Fields.Count; i++) {
				expr = new BinaryOperatorExpression(expr, BinaryOperatorType.LogicalAnd,
				                                    TestEquality(var.Name, currentClass.Fields[i]));
			}
			
			method.Body.AddChild(new ReturnStatement(expr));
			
			nodes.Add(method);
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:47,代码来源:EqualsCodeGenerator.cs


示例9: VisitBinaryOperatorExpression

            public override object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data)
            {
                bool leftdangerous = false;
                bool rightdangerous = false;
                if(binaryOperatorExpression.Op== BinaryOperatorType.Equality)
                {
                    if(binaryOperatorExpression.Left is PrimitiveExpression)
                    {
                        PrimitiveExpression prim = (PrimitiveExpression) binaryOperatorExpression.Left;
                        if (prim.LiteralFormat == LiteralFormat.DecimalNumber)
                            leftdangerous = true;
                    }

                     else if (binaryOperatorExpression.Left is IdentifierExpression)
                     {
                         IdentifierExpression idexpr = (IdentifierExpression) binaryOperatorExpression.Left;
                         if (_doublefloatvariables.Contains(idexpr.Identifier))
                         {
                             leftdangerous = true;
                         }
                     }

                    if (binaryOperatorExpression.Right is PrimitiveExpression)
                    {
                        PrimitiveExpression prim = (PrimitiveExpression)binaryOperatorExpression.Right;
                        if (prim.LiteralFormat == LiteralFormat.DecimalNumber)
                            rightdangerous = true;
                    }

                    else if (binaryOperatorExpression.Right is IdentifierExpression)
                    {
                        IdentifierExpression idexpr = (IdentifierExpression)binaryOperatorExpression.Right;
                        if (_doublefloatvariables.Contains(idexpr.Identifier))
                        {
                            rightdangerous = true;
                        }
                    }

                    if(leftdangerous || rightdangerous)
                    {
                        UnlockWith(binaryOperatorExpression);
                    }
                }
                return base.VisitBinaryOperatorExpression(binaryOperatorExpression, data);
            }
开发者ID:timdams,项目名称:strokes,代码行数:45,代码来源:DangerousEqualityCheckAchievement.cs


示例10: VisitBinaryOperatorExpression

 // The following conversions are implemented:
 //   a == null -> a Is Nothing
 //   a != null -> a Is Not Nothing
 //   i++ / ++i as statement: convert to i += 1
 //   i-- / --i as statement: convert to i -= 1
 //   ForStatement -> ForNextStatement when for-loop is simple
 //   if (Event != null) Event(this, bla); -> RaiseEvent Event(this, bla)
 //   Casts to value types are marked as conversions
 public override object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data)
 {
     if (binaryOperatorExpression.Op == BinaryOperatorType.Equality || binaryOperatorExpression.Op == BinaryOperatorType.InEquality) {
         if (IsNullLiteralExpression(binaryOperatorExpression.Left)) {
             Expression tmp = binaryOperatorExpression.Left;
             binaryOperatorExpression.Left = binaryOperatorExpression.Right;
             binaryOperatorExpression.Right = tmp;
         }
         if (IsNullLiteralExpression(binaryOperatorExpression.Right)) {
             if (binaryOperatorExpression.Op == BinaryOperatorType.Equality) {
                 binaryOperatorExpression.Op = BinaryOperatorType.ReferenceEquality;
             } else {
                 binaryOperatorExpression.Op = BinaryOperatorType.ReferenceInequality;
             }
         }
     }
     return base.VisitBinaryOperatorExpression(binaryOperatorExpression, data);
 }
开发者ID:pusp,项目名称:o2platform,代码行数:26,代码来源:CSharpConstructsConvertVisitor.cs


示例11: VisitBinaryOperatorExpression

 public override object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data)
 {
     base.VisitBinaryOperatorExpression(binaryOperatorExpression, data);
     if (IsEmptyStringLiteral(binaryOperatorExpression.Right)) {
         if (binaryOperatorExpression.Op == BinaryOperatorType.Equality) {
             ReplaceCurrentNode(CallStringIsNullOrEmpty(binaryOperatorExpression.Left));
         } else if (binaryOperatorExpression.Op == BinaryOperatorType.InEquality) {
             ReplaceCurrentNode(new UnaryOperatorExpression(CallStringIsNullOrEmpty(binaryOperatorExpression.Left),
                                                            UnaryOperatorType.Not));
         }
     } else if (IsEmptyStringLiteral(binaryOperatorExpression.Left)) {
         if (binaryOperatorExpression.Op == BinaryOperatorType.Equality) {
             ReplaceCurrentNode(CallStringIsNullOrEmpty(binaryOperatorExpression.Right));
         } else if (binaryOperatorExpression.Op == BinaryOperatorType.InEquality) {
             ReplaceCurrentNode(new UnaryOperatorExpression(CallStringIsNullOrEmpty(binaryOperatorExpression.Right),
                                                            UnaryOperatorType.Not));
         }
     }
     return null;
 }
开发者ID:SergeTruth,项目名称:OxyChart,代码行数:20,代码来源:VBNetConstructsConvertVisitor.cs


示例12: TrackedVisitBinaryOperatorExpression

 public override object TrackedVisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data)
 {
     Expression left = binaryOperatorExpression.Left;
     TypeReference leftType = GetExpressionType(left);
     if (leftType != null && (leftType.RankSpecifier == null || leftType.RankSpecifier.Length == 0) && (binaryOperatorExpression.Right is PrimitiveExpression))
     {
         string fullName = GetFullName(leftType);
         if (types.Contains(fullName))
         {
             Expression minValue = (Expression) values[fullName];
             PrimitiveExpression nullRight = (PrimitiveExpression) binaryOperatorExpression.Right;
             if (nullRight.Value == null)
             {
                 BinaryOperatorExpression replacedBinOP = binaryOperatorExpression;
                 replacedBinOP.Right = minValue;
                 ReplaceCurrentNode(replacedBinOP);
             }
         }
     }
     return base.TrackedVisitBinaryOperatorExpression(binaryOperatorExpression, data);
 }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:21,代码来源:NullableValueTypeTransformer.cs


示例13: VisitBinaryOperatorExpression

        public override object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data)
        {
            base.VisitBinaryOperatorExpression(binaryOperatorExpression, data);

            if (resolver.CompilationUnit == null)
                return null;

            switch (binaryOperatorExpression.Op) {
                case BinaryOperatorType.Equality:
                case BinaryOperatorType.InEquality:
                    ConvertEqualityToReferenceEqualityIfRequired(binaryOperatorExpression);
                    break;
                case BinaryOperatorType.Add:
                    ConvertArgumentsForStringConcatenationIfRequired(binaryOperatorExpression);
                    break;
                case BinaryOperatorType.Divide:
                    ConvertDivisionToIntegerDivisionIfRequired(binaryOperatorExpression);
                    break;
            }
            return null;
        }
开发者ID:SergeTruth,项目名称:OxyChart,代码行数:21,代码来源:CSharpToVBNetConvertVisitor.cs


示例14: TrackedVisitBinaryOperatorExpression

        public override object TrackedVisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data)
        {
            if (binaryOperatorExpression.Op == BinaryOperatorType.UnsignedShiftRight)
            {
                binaryOperatorExpression.Op = BinaryOperatorType.ShiftRight;
                CastExpression castExpression = GetCastExpression(binaryOperatorExpression);
                ReplaceCurrentNode(castExpression);
            }
            else if (binaryOperatorExpression.Op == BinaryOperatorType.UnsignedShiftRightAssign)
            {
                Expression left = binaryOperatorExpression.Left;
                Expression right = new BinaryOperatorExpression(left, BinaryOperatorType.ShiftRight, binaryOperatorExpression.Right);
                right.Parent = binaryOperatorExpression.Parent;
                CastExpression castExpression = GetCastExpression((BinaryOperatorExpression) right);
                right.Parent = castExpression;
                AssignmentExpression assignment = new AssignmentExpression(left, AssignmentOperatorType.Assign, castExpression);
                assignment.Parent = binaryOperatorExpression.Parent;

                ReplaceCurrentNode(assignment);
            }
            return base.TrackedVisitBinaryOperatorExpression(binaryOperatorExpression, data);
        }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:22,代码来源:UnsignedShiftTransformer.cs


示例15: VisitBinaryOperatorExpression

 public override object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data)
 {
     bool lhs = binaryOperatorExpression.Left.AcceptVisitor(this, data) == SymbolDefined;
     bool rhs = binaryOperatorExpression.Right.AcceptVisitor(this, data) == SymbolDefined;
     bool result;
     switch (binaryOperatorExpression.Op) {
         case BinaryOperatorType.LogicalAnd:
             result = lhs && rhs;
             break;
         case BinaryOperatorType.LogicalOr:
             result = lhs || rhs;
             break;
         case BinaryOperatorType.Equality:
             result = lhs == rhs;
             break;
         case BinaryOperatorType.InEquality:
             result = lhs != rhs;
             break;
         default:
             return null;
     }
     return result ? SymbolDefined : null;
 }
开发者ID:pusp,项目名称:o2platform,代码行数:23,代码来源:ConditionalCompilation.cs


示例16: ShiftExpr

	void ShiftExpr(
//#line  2030 "VBNET.ATG" 
out Expression outExpr) {

//#line  2032 "VBNET.ATG" 
		Expression expr;
		BinaryOperatorType op = BinaryOperatorType.None;
		Location startLocation = la.Location;
		
		ConcatenationExpr(
//#line  2036 "VBNET.ATG" 
out outExpr);
		while (la.kind == 44 || la.kind == 45) {
			if (la.kind == 44) {
				lexer.NextToken();

//#line  2039 "VBNET.ATG" 
				op = BinaryOperatorType.ShiftLeft; 
			} else {
				lexer.NextToken();

//#line  2040 "VBNET.ATG" 
				op = BinaryOperatorType.ShiftRight; 
			}
			ConcatenationExpr(
//#line  2042 "VBNET.ATG" 
out expr);

//#line  2042 "VBNET.ATG" 
			outExpr = new BinaryOperatorExpression(outExpr, op, expr) { StartLocation = startLocation, EndLocation = t.EndLocation };  
		}
	}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:32,代码来源:Parser.cs


示例17: ComparisonExpr

	void ComparisonExpr(
//#line  2002 "VBNET.ATG" 
out Expression outExpr) {

//#line  2004 "VBNET.ATG" 
		Expression expr;
		BinaryOperatorType op = BinaryOperatorType.None;
		Location startLocation = la.Location;
		
		ShiftExpr(
//#line  2008 "VBNET.ATG" 
out outExpr);
		while (StartOf(40)) {
			switch (la.kind) {
			case 40: {
				lexer.NextToken();

//#line  2011 "VBNET.ATG" 
				op = BinaryOperatorType.LessThan; 
				break;
			}
			case 39: {
				lexer.NextToken();

//#line  2012 "VBNET.ATG" 
				op = BinaryOperatorType.GreaterThan; 
				break;
			}
			case 43: {
				lexer.NextToken();

//#line  2013 "VBNET.ATG" 
				op = BinaryOperatorType.LessThanOrEqual; 
				break;
			}
			case 42: {
				lexer.NextToken();

//#line  2014 "VBNET.ATG" 
				op = BinaryOperatorType.GreaterThanOrEqual; 
				break;
			}
			case 41: {
				lexer.NextToken();

//#line  2015 "VBNET.ATG" 
				op = BinaryOperatorType.InEquality; 
				break;
			}
			case 20: {
				lexer.NextToken();

//#line  2016 "VBNET.ATG" 
				op = BinaryOperatorType.Equality; 
				break;
			}
			case 150: {
				lexer.NextToken();

//#line  2017 "VBNET.ATG" 
				op = BinaryOperatorType.Like; 
				break;
			}
			case 144: {
				lexer.NextToken();

//#line  2018 "VBNET.ATG" 
				op = BinaryOperatorType.ReferenceEquality; 
				break;
			}
			case 145: {
				lexer.NextToken();

//#line  2019 "VBNET.ATG" 
				op = BinaryOperatorType.ReferenceInequality; 
				break;
			}
			}
			if (StartOf(41)) {
				ShiftExpr(
//#line  2022 "VBNET.ATG" 
out expr);

//#line  2022 "VBNET.ATG" 
				outExpr = new BinaryOperatorExpression(outExpr, op, expr) { StartLocation = startLocation, EndLocation = t.EndLocation };  
			} else if (la.kind == 164) {

//#line  2023 "VBNET.ATG" 
				Location startLocation2 = la.Location; 
				lexer.NextToken();
				ShiftExpr(
//#line  2025 "VBNET.ATG" 
out expr);

//#line  2025 "VBNET.ATG" 
				outExpr = new BinaryOperatorExpression(outExpr, op, new UnaryOperatorExpression(expr, UnaryOperatorType.Not) { StartLocation = startLocation2, EndLocation = t.EndLocation }) { StartLocation = startLocation, EndLocation = t.EndLocation };  
			} else SynErr(295);
		}
	}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:99,代码来源:Parser.cs


示例18: ConjunctionExpr

	void ConjunctionExpr(
//#line  1977 "VBNET.ATG" 
out Expression outExpr) {

//#line  1979 "VBNET.ATG" 
		Expression expr;
		BinaryOperatorType op = BinaryOperatorType.None;
		Location startLocation = la.Location;
		
		NotExpr(
//#line  1983 "VBNET.ATG" 
out outExpr);
		while (la.kind == 60 || la.kind == 61) {
			if (la.kind == 60) {
				lexer.NextToken();

//#line  1986 "VBNET.ATG" 
				op = BinaryOperatorType.BitwiseAnd; 
			} else {
				lexer.NextToken();

//#line  1987 "VBNET.ATG" 
				op = BinaryOperatorType.LogicalAnd; 
			}
			NotExpr(
//#line  1989 "VBNET.ATG" 
out expr);

//#line  1989 "VBNET.ATG" 
			outExpr = new BinaryOperatorExpression(outExpr, op, expr) { StartLocation = startLocation, EndLocation = t.EndLocation };  
		}
	}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:32,代码来源:Parser.cs


示例19: ConditionalExpression

	void ConditionalExpression(
//#line  1890 "VBNET.ATG" 
out Expression expr) {

//#line  1892 "VBNET.ATG" 
		ConditionalExpression conditionalExpression = new ConditionalExpression();
		BinaryOperatorExpression binaryOperatorExpression = new BinaryOperatorExpression();
		conditionalExpression.StartLocation = binaryOperatorExpression.StartLocation = la.Location;
		
		Expression condition = null;
		Expression trueExpr = null;
		Expression falseExpr = null;
		
		Expect(135);
		Expect(37);
		Expr(
//#line  1901 "VBNET.ATG" 
out condition);
		Expect(22);
		Expr(
//#line  1901 "VBNET.ATG" 
out trueExpr);
		if (la.kind == 22) {
			lexer.NextToken();
			Expr(
//#line  1901 "VBNET.ATG" 
out falseExpr);
		}
		Expect(38);

//#line  1903 "VBNET.ATG" 
		if(falseExpr != null)
		{
			conditionalExpression.Condition = condition;
			conditionalExpression.TrueExpression = trueExpr;
			conditionalExpression.FalseExpression = falseExpr;
			conditionalExpression.EndLocation = t.EndLocation;
			
			expr = conditionalExpression;
		}
		else
		{
			binaryOperatorExpression.Left = condition;
			binaryOperatorExpression.Right = trueExpr;
			binaryOperatorExpression.Op = BinaryOperatorType.NullCoalescing;
			binaryOperatorExpression.EndLocation = t.EndLocation;
			
			expr = binaryOperatorExpression;
		}
		
	}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:51,代码来源:Parser.cs


示例20: SimpleNonInvocationExpression


//.........这里部分代码省略.........

//#line  1780 "VBNET.ATG" 
				pexpr = new TypeOfExpression(type); 
				break;
			}
			case 220: {
				lexer.NextToken();
				SimpleExpr(
//#line  1781 "VBNET.ATG" 
out expr);
				Expect(144);
				TypeName(
//#line  1781 "VBNET.ATG" 
out type);

//#line  1781 "VBNET.ATG" 
				pexpr = new TypeOfIsExpression(expr, type); 
				break;
			}
			case 135: {
				ConditionalExpression(
//#line  1782 "VBNET.ATG" 
out pexpr);
				break;
			}
			case 10: case 16: case 17: case 18: case 19: {
				XmlLiteralExpression(
//#line  1783 "VBNET.ATG" 
out pexpr);
				break;
			}
			}
		} else if (StartOf(35)) {
			if (la.kind == 26) {
				lexer.NextToken();
				if (la.kind == 10) {
					lexer.NextToken();
					IdentifierOrKeyword(
//#line  1789 "VBNET.ATG" 
out name);
					Expect(11);

//#line  1790 "VBNET.ATG" 
					pexpr = new XmlMemberAccessExpression(null, XmlAxisType.Element, name, true) { StartLocation = startLocation, EndLocation = t.EndLocation }; 
				} else if (StartOf(33)) {
					IdentifierOrKeyword(
//#line  1791 "VBNET.ATG" 
out name);

//#line  1792 "VBNET.ATG" 
					pexpr = new MemberReferenceExpression(null, name) { StartLocation = startLocation, EndLocation = t.EndLocation }; 
				} else SynErr(283);
			} else if (la.kind == 29) {
				lexer.NextToken();
				IdentifierOrKeyword(
//#line  1794 "VBNET.ATG" 
out name);

//#line  1794 "VBNET.ATG" 
				pexpr = new BinaryOperatorExpression(null, BinaryOperatorType.DictionaryAccess, new PrimitiveExpression(name, name) { StartLocation = t.Location, EndLocation = t.EndLocation }); 
			} else {

//#line  1795 "VBNET.ATG" 
				XmlAxisType axisType = XmlAxisType.Element; bool isXmlIdentifier = false; 
				if (la.kind == 27) {
					lexer.NextToken();

//#line  1796 "VBNET.ATG" 
					axisType = XmlAxisType.Descendents; 
				} else if (la.kind == 28) {
					lexer.NextToken();

//#line  1796 "VBNET.ATG" 
					axisType = XmlAxisType.Attribute; 
				} else SynErr(284);
				if (la.kind == 10) {
					lexer.NextToken();

//#line  1797 "VBNET.ATG" 
					isXmlIdentifier = true; 
				}
				IdentifierOrKeyword(
//#line  1797 "VBNET.ATG" 
out name);
				if (la.kind == 11) {
					lexer.NextToken();
				}

//#line  1798 "VBNET.ATG" 
				pexpr = new XmlMemberAccessExpression(null, axisType, name, isXmlIdentifier); 
			}
		} else SynErr(285);

//#line  1803 "VBNET.ATG" 
		if (pexpr != null) {
		pexpr.StartLocation = startLocation;
		pexpr.EndLocation = t.EndLocation;
		}
		
	}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:101,代码来源:Parser.cs



注:本文中的ICSharpCode.NRefactory.Ast.BinaryOperatorExpression类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Ast.BlockStatement类代码示例发布时间:2022-05-26
下一篇:
C# Ast.AttributeSection类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap