📄 parser.cs
字号:
}
void Qualident(
#line 2547 "VBNET.ATG"
out string qualident) {
#line 2548 "VBNET.ATG"
string name = String.Empty;
Identifier();
#line 2549 "VBNET.ATG"
StringBuilder qualidentBuilder = new StringBuilder(t.val);
while (la.kind == 10) {
lexer.NextToken();
IdentifierOrKeyword(
#line 2551 "VBNET.ATG"
out name);
#line 2551 "VBNET.ATG"
qualidentBuilder.Append('.');
qualidentBuilder.Append(name);
}
#line 2555 "VBNET.ATG"
qualident = qualidentBuilder.ToString();
}
void NamespaceBody() {
while (StartOf(1)) {
NamespaceMemberDecl();
}
Expect(89);
Expect(127);
Expect(1);
}
void AttributeSection(
#line 1931 "VBNET.ATG"
out AttributeSection section) {
#line 1933 "VBNET.ATG"
string attributeTarget = "";
ArrayList attributes = new ArrayList();
ICSharpCode.SharpRefactory.Parser.AST.VB.Attribute attribute;
Expect(28);
#line 1938 "VBNET.ATG"
Point startPos = t.Location;
if (
#line 1939 "VBNET.ATG"
IsLocalAttrTarget()) {
if (la.kind == 94) {
lexer.NextToken();
#line 1940 "VBNET.ATG"
attributeTarget = "event";
} else if (la.kind == 156) {
lexer.NextToken();
#line 1941 "VBNET.ATG"
attributeTarget = "return";
} else {
Identifier();
#line 1944 "VBNET.ATG"
string val = t.val.ToLower(System.Globalization.CultureInfo.InvariantCulture);
if (val != "field" || val != "method" ||
val != "module" || val != "param" ||
val != "property" || val != "type")
Error("attribute target specifier (event, return, field," +
"method, module, param, property, or type) expected");
attributeTarget = t.val;
}
Expect(13);
}
Attribute(
#line 1954 "VBNET.ATG"
out attribute);
#line 1954 "VBNET.ATG"
attributes.Add(attribute);
while (
#line 1955 "VBNET.ATG"
NotFinalComma()) {
Expect(12);
Attribute(
#line 1955 "VBNET.ATG"
out attribute);
#line 1955 "VBNET.ATG"
attributes.Add(attribute);
}
if (la.kind == 12) {
lexer.NextToken();
}
Expect(27);
#line 1959 "VBNET.ATG"
section = new AttributeSection(attributeTarget, attributes);
section.StartLocation = startPos;
section.EndLocation = t.EndLocation;
}
void TypeModifier(
#line 2735 "VBNET.ATG"
Modifiers m) {
switch (la.kind) {
case 150: {
lexer.NextToken();
#line 2736 "VBNET.ATG"
m.Add(Modifier.Public);
break;
}
case 149: {
lexer.NextToken();
#line 2737 "VBNET.ATG"
m.Add(Modifier.Protected);
break;
}
case 100: {
lexer.NextToken();
#line 2738 "VBNET.ATG"
m.Add(Modifier.Friend);
break;
}
case 147: {
lexer.NextToken();
#line 2739 "VBNET.ATG"
m.Add(Modifier.Private);
break;
}
case 160: {
lexer.NextToken();
#line 2740 "VBNET.ATG"
m.Add(Modifier.Shared);
break;
}
case 159: {
lexer.NextToken();
#line 2741 "VBNET.ATG"
m.Add(Modifier.Shadows);
break;
}
case 123: {
lexer.NextToken();
#line 2742 "VBNET.ATG"
m.Add(Modifier.MustInherit);
break;
}
case 132: {
lexer.NextToken();
#line 2743 "VBNET.ATG"
m.Add(Modifier.NotInheritable);
break;
}
default: SynErr(196); break;
}
}
void NonModuleDeclaration(
#line 554 "VBNET.ATG"
Modifiers m, ArrayList attributes) {
#line 556 "VBNET.ATG"
string name = String.Empty;
ArrayList names = null;
switch (la.kind) {
case 68: {
#line 559 "VBNET.ATG"
m.Check(Modifier.Classes);
lexer.NextToken();
#line 562 "VBNET.ATG"
TypeDeclaration newType = new TypeDeclaration();
compilationUnit.AddChild(newType);
compilationUnit.BlockStart(newType);
newType.Specials["before"] = lexer.SpecialTracker.RetreiveComments();
newType.Type = Types.Class;
newType.Modifier = m.Modifier;
newType.Attributes = attributes;
Identifier();
#line 570 "VBNET.ATG"
newType.Name = t.val; newType.StartLocation = t.EndLocation;
EndOfStmt();
if (la.kind == 111) {
ClassBaseType(
#line 572 "VBNET.ATG"
out name);
#line 572 "VBNET.ATG"
newType.BaseType = name;
}
while (la.kind == 108) {
TypeImplementsClause(
#line 573 "VBNET.ATG"
out names);
#line 573 "VBNET.ATG"
newType.BaseInterfaces = names;
}
ClassBody(
#line 574 "VBNET.ATG"
newType);
#line 576 "VBNET.ATG"
compilationUnit.BlockEnd();
break;
}
case 122: {
lexer.NextToken();
#line 580 "VBNET.ATG"
m.Check(Modifier.Modules);
TypeDeclaration newType = new TypeDeclaration();
newType.Specials["before"] = lexer.SpecialTracker.RetreiveComments();
compilationUnit.AddChild(newType);
compilationUnit.BlockStart(newType);
newType.StartLocation = t.Location;
newType.Type = Types.Module;
newType.Modifier = m.Modifier;
newType.Attributes = attributes;
Identifier();
#line 590 "VBNET.ATG"
newType.Name = t.val; newType.StartLocation = t.EndLocation;
Expect(1);
ModuleBody(
#line 592 "VBNET.ATG"
newType);
#line 594 "VBNET.ATG"
newType.EndLocation = t.Location;
compilationUnit.BlockEnd();
break;
}
case 168: {
lexer.NextToken();
#line 599 "VBNET.ATG"
m.Check(Modifier.Structures);
TypeDeclaration newType = new TypeDeclaration();
compilationUnit.AddChild(newType);
compilationUnit.BlockStart(newType);
newType.Specials["before"] = lexer.SpecialTracker.RetreiveComments();
newType.StartLocation = t.Location;
newType.Type = Types.Structure;
newType.Modifier = m.Modifier;
newType.Attributes = attributes;
ArrayList baseInterfaces = new ArrayList();
Identifier();
#line 610 "VBNET.ATG"
newType.Name = t.val; newType.StartLocation = t.EndLocation;
Expect(1);
while (la.kind == 108) {
TypeImplementsClause(
#line 611 "VBNET.ATG"
out baseInterfaces);
}
StructureBody(
#line 612 "VBNET.ATG"
newType);
#line 614 "VBNET.ATG"
newType.EndLocation = t.Location;
compilationUnit.BlockEnd();
break;
}
case 91: {
lexer.NextToken();
#line 620 "VBNET.ATG"
m.Check(Modifier.Enums);
TypeDeclaration newType = new TypeDeclaration();
newType.Specials["before"] = lexer.SpecialTracker.RetreiveComments();
compilationUnit.AddChild(newType);
compilationUnit.BlockStart(newType);
newType.Type = Types.Enum;
newType.Modifier = m.Modifier;
newType.Attributes = attributes;
Identifier();
#line 631 "VBNET.ATG"
newType.Name = t.val; newType.StartLocation = t.EndLocation;
if (la.kind == 49) {
lexer.NextToken();
PrimitiveTypeName(
#line 632 "VBNET.ATG"
out name);
#line 632 "VBNET.ATG"
newType.BaseType = name;
}
Expect(1);
EnumBody(
#line 634 "VBNET.ATG"
newType);
#line 636 "VBNET.ATG"
newType.EndLocation = t.Location;
compilationUnit.BlockEnd();
break;
}
case 113: {
lexer.NextToken();
#line 642 "VBNET.ATG"
m.Check(Modifier.Interfaces);
TypeDeclaration newType = new TypeDeclaration();
compilationUnit.AddChild(newType);
compilationUnit.BlockStart(newType);
newType.Specials["before"] = lexer.SpecialTracker.RetreiveComments();
newType.Type = Types.Interface;
newType.Modifier = m.Modifier;
newType.Attributes = attributes;
ArrayList baseInterfaces = new ArrayList();
Identifier();
#line 653 "VBNET.ATG"
newType.Name = t.val; newType.StartLocation = t.EndLocation;
EndOfStmt();
while (la.kind == 111) {
InterfaceBase(
#line 654 "VBNET.ATG"
out baseInterfaces);
#line 654 "VBNET.ATG"
newType.BaseInterfaces = baseInterfaces;
}
InterfaceBody(
#line 655 "VBNET.ATG"
newType);
#line 657 "VBNET.ATG"
newType.EndLocation = t.Location;
compilationUnit.BlockEnd();
break;
}
case 81: {
lexer.NextToken();
#line 663 "VBNET.ATG"
m.Check(Modifier.Delegates);
DelegateDeclaration delegateDeclr = new DelegateDeclaration();
ArrayList p = null;
TypeReference type = null;
delegateDeclr.Specials["before"] = lexer.SpecialTracker.RetreiveComments();
delegateDeclr.StartLocation = t.Location;
delegateDeclr.Modifier = m.Modifier;
delegateDeclr.Attributes = attributes;
if (la.kind == 169) {
lexer.NextToken();
Identifier();
#line 673 "VBNET.ATG"
delegateDeclr.Name = t.val;
if (la.kind == 25) {
lexer.NextToken();
if (StartOf(4)) {
FormalParameterList(
#line 674 "VBNET.ATG"
out p);
}
Expect(26);
#line 674 "VBNET.ATG"
delegateDeclr.Parameters = p;
}
} else if (la.kind == 101) {
lexer.NextToken();
Identifier();
#line 676 "VBNET.ATG"
delegateDeclr.Name = t.val;
if (la.kind == 25) {
lexer.NextToken();
if (StartOf(4)) {
FormalParameterList(
#line 677 "VBNET.ATG"
out p);
}
Expect(26);
#line 677 "VBNET.ATG"
delegateDeclr.Parameters = p;
}
if (la.kind == 49) {
lexer.NextToken();
TypeName(
#line 678 "VBNET.ATG"
out type);
#line 678 "VBNET.ATG"
delegateDeclr.ReturnType = type;
}
} else SynErr(197);
#line 680 "VBNET.ATG"
delegateDeclr.EndLocation = t.EndLocation;
Expect(1);
#line 683 "VBNET.ATG"
compilationUnit.AddChild(delegateDeclr);
break;
}
default: SynErr(198); break;
}
}
void ClassBaseType(
#line 873 "VBNET.ATG"
out string name) {
#line 875 "VBNET.ATG"
TypeReference type;
name = String.Empty;
Expect(111);
TypeName(
#line 879 "VBNET.ATG"
out type);
#line 879 "VBNET.ATG"
name = type.Type;
EndOfStmt();
}
void TypeImplementsClause(
#line 1408 "VBNET.ATG"
out ArrayList baseInterfaces) {
#line 1410 "VBNET.ATG"
baseInterfaces = new ArrayList();
TypeReference type = null;
Expect(108);
TypeName(
#line 1413 "VBNET.ATG"
out type);
#line 1415 "VBNET.ATG"
baseInterfaces.Add(type);
while (la.kind == 12) {
lexer.NextToken();
TypeName(
#line 1418 "VBNET.ATG"
out type);
#line 1419 "VBNET.ATG"
baseInterfaces.Add(type);
}
EndOfStmt();
}
void ClassBody(
#line 693 "VBNET.ATG"
TypeDeclaration newType) {
#line 694 "VBNET.ATG"
AttributeSection section;
while (StartOf(5)) {
#line 697 "VBNET.ATG"
ArrayList attributes = new ArrayList();
Modifiers m = new Modifiers(this);
while (la.kind == 28) {
AttributeSection(
#line 700 "VBNET.ATG"
out section);
#line 700 "VBNET.ATG"
attributes.Add(section);
}
while (StartOf(6)) {
MemberModifier(
#line 701 "VBNET.ATG"
m);
}
ClassMemberDecl(
#line 702 "VBNET.ATG"
m, attributes);
}
Expect(89);
Expect(68);
#line 704 "VBNET.ATG"
newType.EndLocation = t.EndLocation;
Expect(1);
}
void ModuleBody(
#line 724 "VBNET.ATG"
TypeDeclaration newType) {
#line 725 "VBNET.ATG"
AttributeSection section;
while (StartOf(5)) {
#line 728 "VBNET.ATG"
ArrayList attributes = new ArrayList();
Modifiers m = new Modifiers(this);
while (la.kind == 28) {
AttributeSection(
#line 731 "VBNET.ATG"
out section);
#line 731 "VBNET.ATG"
attributes.Add(section);
}
while (StartOf(6)) {
MemberModifier(
#line 732 "VBNET.ATG"
m);
}
ClassMemberDecl(
#line 733 "VBNET.ATG"
m, attributes);
}
Expect(89);
Expect(122);
#line 735 "VBNET.ATG"
newType.EndLocation = t.EndLocation;
Expect(1);
}
void StructureBody(
#line 708 "VBNET.ATG"
TypeDeclaration newType) {
#line 709 "VBNET.ATG"
AttributeSection section;
while (StartOf(5)) {
#line 712 "VBNET.ATG"
ArrayList attributes = new ArrayList();
Modifiers m = new Modifiers(this);
while (la.kind == 28) {
AttributeSection(
#line 715 "VBNET.ATG"
out section);
#line 715 "VBNET.ATG"
attributes.Add(section);
}
while (StartOf(6)) {
MemberModifier(
#line 716 "VBNET.ATG"
m);
}
StructureMemberDecl(
#line 717 "VBNET.ATG"
m, attributes);
}
Expect(89);
Expect(168);
#line 719 "VBNET.ATG"
newType.EndLocation = t.EndLocation;
Expect(1);
}
void PrimitiveTypeName(
#line 2713 "VBNET.ATG"
out string type) {
#line 2714 "VBNET.ATG"
type = String.Empty;
switch (la.kind) {
case 53: {
lexer.NextToken();
#line 2715 "VBNET.ATG"
type = "Boolean";
break;
}
case 77: {
lexer.NextToken();
#line 2716 "VBNET.ATG"
type = "Date";
break;
}
case 66: {
lexer.NextToken();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -