本文整理汇总了C#中Mono.CSharp.Binary类的典型用法代码示例。如果您正苦于以下问题:C# Binary类的具体用法?C# Binary怎么用?C# Binary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Binary类属于Mono.CSharp命名空间,在下文中一共展示了Binary类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: case_601
void case_601()
#line 4285 "cs-parser.jay"
{
yyVal = new Binary (Binary.Operator.LessThan, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
}
开发者ID:segaman,项目名称:NRefactory,代码行数:6,代码来源:cs-parser.cs
示例17: case_619
void case_619()
#line 4386 "cs-parser.jay"
{
Error_SyntaxError (yyToken);
yyVal = new Binary (Binary.Operator.ExclusiveOr, (Expression) yyVals[-2+yyTop], null);
lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
}
开发者ID:segaman,项目名称:NRefactory,代码行数:8,代码来源:cs-parser.cs
示例18: case_604
void case_604()
#line 4300 "cs-parser.jay"
{
yyVal = new Binary (Binary.Operator.GreaterThanOrEqual, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
}
开发者ID:segaman,项目名称:NRefactory,代码行数:6,代码来源:cs-parser.cs
示例19: case_627
void case_627()
#line 4429 "cs-parser.jay"
{
yyVal = new Binary (Binary.Operator.LogicalOr, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
}
开发者ID:segaman,项目名称:NRefactory,代码行数:6,代码来源:cs-parser.cs
示例20: case_605
void case_605()
#line 4305 "cs-parser.jay"
{
Error_SyntaxError (yyToken);
yyVal = new Binary (Binary.Operator.LessThan, (Expression) yyVals[-2+yyTop], null);
lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
}
开发者ID:segaman,项目名称:NRefactory,代码行数:8,代码来源:cs-parser.cs
注:本文中的Mono.CSharp.Binary类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论