本文整理汇总了C#中ArraySpecifier类的典型用法代码示例。如果您正苦于以下问题:C# ArraySpecifier类的具体用法?C# ArraySpecifier怎么用?C# ArraySpecifier使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ArraySpecifier类属于命名空间,在下文中一共展示了ArraySpecifier类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: VisitArraySpecifier
public override object VisitArraySpecifier(ArraySpecifier arraySpecifier, object data)
{
if (arraySpecifier.Dimensions >= 10)
{
UnlockWith(arraySpecifier);
}
return base.VisitArraySpecifier(arraySpecifier, data);
}
开发者ID:cohenw,项目名称:strokes,代码行数:9,代码来源:TooManyDimensionArrayDeclarationAchievement.cs
示例2: Visit
public override object Visit(ArrayCreation arrayCreationExpression)
{
var result = new ArrayCreateExpression();
var location = LocationsBag.GetLocations(arrayCreationExpression);
result.AddChild(new CSharpTokenNode(Convert(arrayCreationExpression.Location), ArrayCreateExpression.NewKeywordRole), ArrayCreateExpression.NewKeywordRole);
if (arrayCreationExpression.TypeExpression != null)
result.AddChild(ConvertToType(arrayCreationExpression.TypeExpression), Roles.Type);
var next = arrayCreationExpression.Rank;
if (arrayCreationExpression.Arguments != null) {
// skip first array rank.
next = next.Next;
if (location != null)
result.AddChild(new CSharpTokenNode(Convert(location [0]), Roles.LBracket), Roles.LBracket);
var commaLocations = LocationsBag.GetLocations(arrayCreationExpression.Arguments);
for (int i = 0; i < arrayCreationExpression.Arguments.Count; i++) {
var arg = arrayCreationExpression.Arguments [i];
if (arg != null)
result.AddChild((Expression)arg.Accept(this), Roles.Argument);
if (commaLocations != null && i < commaLocations.Count)
result.AddChild(new CSharpTokenNode(Convert(commaLocations [i]), Roles.Comma), Roles.Comma);
}
if (location != null && location.Count > 1)
result.AddChild(new CSharpTokenNode(Convert(location [1]), Roles.RBracket), Roles.RBracket);
}
while (next != null) {
var spec = new ArraySpecifier(next.Dimension);
var loc = LocationsBag.GetLocations(next);
spec.AddChild(new CSharpTokenNode(Convert(next.Location), Roles.LBracket), Roles.LBracket);
result.AddChild(spec, ArrayCreateExpression.AdditionalArraySpecifierRole);
if (loc != null)
result.AddChild(new CSharpTokenNode(Convert(loc [0]), Roles.RBracket), Roles.RBracket);
next = next.Next;
}
if (arrayCreationExpression.Initializers != null) {
var initLocation = LocationsBag.GetLocations(arrayCreationExpression.Initializers);
var initializer = new ArrayInitializerExpression();
initializer.AddChild(new CSharpTokenNode(Convert(arrayCreationExpression.Initializers.Location), Roles.LBrace), Roles.LBrace);
var commaLocations = LocationsBag.GetLocations(arrayCreationExpression.Initializers.Elements);
for (int i = 0; i < arrayCreationExpression.Initializers.Count; i++) {
var init = arrayCreationExpression.Initializers [i];
if (init == null)
continue;
initializer.AddChild((Expression)init.Accept(this), Roles.Expression);
if (commaLocations != null && i < commaLocations.Count) {
initializer.AddChild(new CSharpTokenNode(Convert(commaLocations [i]), Roles.Comma), Roles.Comma);
}
}
if (initLocation != null) {
if (initLocation.Count == 2) // optional comma
initializer.AddChild(new CSharpTokenNode(Convert(initLocation [0]), Roles.Comma), Roles.Comma);
initializer.AddChild(new CSharpTokenNode(Convert(initLocation [initLocation.Count - 1]), Roles.RBrace), Roles.RBrace);
}
result.AddChild(initializer, ArrayCreateExpression.InitializerRole);
}
return result;
}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:65,代码来源:CSharpParser.cs
示例3: ConvertToType
AstType ConvertToType(Mono.CSharp.Expression typeName)
{
if (typeName == null) // may happen in typeof(Generic<,,,,>)
return new SimpleType();
var typeExpr = typeName as TypeExpression;
if (typeExpr != null) {
return new PrimitiveType(typeExpr.GetSignatureForError(), Convert(typeExpr.Location));
}
var qam = typeName as QualifiedAliasMember;
if (qam != null) {
var loc = LocationsBag.GetLocations(typeName);
var memberType = new MemberType();
memberType.Target = new SimpleType(qam.alias, Convert(qam.Location));
memberType.IsDoubleColon = true;
if (loc != null && loc.Count > 0)
memberType.AddChild(new CSharpTokenNode(Convert(loc [0]), Roles.DoubleColon), Roles.DoubleColon);
memberType.MemberNameToken = Identifier.Create(qam.Name, loc != null ? Convert(loc [1]) : TextLocation.Empty);
AddTypeArguments(qam, memberType);
return memberType;
}
var ma = typeName as MemberAccess;
if (ma != null) {
var memberType = new MemberType();
memberType.AddChild(ConvertToType(ma.LeftExpression), MemberType.TargetRole);
var loc = LocationsBag.GetLocations(ma);
if (loc != null)
memberType.AddChild(new CSharpTokenNode(Convert(loc [0]), Roles.Dot), Roles.Dot);
memberType.MemberNameToken = Identifier.Create(ma.Name, Convert(ma.Location));
AddTypeArguments(ma, memberType);
return memberType;
}
var sn = typeName as SimpleName;
if (sn != null) {
var result = new SimpleType(sn.Name, Convert(sn.Location));
AddTypeArguments(sn, result);
return result;
}
var cc = typeName as ComposedCast;
if (cc != null) {
var baseType = ConvertToType(cc.Left);
var result = new ComposedType { BaseType = baseType };
var ccSpec = cc.Spec;
while (ccSpec != null) {
if (ccSpec.IsNullable) {
result.AddChild(new CSharpTokenNode(Convert(ccSpec.Location), ComposedType.NullableRole), ComposedType.NullableRole);
} else if (ccSpec.IsPointer) {
result.AddChild(new CSharpTokenNode(Convert(ccSpec.Location), ComposedType.PointerRole), ComposedType.PointerRole);
} else {
var location = LocationsBag.GetLocations(ccSpec);
var spec = new ArraySpecifier { Dimensions = ccSpec.Dimension };
spec.AddChild(new CSharpTokenNode(Convert(ccSpec.Location), Roles.LBracket), Roles.LBracket);
if (location != null)
spec.AddChild(new CSharpTokenNode(Convert(location [0]), Roles.RBracket), Roles.RBracket);
result.ArraySpecifiers.Add(spec);
}
ccSpec = ccSpec.Next;
}
return result;
}
var sce = typeName as SpecialContraintExpr;
if (sce != null) {
switch (sce.Constraint) {
case SpecialConstraint.Class:
return new PrimitiveType("class", Convert(sce.Location));
case SpecialConstraint.Struct:
return new PrimitiveType("struct", Convert(sce.Location));
case SpecialConstraint.Constructor:
return new PrimitiveType("new", Convert(sce.Location));
}
}
return new SimpleType("unknown");
}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:83,代码来源:CSharpParser.cs
示例4: ConvertToType
AstType ConvertToType (Mono.CSharp.Expression typeName)
{
if (typeName == null) // may happen in typeof(Generic<,,,,>)
return new SimpleType ();
if (typeName is TypeExpression) {
var typeExpr = (Mono.CSharp.TypeExpression)typeName;
return new PrimitiveType (typeExpr.GetSignatureForError (), Convert (typeExpr.Location));
}
if (typeName is Mono.CSharp.QualifiedAliasMember) {
var qam = (Mono.CSharp.QualifiedAliasMember)typeName;
var memberType = new MemberType ();
memberType.Target = new SimpleType (qam.alias, Convert (qam.Location));
memberType.IsDoubleColon = true;
memberType.MemberName = qam.Name;
return memberType;
}
if (typeName is MemberAccess) {
MemberAccess ma = (MemberAccess)typeName;
var memberType = new MemberType ();
memberType.AddChild (ConvertToType (ma.LeftExpression), MemberType.TargetRole);
memberType.AddChild (new CSharpTokenNode (Convert (ma.DotLocation), 1), MemberType.Roles.Dot);
memberType.MemberNameToken = Identifier.Create (ma.Name, Convert (ma.Location));
AddTypeArguments (ma, memberType);
return memberType;
}
if (typeName is SimpleName) {
var sn = (SimpleName)typeName;
var result = new SimpleType (sn.Name, Convert (sn.Location));
AddTypeArguments (sn, result);
return result;
}
if (typeName is ComposedCast) {
var cc = (ComposedCast)typeName;
var baseType = ConvertToType (cc.Left);
var result = new ComposedType () { BaseType = baseType };
var ccSpec = cc.Spec;
while (ccSpec != null) {
if (ccSpec.IsNullable) {
result.AddChild (new CSharpTokenNode (Convert (ccSpec.Location), 1), ComposedType.NullableRole);
} else if (ccSpec.IsPointer) {
result.AddChild (new CSharpTokenNode (Convert (ccSpec.Location), 1), ComposedType.PointerRole);
} else {
var location = LocationsBag.GetLocations (ccSpec);
var spec = new ArraySpecifier () { Dimensions = ccSpec.Dimension };
spec.AddChild (new CSharpTokenNode (Convert (ccSpec.Location), 1), FieldDeclaration.Roles.LBracket);
if (location != null)
spec.AddChild (new CSharpTokenNode (Convert (location [0]), 1), FieldDeclaration.Roles.RBracket);
result.ArraySpecifiers.Add (spec);
}
ccSpec = ccSpec.Next;
}
return result;
}
if (typeName is SpecialContraintExpr) {
var sce = (SpecialContraintExpr)typeName;
switch (sce.Constraint) {
case SpecialConstraint.Class:
return new PrimitiveType ("class", Convert (sce.Location));
case SpecialConstraint.Struct:
return new PrimitiveType ("struct", Convert (sce.Location));
case SpecialConstraint.Constructor:
return new PrimitiveType ("new", Convert (sce.Location));
}
}
System.Console.WriteLine ("Error while converting :" + typeName + " - unknown type name");
System.Console.WriteLine (Environment.StackTrace);
return new SimpleType ("unknown");
}
开发者ID:N3X15,项目名称:ILSpy,代码行数:78,代码来源:CSharpParser.cs
示例5: VisitArraySpecifier
public void VisitArraySpecifier(ArraySpecifier arraySpecifier)
{
StartNode(arraySpecifier);
WriteToken(Roles.LBracket);
foreach (var comma in arraySpecifier.GetChildrenByRole(Roles.Comma)) {
writer.WriteToken(Roles.Comma, ",");
}
WriteToken(Roles.RBracket);
EndNode(arraySpecifier);
}
开发者ID:jeremiahyan,项目名称:ILSpy,代码行数:10,代码来源:CSharpOutputVisitor.cs
示例6: VisitArraySpecifier
public virtual void VisitArraySpecifier(ArraySpecifier arraySpecifier)
{
if (this.ThrowException)
{
throw (Exception)this.CreateException(arraySpecifier);
}
}
开发者ID:fabriciomurta,项目名称:BridgeUnified,代码行数:7,代码来源:Visitor.Exception.cs
示例7: VisitArraySpecifier
public void VisitArraySpecifier(ArraySpecifier arraySpecifier)
{
JsonObject arrSpec = new JsonObject();
arrSpec.Comment = "VisitArraySpecifier";
arrSpec.AddJsonValue("array-specifier", arraySpecifier.GetChildrenByRole(Roles.Comma).Count);
if (arraySpecifier.GetChildrenByRole(Roles.Comma).Count == 0)
{
arrSpec = null;
}
Push(arrSpec);
}
开发者ID:CompilerKit,项目名称:CodeWalk,代码行数:11,代码来源:AstCsToJson.cs
示例8: ConvertToType
AstType ConvertToType (Mono.CSharp.Expression typeName)
{
if (typeName is TypeExpression) {
var typeExpr = (Mono.CSharp.TypeExpression)typeName;
return new PrimitiveType (typeExpr.GetSignatureForError (), Convert (typeExpr.Location));
}
if (typeName is Mono.CSharp.QualifiedAliasMember) {
var qam = (Mono.CSharp.QualifiedAliasMember)typeName;
return new SimpleType (qam.Name, Convert (qam.Location));
}
if (typeName is MemberAccess) {
MemberAccess ma = (MemberAccess)typeName;
var memberType = new MemberType ();
memberType.AddChild (ConvertToType (ma.LeftExpression), MemberType.TargetRole);
memberType.MemberName = ma.Name;
AddTypeArguments (ma, memberType);
return memberType;
}
if (typeName is SimpleName) {
var sn = (SimpleName)typeName;
var result = new SimpleType (sn.Name, Convert (sn.Location));
AddTypeArguments (sn, result);
return result;
}
if (typeName is ComposedCast) {
var cc = (ComposedCast)typeName;
var baseType = ConvertToType (cc.Left);
var result = new ComposedType () { BaseType = baseType };
if (cc.Spec.IsNullable) {
result.HasNullableSpecifier = true;
} else if (cc.Spec.IsPointer) {
result.PointerRank++;
} else {
var location = LocationsBag.GetLocations (cc.Spec);
var spec = new ArraySpecifier () { Dimensions = cc.Spec.Dimension - 1 };
spec.AddChild (new CSharpTokenNode (Convert (cc.Spec.Location), 1), FieldDeclaration.Roles.LBracket);
if (location != null)
spec.AddChild (new CSharpTokenNode (Convert (location[0]), 1), FieldDeclaration.Roles.RBracket);
result.ArraySpecifiers.Add(spec);
}
return result;
}
System.Console.WriteLine ("Error while converting :" + typeName + " - unknown type name");
return new SimpleType ("unknown");
}
开发者ID:madkat,项目名称:NRefactory,代码行数:54,代码来源:CSharpParser.cs
示例9: VisitArraySpecifier
public abstract StringBuilder VisitArraySpecifier(ArraySpecifier arraySpecifier, int data);
开发者ID:hach-que,项目名称:SLSharp,代码行数:1,代码来源:VisitorBase.Abstract.cs
示例10: VisitArraySpecifier
public override StringBuilder VisitArraySpecifier(ArraySpecifier arraySpecifier, int data)
{
throw new NotImplementedException();
}
开发者ID:mono-soc-2011,项目名称:SLSharp,代码行数:4,代码来源:GlslVisitor.Unimplemented.cs
示例11: VisitArraySpecifier
public virtual void VisitArraySpecifier(ArraySpecifier arraySpecifier)
{
StartNode(arraySpecifier);
var braceHelper = BraceHelper.LeftBracket(this, CodeBracesRangeFlags.SquareBrackets);
int count = 0;
foreach (var comma in arraySpecifier.GetChildrenByRole(Roles.Comma)) {
if (count-- <= 0) {
cancellationToken.ThrowIfCancellationRequested();
count = CANCEL_CHECK_LOOP_COUNT;
}
writer.WriteTokenPunctuation(Roles.Comma, ",");
}
braceHelper.RightBracket();
EndNode(arraySpecifier);
}
开发者ID:0xd4d,项目名称:NRefactory,代码行数:15,代码来源:CSharpOutputVisitor.cs
示例12: VisitArraySpecifier
public virtual void VisitArraySpecifier(ArraySpecifier arraySpecifier)
{
StartNode(arraySpecifier);
WriteToken(Roles.LBracket);
int count = 0;
foreach (var comma in arraySpecifier.GetChildrenByRole(Roles.Comma)) {
if (count-- <= 0) {
cancellationToken.ThrowIfCancellationRequested();
count = CANCEL_CHECK_LOOP_COUNT;
}
writer.WriteTokenOperator(Roles.Comma, ",");
}
WriteToken(Roles.RBracket);
EndNode(arraySpecifier);
}
开发者ID:JackWangCUMT,项目名称:NRefactory,代码行数:15,代码来源:CSharpOutputVisitor.cs
示例13: VisitArraySpecifier
public virtual void VisitArraySpecifier (ArraySpecifier arraySpecifier)
{
VisitChildren (arraySpecifier);
}
开发者ID:modulexcite,项目名称:ICSharpCode.Decompiler-retired,代码行数:4,代码来源:DepthFirstAstVisitor.cs
示例14: Visit
public override object Visit (ArrayCreation arrayCreationExpression)
{
var result = new ArrayCreateExpression ();
var location = LocationsBag.GetLocations (arrayCreationExpression);
if (arrayCreationExpression.NewType != null)
result.AddChild (ConvertToType (arrayCreationExpression.NewType), ArrayCreateExpression.Roles.Type);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[0]), 1), ArrayCreateExpression.Roles.LBracket);
if (arrayCreationExpression.Arguments != null) {
var commaLocations = LocationsBag.GetLocations (arrayCreationExpression.Arguments);
for (int i = 0 ;i < arrayCreationExpression.Arguments.Count; i++) {
result.AddChild ((Expression)arrayCreationExpression.Arguments[i].Accept (this), ArrayCreateExpression.Roles.Argument);
if (commaLocations != null && i > 0)
result.AddChild (new CSharpTokenNode (Convert (commaLocations [commaLocations.Count - i]), 1), ArrayCreateExpression.Roles.Comma);
}
}
var next = arrayCreationExpression.Rank.Next;
while (next != null) {
ArraySpecifier spec = new ArraySpecifier (next.Dimension);
var loc = LocationsBag.GetLocations (next);
spec.AddChild (new CSharpTokenNode (Convert (next.Location), 1), ArraySpecifier.Roles.LBracket);
if (loc != null)
result.AddChild (new CSharpTokenNode (Convert (loc[0]), 1), ArraySpecifier.Roles.RBracket);
result.AddChild (spec, ArrayCreateExpression.AdditionalArraySpecifierRole);
next = next.Next;
}
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), ArrayCreateExpression.Roles.RBracket);
if (arrayCreationExpression.Initializers != null && arrayCreationExpression.Initializers.Count != 0) {
var initLocation = LocationsBag.GetLocations (arrayCreationExpression.Initializers);
ArrayInitializerExpression initializer = new ArrayInitializerExpression();
initializer.AddChild (new CSharpTokenNode (Convert (arrayCreationExpression.Initializers.Location), 1), ArrayCreateExpression.Roles.LBrace);
var commaLocations = LocationsBag.GetLocations (arrayCreationExpression.Initializers.Elements);
for (int i = 0; i < arrayCreationExpression.Initializers.Count; i++) {
initializer.AddChild ((Expression)arrayCreationExpression.Initializers[i].Accept (this), ArrayInitializerExpression.Roles.Expression);
if (commaLocations != null && i > 0) {
initializer.AddChild (new CSharpTokenNode (Convert (commaLocations [commaLocations.Count - i]), 1), IndexerExpression.Roles.Comma);
}
}
if (initLocation != null)
initializer.AddChild (new CSharpTokenNode (Convert (initLocation[initLocation.Count - 1]), 1), ArrayCreateExpression.Roles.RBrace);
result.AddChild (initializer, ArrayCreateExpression.InitializerRole);
}
return result;
}
开发者ID:aleksandersumowski,项目名称:monodevelop,代码行数:51,代码来源:CSharpParser.cs
示例15: VisitArraySpecifier
public void VisitArraySpecifier(ArraySpecifier arraySpecifier)
{
StartNode(arraySpecifier);
WriteToken(Roles.LBracket);
foreach (var comma in arraySpecifier.GetChildrenByRole(Roles.Comma)) {
WriteSpecialsUpToNode(comma);
formatter.WriteToken(",");
lastWritten = LastWritten.Other;
}
WriteToken(Roles.RBracket);
EndNode(arraySpecifier);
}
开发者ID:x-strong,项目名称:ILSpy,代码行数:12,代码来源:CSharpOutputVisitor.cs
示例16: VisitArraySpecifier
public void VisitArraySpecifier(ArraySpecifier node)
{
VisitChildren(node);
}
开发者ID:evanw,项目名称:minisharp,代码行数:4,代码来源:Lower.cs
注:本文中的ArraySpecifier类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论