當前位置: 首頁>>代碼示例>>C#>>正文


C# CSharp.Binary類代碼示例

本文整理匯總了C#中Mono.CSharp.Binary的典型用法代碼示例。如果您正苦於以下問題:C# Binary類的具體用法?C# Binary怎麽用?C# Binary使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Binary類屬於Mono.CSharp命名空間,在下文中一共展示了Binary類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: case_580

void case_580()
#line 4166 "cs-parser.jay"
{
		yyVal = new Binary (Binary.Operator.Multiply, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
		lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
	  }
開發者ID:lorry-lee,項目名稱:vimlorry,代碼行數:6,代碼來源:cs-parser.cs

示例2: CompoundAssign

		public CompoundAssign (Binary.Operator op, Expression target, Expression source, Expression left)
			: this (op, target, source)
		{
			this.left = left;
		}
開發者ID:dyxu,項目名稱:vimrc,代碼行數:5,代碼來源:assign.cs

示例3: Visit

			public override object Visit (Binary binaryExpression)
			{
				var result = new BinaryOperatorExpression ();
				int opLength = 1;
				switch (binaryExpression.Oper) {
					case Binary.Operator.Multiply:
						result.BinaryOperatorType = BinaryOperatorType.Multiply;
						break;
					case Binary.Operator.Division:
						result.BinaryOperatorType = BinaryOperatorType.Divide;
						break;
					case Binary.Operator.Modulus:
						result.BinaryOperatorType = BinaryOperatorType.Modulus;
						break;
					case Binary.Operator.Addition:
						result.BinaryOperatorType = BinaryOperatorType.Add;
						break;
					case Binary.Operator.Subtraction:
						result.BinaryOperatorType = BinaryOperatorType.Subtract;
						break;
					case Binary.Operator.LeftShift:
						result.BinaryOperatorType = BinaryOperatorType.ShiftLeft;
						opLength = 2;
						break;
					case Binary.Operator.RightShift:
						result.BinaryOperatorType = BinaryOperatorType.ShiftRight;
						opLength = 2;
						break;
					case Binary.Operator.LessThan:
						result.BinaryOperatorType = BinaryOperatorType.LessThan;
						break;
					case Binary.Operator.GreaterThan:
						result.BinaryOperatorType = BinaryOperatorType.GreaterThan;
						break;
					case Binary.Operator.LessThanOrEqual:
						result.BinaryOperatorType = BinaryOperatorType.LessThanOrEqual;
						opLength = 2;
						break;
					case Binary.Operator.GreaterThanOrEqual:
						result.BinaryOperatorType = BinaryOperatorType.GreaterThanOrEqual;
						opLength = 2;
						break;
					case Binary.Operator.Equality:
						result.BinaryOperatorType = BinaryOperatorType.Equality;
						opLength = 2;
						break;
					case Binary.Operator.Inequality:
						result.BinaryOperatorType = BinaryOperatorType.InEquality;
						opLength = 2;
						break;
					case Binary.Operator.BitwiseAnd:
						result.BinaryOperatorType = BinaryOperatorType.BitwiseAnd;
						break;
					case Binary.Operator.ExclusiveOr:
						result.BinaryOperatorType = BinaryOperatorType.ExclusiveOr;
						break;
					case Binary.Operator.BitwiseOr:
						result.BinaryOperatorType = BinaryOperatorType.BitwiseOr;
						break;
					case Binary.Operator.LogicalAnd:
						result.BinaryOperatorType = BinaryOperatorType.LogicalAnd;
						opLength = 2;
						break;
					case Binary.Operator.LogicalOr:
						result.BinaryOperatorType = BinaryOperatorType.LogicalOr;
						opLength = 2;
						break;
				}
				result.AddChild ((INode)binaryExpression.Left.Accept (this), BinaryOperatorExpression.LeftExpressionRole);
				result.AddChild (new CSharpTokenNode (Convert (binaryExpression.Location), opLength), BinaryOperatorExpression.OperatorRole);
				result.AddChild ((INode)binaryExpression.Right.Accept (this), BinaryOperatorExpression.RightExpressionRole);
				return result;
			}
開發者ID:pgoron,項目名稱:monodevelop,代碼行數:73,代碼來源:CSharpParser.cs

示例4: Convert

				static CodeBinaryOperatorType Convert (Binary.Operator o)
				{
					switch (o) {
					case Binary.Operator.Multiply:
						return CodeBinaryOperatorType.Multiply;
					case Binary.Operator.Division:
						return CodeBinaryOperatorType.Divide;
					case Binary.Operator.Modulus:
						return CodeBinaryOperatorType.Modulus;
					case Binary.Operator.Addition:
						return CodeBinaryOperatorType.Add;
					case Binary.Operator.Subtraction:
						return CodeBinaryOperatorType.Subtract;
					case Binary.Operator.LeftShift:
					case Binary.Operator.RightShift:
						return CodeBinaryOperatorType.Multiply; // unsupported
					case Binary.Operator.LessThan:
						return CodeBinaryOperatorType.LessThan;
					case Binary.Operator.GreaterThan:
						return CodeBinaryOperatorType.GreaterThan;
					case Binary.Operator.LessThanOrEqual:
						return CodeBinaryOperatorType.LessThanOrEqual;
					case Binary.Operator.GreaterThanOrEqual:
						return CodeBinaryOperatorType.GreaterThanOrEqual;
					case Binary.Operator.Equality:
						return CodeBinaryOperatorType.IdentityEquality;
					case Binary.Operator.Inequality:
						return CodeBinaryOperatorType.IdentityInequality;
					case Binary.Operator.BitwiseAnd:
						return CodeBinaryOperatorType.BitwiseAnd;
					case Binary.Operator.ExclusiveOr:
						return CodeBinaryOperatorType.BitwiseOr; // unsupported
					case Binary.Operator.BitwiseOr:
						return CodeBinaryOperatorType.BitwiseOr;
					case Binary.Operator.LogicalAnd:
						return CodeBinaryOperatorType.BooleanAnd;
					case Binary.Operator.LogicalOr:
						return CodeBinaryOperatorType.BooleanOr;
							
					}
					return CodeBinaryOperatorType.Add;
				}
開發者ID:RainsSoft,項目名稱:playscript-monodevelop,代碼行數:42,代碼來源:McsParser.cs

示例5: Visit

			public override object Visit(Binary binaryExpression)
			{
				var result = new BinaryOperatorExpression();
				switch (binaryExpression.Oper) {
					case Binary.Operator.Multiply:
						result.Operator = BinaryOperatorType.Multiply;
						break;
					case Binary.Operator.Division:
						result.Operator = BinaryOperatorType.Divide;
						break;
					case Binary.Operator.Modulus:
						result.Operator = BinaryOperatorType.Modulus;
						break;
					case Binary.Operator.Addition:
						result.Operator = BinaryOperatorType.Add;
						break;
					case Binary.Operator.Subtraction:
						result.Operator = BinaryOperatorType.Subtract;
						break;
					case Binary.Operator.LeftShift:
						result.Operator = BinaryOperatorType.ShiftLeft;
						break;
					case Binary.Operator.RightShift:
						result.Operator = BinaryOperatorType.ShiftRight;
						break;
					case Binary.Operator.LessThan:
						result.Operator = BinaryOperatorType.LessThan;
						break;
					case Binary.Operator.GreaterThan:
						result.Operator = BinaryOperatorType.GreaterThan;
						break;
					case Binary.Operator.LessThanOrEqual:
						result.Operator = BinaryOperatorType.LessThanOrEqual;
						break;
					case Binary.Operator.GreaterThanOrEqual:
						result.Operator = BinaryOperatorType.GreaterThanOrEqual;
						break;
					case Binary.Operator.Equality:
						result.Operator = BinaryOperatorType.Equality;
						break;
					case Binary.Operator.Inequality:
						result.Operator = BinaryOperatorType.InEquality;
						break;
					case Binary.Operator.BitwiseAnd:
						result.Operator = BinaryOperatorType.BitwiseAnd;
						break;
					case Binary.Operator.ExclusiveOr:
						result.Operator = BinaryOperatorType.ExclusiveOr;
						break;
					case Binary.Operator.BitwiseOr:
						result.Operator = BinaryOperatorType.BitwiseOr;
						break;
					case Binary.Operator.LogicalAnd:
						result.Operator = BinaryOperatorType.ConditionalAnd;
						break;
					case Binary.Operator.LogicalOr:
						result.Operator = BinaryOperatorType.ConditionalOr;
						break;
				}
				
				if (binaryExpression.Left != null)
					result.AddChild((Expression)binaryExpression.Left.Accept(this), BinaryOperatorExpression.LeftRole);
				var location = LocationsBag.GetLocations(binaryExpression);
				if (location != null) {
					var r = BinaryOperatorExpression.GetOperatorRole(result.Operator);
					result.AddChild(new CSharpTokenNode(Convert(location [0]), r), r);
				}
				if (binaryExpression.Right != null)
					result.AddChild((Expression)binaryExpression.Right.Accept(this), BinaryOperatorExpression.RightRole);
				return result;
			}
開發者ID:0xb1dd1e,項目名稱:NRefactory,代碼行數:71,代碼來源:CSharpParser.cs

示例6: case_621

void case_621()
#line 4397 "cs-parser.jay"
{
		yyVal = new Binary (Binary.Operator.BitwiseOr, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
		lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
	  }
開發者ID:segaman,項目名稱:NRefactory,代碼行數:6,代碼來源:cs-parser.cs

示例7: case_628

void case_628()
#line 4434 "cs-parser.jay"
{
		Error_SyntaxError (yyToken);

		yyVal = new Binary (Binary.Operator.LogicalOr, (Expression) yyVals[-2+yyTop], null);
		lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
	  }
開發者ID:segaman,項目名稱:NRefactory,代碼行數:8,代碼來源:cs-parser.cs

示例8: case_597

void case_597()
#line 4262 "cs-parser.jay"
{
		yyVal = new Binary (Binary.Operator.RightShift, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
		lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
	  }
開發者ID:segaman,項目名稱:NRefactory,代碼行數:6,代碼來源:cs-parser.cs

示例9: case_599

void case_599()
#line 4274 "cs-parser.jay"
{
		Error_SyntaxError (yyToken);

		yyVal = new Binary (Binary.Operator.RightShift, (Expression) yyVals[-2+yyTop], null);
		lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
	  }
開發者ID:segaman,項目名稱:NRefactory,代碼行數:8,代碼來源:cs-parser.cs

示例10: case_585

void case_585()
#line 4198 "cs-parser.jay"
{
		Error_SyntaxError (yyToken);

		yyVal = new Binary (Binary.Operator.Modulus, (Expression) yyVals[-2+yyTop], null);
		lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
	  }
開發者ID:segaman,項目名稱:NRefactory,代碼行數:8,代碼來源:cs-parser.cs

示例11: case_588

void case_588()
#line 4214 "cs-parser.jay"
{
		yyVal = new Binary (Binary.Operator.Subtraction, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
		lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
	  }
開發者ID:segaman,項目名稱:NRefactory,代碼行數:6,代碼來源:cs-parser.cs

示例12: case_582

void case_582()
#line 4179 "cs-parser.jay"
{
		yyVal = new Binary (Binary.Operator.Modulus, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
		lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
	  }
開發者ID:segaman,項目名稱:NRefactory,代碼行數:6,代碼來源:cs-parser.cs

示例13: CreateDynamicBinderArguments

		public ArrayInitializer CreateDynamicBinderArguments (ResolveContext rc)
		{
			Location loc = Location.Null;
			var all = new ArrayInitializer (args.Count, loc);

			MemberAccess binder = DynamicExpressionStatement.GetBinderNamespace (rc, loc);

			foreach (Argument a in args) {
				Arguments dargs = new Arguments (2);

				// CSharpArgumentInfoFlags.None = 0
				const string info_flags_enum = "CSharpArgumentInfoFlags";
				Expression info_flags = new IntLiteral (rc.BuiltinTypes, 0, loc);

				if (a.Expr is Constant) {
					info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags,
						new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "Constant", loc));
				} else if (a.ArgType == Argument.AType.Ref) {
					info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags,
						new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "IsRef", loc));
					info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags,
						new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "UseCompileTimeType", loc));
				} else if (a.ArgType == Argument.AType.Out) {
					info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags,
						new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "IsOut", loc));
					info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags,
						new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "UseCompileTimeType", loc));
				} else if (a.ArgType == Argument.AType.DynamicTypeName) {
					info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags,
						new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "IsStaticType", loc));
				}

				TypeSpec arg_type;

				if (rc.FileType == SourceFileType.PlayScript &&
				    a.Expr is ArrayInitializer || a.Expr is AsObjectInitializer) {
					if (a.Expr is ArrayInitializer) {
						arg_type = rc.Module.PredefinedTypes.AsArray.Resolve();
					} else {
						arg_type = rc.Module.PredefinedTypes.AsObject.Resolve();
					}
				} else {
					arg_type = a.Expr.Type;
				}

				if (arg_type.BuiltinType != BuiltinTypeSpec.Type.Dynamic && arg_type != InternalType.NullLiteral) {
					MethodGroupExpr mg = a.Expr as MethodGroupExpr;

					bool wasConverted = false;

					// In PlayScript, we try to implicity convert to dynamic, which handles conversions of method groups to delegates, and
					// anon methods to delegates.
					if (rc.FileType == SourceFileType.PlayScript && (mg != null || arg_type == InternalType.AnonymousMethod)) {
						var expr = Convert.ImplicitConversion (rc, a.Expr, rc.BuiltinTypes.Dynamic, loc);
						if (expr != null) {
							a.Expr = expr;
							arg_type = rc.BuiltinTypes.Dynamic;
							wasConverted = true;
						}
					}

					// Failed.. check the C# error
					if (!wasConverted) {
						if (mg != null) {
							rc.Report.Error (1976, a.Expr.Location,
								"The method group `{0}' cannot be used as an argument of dynamic operation. Consider using parentheses to invoke the method",
								mg.Name);
						} else if (arg_type == InternalType.AnonymousMethod) {
							rc.Report.Error (1977, a.Expr.Location,
								"An anonymous method or lambda expression cannot be used as an argument of dynamic operation. Consider using a cast");
						} else if (arg_type.Kind == MemberKind.Void || arg_type == InternalType.Arglist || arg_type.IsPointer) {
							rc.Report.Error (1978, a.Expr.Location,
								"An expression of type `{0}' cannot be used as an argument of dynamic operation",
								arg_type.GetSignatureForError ());
						}
					}

					info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags,
						new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "UseCompileTimeType", loc));
				}

				string named_value;
				NamedArgument na = a as NamedArgument;
				if (na != null) {
					info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags,
						new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "NamedArgument", loc));

					named_value = na.Name;
				} else {
					named_value = null;
				}

				dargs.Add (new Argument (info_flags));
				dargs.Add (new Argument (new StringLiteral (rc.BuiltinTypes, named_value, loc)));
				all.Add (new Invocation (new MemberAccess (new MemberAccess (binder, "CSharpArgumentInfo", loc), "Create", loc), dargs));
			}

			return all;
		}
開發者ID:johnv315,項目名稱:playscript-mono,代碼行數:99,代碼來源:argument.cs

示例14: case_592

void case_592()
#line 4231 "cs-parser.jay"
{
		Error_SyntaxError (yyToken);

		yyVal = new Binary (Binary.Operator.Subtraction, (Expression) yyVals[-2+yyTop], null);
		lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
	  }
開發者ID:lorry-lee,項目名稱:vimlorry,代碼行數:8,代碼來源:cs-parser.cs

示例15: case_618

void case_618()
#line 4381 "cs-parser.jay"
{
		yyVal = new Binary (Binary.Operator.ExclusiveOr, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
		lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
	  }
開發者ID:segaman,項目名稱:NRefactory,代碼行數:6,代碼來源:cs-parser.cs


注:本文中的Mono.CSharp.Binary類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。