本文整理汇总了C#中ICSharpCode.NRefactory.Parser.ModifierList.GetDeclarationLocation方法的典型用法代码示例。如果您正苦于以下问题:C# ModifierList.GetDeclarationLocation方法的具体用法?C# ModifierList.GetDeclarationLocation怎么用?C# ModifierList.GetDeclarationLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode.NRefactory.Parser.ModifierList
的用法示例。
在下文中一共展示了ModifierList.GetDeclarationLocation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TypeDecl
void TypeDecl(
#line 371 "cs.ATG"
ModifierList m, List<AttributeSection> attributes) {
#line 373 "cs.ATG"
TypeReference type;
List<TypeReference> names;
List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
string name;
List<TemplateDefinition> templates;
if (la.kind == 59) {
#line 379 "cs.ATG"
m.Check(Modifiers.Classes);
lexer.NextToken();
#line 380 "cs.ATG"
TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
templates = newType.Templates;
AddChild(newType);
BlockStart(newType);
newType.StartLocation = m.GetDeclarationLocation(t.Location);
newType.Type = Types.Class;
Identifier();
#line 388 "cs.ATG"
newType.Name = t.val;
if (la.kind == 23) {
TypeParameterList(
#line 391 "cs.ATG"
templates);
}
if (la.kind == 9) {
ClassBase(
#line 393 "cs.ATG"
out names);
#line 393 "cs.ATG"
newType.BaseTypes = names;
}
while (la.kind == 127) {
TypeParameterConstraintsClause(
#line 396 "cs.ATG"
templates);
}
#line 398 "cs.ATG"
newType.BodyStartLocation = t.EndLocation;
Expect(16);
ClassBody();
Expect(17);
if (la.kind == 11) {
lexer.NextToken();
}
#line 402 "cs.ATG"
newType.EndLocation = t.EndLocation;
BlockEnd();
} else if (StartOf(9)) {
#line 405 "cs.ATG"
m.Check(Modifiers.StructsInterfacesEnumsDelegates);
if (la.kind == 109) {
lexer.NextToken();
#line 406 "cs.ATG"
TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
templates = newType.Templates;
newType.StartLocation = m.GetDeclarationLocation(t.Location);
AddChild(newType);
BlockStart(newType);
newType.Type = Types.Struct;
Identifier();
#line 413 "cs.ATG"
newType.Name = t.val;
if (la.kind == 23) {
TypeParameterList(
#line 416 "cs.ATG"
templates);
}
if (la.kind == 9) {
StructInterfaces(
#line 418 "cs.ATG"
out names);
#line 418 "cs.ATG"
newType.BaseTypes = names;
}
while (la.kind == 127) {
TypeParameterConstraintsClause(
#line 421 "cs.ATG"
templates);
}
//.........这里部分代码省略.........
示例2: StructMemberDecl
void StructMemberDecl(
#line 753 "cs.ATG"
ModifierList m, List<AttributeSection> attributes) {
#line 755 "cs.ATG"
string qualident = null;
TypeReference type;
Expression expr;
List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
BlockStatement stmt = null;
List<TemplateDefinition> templates = new List<TemplateDefinition>();
TypeReference explicitInterface = null;
bool isExtensionMethod = false;
if (la.kind == 60) {
#line 765 "cs.ATG"
m.Check(Modifiers.Constants);
lexer.NextToken();
#line 766 "cs.ATG"
Location startPos = t.Location;
Type(
#line 767 "cs.ATG"
out type);
Identifier();
#line 767 "cs.ATG"
FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier | Modifiers.Const);
fd.StartLocation = m.GetDeclarationLocation(startPos);
VariableDeclaration f = new VariableDeclaration(t.val);
f.StartLocation = t.Location;
f.TypeReference = type;
SafeAdd(fd, fd.Fields, f);
Expect(3);
Expr(
#line 774 "cs.ATG"
out expr);
#line 774 "cs.ATG"
f.Initializer = expr;
while (la.kind == 14) {
lexer.NextToken();
Identifier();
#line 775 "cs.ATG"
f = new VariableDeclaration(t.val);
f.StartLocation = t.Location;
f.TypeReference = type;
SafeAdd(fd, fd.Fields, f);
Expect(3);
Expr(
#line 780 "cs.ATG"
out expr);
#line 780 "cs.ATG"
f.EndLocation = t.EndLocation; f.Initializer = expr;
}
Expect(11);
#line 781 "cs.ATG"
fd.EndLocation = t.EndLocation; AddChild(fd);
} else if (
#line 785 "cs.ATG"
NotVoidPointer()) {
#line 785 "cs.ATG"
m.Check(Modifiers.PropertysEventsMethods);
Expect(123);
#line 786 "cs.ATG"
Location startPos = t.Location;
if (
#line 787 "cs.ATG"
IsExplicitInterfaceImplementation()) {
TypeName(
#line 788 "cs.ATG"
out explicitInterface, false);
#line 789 "cs.ATG"
if (la.kind != Tokens.Dot || Peek(1).kind != Tokens.This) {
qualident = TypeReference.StripLastIdentifierFromType(ref explicitInterface);
}
} else if (StartOf(18)) {
Identifier();
#line 792 "cs.ATG"
qualident = t.val;
} else SynErr(162);
if (la.kind == 23) {
TypeParameterList(
#line 795 "cs.ATG"
templates);
}
Expect(20);
if (la.kind == 111) {
lexer.NextToken();
//.........这里部分代码省略.........
示例3: TypeDecl
void TypeDecl(
#line 362 "Frames/cs.ATG"
ModifierList m, List<AttributeSection> attributes) {
#line 364 "Frames/cs.ATG"
TypeReference type;
List<TypeReference> names;
List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
string name;
List<TemplateDefinition> templates;
if (la.kind == 59) {
#line 370 "Frames/cs.ATG"
m.Check(Modifiers.Classes);
lexer.NextToken();
#line 371 "Frames/cs.ATG"
TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
templates = newType.Templates;
compilationUnit.AddChild(newType);
compilationUnit.BlockStart(newType);
newType.StartLocation = m.GetDeclarationLocation(t.Location);
newType.Type = Types.Class;
Identifier();
#line 379 "Frames/cs.ATG"
newType.Name = t.val;
if (la.kind == 23) {
TypeParameterList(
#line 382 "Frames/cs.ATG"
templates);
}
if (la.kind == 9) {
ClassBase(
#line 384 "Frames/cs.ATG"
out names);
#line 384 "Frames/cs.ATG"
newType.BaseTypes = names;
}
while (la.kind == 127) {
TypeParameterConstraintsClause(
#line 387 "Frames/cs.ATG"
templates);
}
#line 389 "Frames/cs.ATG"
newType.BodyStartLocation = t.EndLocation;
Expect(16);
ClassBody();
Expect(17);
if (la.kind == 11) {
lexer.NextToken();
}
#line 393 "Frames/cs.ATG"
newType.EndLocation = t.EndLocation;
compilationUnit.BlockEnd();
} else if (StartOf(9)) {
#line 396 "Frames/cs.ATG"
m.Check(Modifiers.StructsInterfacesEnumsDelegates);
if (la.kind == 109) {
lexer.NextToken();
#line 397 "Frames/cs.ATG"
TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
templates = newType.Templates;
newType.StartLocation = m.GetDeclarationLocation(t.Location);
compilationUnit.AddChild(newType);
compilationUnit.BlockStart(newType);
newType.Type = Types.Struct;
Identifier();
#line 404 "Frames/cs.ATG"
newType.Name = t.val;
if (la.kind == 23) {
TypeParameterList(
#line 407 "Frames/cs.ATG"
templates);
}
if (la.kind == 9) {
StructInterfaces(
#line 409 "Frames/cs.ATG"
out names);
#line 409 "Frames/cs.ATG"
newType.BaseTypes = names;
}
while (la.kind == 127) {
TypeParameterConstraintsClause(
#line 412 "Frames/cs.ATG"
templates);
}
//.........这里部分代码省略.........
示例4: ClassMemberDecl
void ClassMemberDecl(
#line 1084 "cs.ATG"
ModifierList m, List<AttributeSection> attributes) {
#line 1085 "cs.ATG"
BlockStatement stmt = null;
if (StartOf(20)) {
StructMemberDecl(
#line 1087 "cs.ATG"
m, attributes);
} else if (la.kind == 27) {
#line 1088 "cs.ATG"
m.Check(Modifiers.Destructors); Location startPos = la.Location;
lexer.NextToken();
Identifier();
#line 1089 "cs.ATG"
DestructorDeclaration d = new DestructorDeclaration(t.val, m.Modifier, attributes);
d.Modifier = m.Modifier;
d.StartLocation = m.GetDeclarationLocation(startPos);
Expect(20);
Expect(21);
#line 1093 "cs.ATG"
d.EndLocation = t.EndLocation;
if (la.kind == 16) {
Block(
#line 1093 "cs.ATG"
out stmt);
} else if (la.kind == 11) {
lexer.NextToken();
} else SynErr(160);
#line 1094 "cs.ATG"
d.Body = stmt;
AddChild(d);
} else SynErr(161);
}
示例5: StructMemberDecl
void StructMemberDecl(
#line 739 "cs.ATG"
ModifierList m, List<AttributeSection> attributes) {
#line 741 "cs.ATG"
string qualident = null;
TypeReference type;
Expression expr;
List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
Statement stmt = null;
List<TemplateDefinition> templates = new List<TemplateDefinition>();
TypeReference explicitInterface = null;
bool isExtensionMethod = false;
if (la.kind == 60) {
#line 751 "cs.ATG"
m.Check(Modifiers.Constants);
lexer.NextToken();
#line 752 "cs.ATG"
Location startPos = t.Location;
Type(
#line 753 "cs.ATG"
out type);
Identifier();
#line 753 "cs.ATG"
FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier | Modifiers.Const);
fd.StartLocation = m.GetDeclarationLocation(startPos);
VariableDeclaration f = new VariableDeclaration(t.val);
SafeAdd(fd, fd.Fields, f);
Expect(3);
Expr(
#line 758 "cs.ATG"
out expr);
#line 758 "cs.ATG"
f.Initializer = expr;
while (la.kind == 14) {
lexer.NextToken();
Identifier();
#line 759 "cs.ATG"
f = new VariableDeclaration(t.val);
SafeAdd(fd, fd.Fields, f);
Expect(3);
Expr(
#line 762 "cs.ATG"
out expr);
#line 762 "cs.ATG"
f.Initializer = expr;
}
Expect(11);
#line 763 "cs.ATG"
fd.EndLocation = t.EndLocation; compilationUnit.AddChild(fd);
} else if (
#line 767 "cs.ATG"
NotVoidPointer()) {
#line 767 "cs.ATG"
m.Check(Modifiers.PropertysEventsMethods);
Expect(123);
#line 768 "cs.ATG"
Location startPos = t.Location;
if (
#line 769 "cs.ATG"
IsExplicitInterfaceImplementation()) {
TypeName(
#line 770 "cs.ATG"
out explicitInterface, false);
#line 771 "cs.ATG"
if (la.kind != Tokens.Dot || Peek(1).kind != Tokens.This) {
qualident = TypeReference.StripLastIdentifierFromType(ref explicitInterface);
}
} else if (StartOf(19)) {
Identifier();
#line 774 "cs.ATG"
qualident = t.val;
} else SynErr(162);
if (la.kind == 23) {
TypeParameterList(
#line 777 "cs.ATG"
templates);
}
Expect(20);
if (la.kind == 111) {
lexer.NextToken();
#line 780 "cs.ATG"
isExtensionMethod = true; /* C# 3.0 */
}
if (StartOf(11)) {
//.........这里部分代码省略.........