📄 parser.cs
字号:
out AttributeSection section) {
#line 1868 "VBNET.ATG"
string attributeTarget = "";
ArrayList attributes = new ArrayList();
ICSharpCode.SharpRefactory.Parser.AST.VB.Attribute attribute;
Expect(28);
#line 1873 "VBNET.ATG"
Point startPos = t.Location;
if (
#line 1874 "VBNET.ATG"
IsLocalAttrTarget()) {
if (la.kind == 94) {
lexer.NextToken();
#line 1875 "VBNET.ATG"
attributeTarget = "event";
} else if (la.kind == 156) {
lexer.NextToken();
#line 1876 "VBNET.ATG"
attributeTarget = "return";
} else {
Identifier();
#line 1879 "VBNET.ATG"
string val = t.val.ToLower();
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 1889 "VBNET.ATG"
out attribute);
#line 1889 "VBNET.ATG"
attributes.Add(attribute);
while (
#line 1890 "VBNET.ATG"
NotFinalComma()) {
Expect(12);
Attribute(
#line 1890 "VBNET.ATG"
out attribute);
#line 1890 "VBNET.ATG"
attributes.Add(attribute);
}
if (la.kind == 12) {
lexer.NextToken();
}
Expect(27);
#line 1894 "VBNET.ATG"
section = new AttributeSection(attributeTarget, attributes);
section.StartLocation = startPos;
section.EndLocation = t.EndLocation;
}
void TypeModifier(
#line 2694 "VBNET.ATG"
Modifiers m) {
switch (la.kind) {
case 150: {
lexer.NextToken();
#line 2695 "VBNET.ATG"
m.Add(Modifier.Public);
break;
}
case 149: {
lexer.NextToken();
#line 2696 "VBNET.ATG"
m.Add(Modifier.Protected);
break;
}
case 100: {
lexer.NextToken();
#line 2697 "VBNET.ATG"
m.Add(Modifier.Friend);
break;
}
case 147: {
lexer.NextToken();
#line 2698 "VBNET.ATG"
m.Add(Modifier.Private);
break;
}
case 160: {
lexer.NextToken();
#line 2699 "VBNET.ATG"
m.Add(Modifier.Shared);
break;
}
case 159: {
lexer.NextToken();
#line 2700 "VBNET.ATG"
m.Add(Modifier.Shadows);
break;
}
case 123: {
lexer.NextToken();
#line 2701 "VBNET.ATG"
m.Add(Modifier.MustInherit);
break;
}
case 132: {
lexer.NextToken();
#line 2702 "VBNET.ATG"
m.Add(Modifier.NotInheritable);
break;
}
default: SynErr(196); break;
}
}
void NonModuleDeclaration(
#line 546 "VBNET.ATG"
Modifiers m, ArrayList attributes) {
#line 548 "VBNET.ATG"
string name = String.Empty;
ArrayList names = null;
switch (la.kind) {
case 68: {
#line 551 "VBNET.ATG"
m.Check(Modifier.Classes);
lexer.NextToken();
#line 554 "VBNET.ATG"
TypeDeclaration newType = new TypeDeclaration();
compilationUnit.AddChild(newType);
compilationUnit.BlockStart(newType);
newType.Type = Types.Class;
newType.Modifier = m.Modifier;
newType.Attributes = attributes;
Identifier();
#line 562 "VBNET.ATG"
newType.Name = t.val; newType.StartLocation = t.EndLocation;
EndOfStmt();
if (la.kind == 111) {
ClassBaseType(
#line 564 "VBNET.ATG"
out name);
#line 564 "VBNET.ATG"
newType.BaseType = name;
}
while (la.kind == 108) {
TypeImplementsClause(
#line 565 "VBNET.ATG"
out names);
#line 565 "VBNET.ATG"
newType.BaseInterfaces = names;
}
ClassBody(
#line 566 "VBNET.ATG"
newType);
#line 568 "VBNET.ATG"
compilationUnit.BlockEnd();
break;
}
case 122: {
lexer.NextToken();
#line 572 "VBNET.ATG"
m.Check(Modifier.Modules);
TypeDeclaration newType = new TypeDeclaration();
compilationUnit.AddChild(newType);
compilationUnit.BlockStart(newType);
newType.StartLocation = t.Location;
newType.Type = Types.Module;
newType.Modifier = m.Modifier;
newType.Attributes = attributes;
Identifier();
#line 581 "VBNET.ATG"
newType.Name = t.val; newType.StartLocation = t.EndLocation;
Expect(1);
ModuleBody(
#line 583 "VBNET.ATG"
newType);
#line 585 "VBNET.ATG"
newType.EndLocation = t.Location;
compilationUnit.BlockEnd();
break;
}
case 168: {
lexer.NextToken();
#line 590 "VBNET.ATG"
m.Check(Modifier.Structures);
TypeDeclaration newType = new TypeDeclaration();
compilationUnit.AddChild(newType);
compilationUnit.BlockStart(newType);
newType.StartLocation = t.Location;
newType.Type = Types.Structure;
newType.Modifier = m.Modifier;
newType.Attributes = attributes;
ArrayList baseInterfaces = new ArrayList();
Identifier();
#line 600 "VBNET.ATG"
newType.Name = t.val; newType.StartLocation = t.EndLocation;
Expect(1);
while (la.kind == 108) {
TypeImplementsClause(
#line 601 "VBNET.ATG"
out baseInterfaces);
}
StructureBody(
#line 602 "VBNET.ATG"
newType);
#line 604 "VBNET.ATG"
newType.EndLocation = t.Location;
compilationUnit.BlockEnd();
break;
}
case 91: {
lexer.NextToken();
#line 610 "VBNET.ATG"
m.Check(Modifier.Enums);
TypeDeclaration newType = new TypeDeclaration();
compilationUnit.AddChild(newType);
compilationUnit.BlockStart(newType);
newType.Type = Types.Enum;
newType.Modifier = m.Modifier;
newType.Attributes = attributes;
Identifier();
#line 619 "VBNET.ATG"
newType.Name = t.val; newType.StartLocation = t.EndLocation;
if (la.kind == 49) {
lexer.NextToken();
PrimitiveTypeName(
#line 620 "VBNET.ATG"
out name);
#line 620 "VBNET.ATG"
newType.BaseType = name;
}
Expect(1);
EnumBody(
#line 622 "VBNET.ATG"
newType);
#line 624 "VBNET.ATG"
newType.EndLocation = t.Location;
compilationUnit.BlockEnd();
break;
}
case 113: {
lexer.NextToken();
#line 630 "VBNET.ATG"
m.Check(Modifier.Interfaces);
TypeDeclaration newType = new TypeDeclaration();
compilationUnit.AddChild(newType);
compilationUnit.BlockStart(newType);
newType.Type = Types.Interface;
newType.Modifier = m.Modifier;
newType.Attributes = attributes;
ArrayList baseInterfaces = new ArrayList();
Identifier();
#line 639 "VBNET.ATG"
newType.Name = t.val; newType.StartLocation = t.EndLocation;
EndOfStmt();
while (la.kind == 111) {
InterfaceBase(
#line 640 "VBNET.ATG"
out baseInterfaces);
#line 640 "VBNET.ATG"
newType.BaseInterfaces = baseInterfaces;
}
InterfaceBody(
#line 641 "VBNET.ATG"
newType);
#line 643 "VBNET.ATG"
newType.EndLocation = t.Location;
compilationUnit.BlockEnd();
break;
}
case 81: {
lexer.NextToken();
#line 649 "VBNET.ATG"
m.Check(Modifier.Delegates);
DelegateDeclaration delegateDeclr = new DelegateDeclaration();
ArrayList p = null;
TypeReference type = null;
delegateDeclr.StartLocation = t.Location;
delegateDeclr.Modifier = m.Modifier;
delegateDeclr.Attributes = attributes;
if (la.kind == 169) {
lexer.NextToken();
Identifier();
#line 658 "VBNET.ATG"
delegateDeclr.Name = t.val;
if (la.kind == 25) {
lexer.NextToken();
if (StartOf(4)) {
FormalParameterList(
#line 659 "VBNET.ATG"
out p);
}
Expect(26);
#line 659 "VBNET.ATG"
delegateDeclr.Parameters = p;
}
} else if (la.kind == 101) {
lexer.NextToken();
Identifier();
#line 661 "VBNET.ATG"
delegateDeclr.Name = t.val;
if (la.kind == 25) {
lexer.NextToken();
if (StartOf(4)) {
FormalParameterList(
#line 662 "VBNET.ATG"
out p);
}
Expect(26);
#line 662 "VBNET.ATG"
delegateDeclr.Parameters = p;
}
if (la.kind == 49) {
lexer.NextToken();
TypeName(
#line 663 "VBNET.ATG"
out type);
#line 663 "VBNET.ATG"
delegateDeclr.ReturnType = type;
}
} else SynErr(197);
#line 665 "VBNET.ATG"
delegateDeclr.EndLocation = t.EndLocation;
Expect(1);
#line 668 "VBNET.ATG"
compilationUnit.AddChild(delegateDeclr);
break;
}
default: SynErr(198); break;
}
}
void ClassBaseType(
#line 862 "VBNET.ATG"
out string name) {
#line 864 "VBNET.ATG"
TypeReference type;
name = String.Empty;
Expect(111);
TypeName(
#line 868 "VBNET.ATG"
out type);
#line 868 "VBNET.ATG"
name = type.Type;
EndOfStmt();
}
void TypeImplementsClause(
#line 1376 "VBNET.ATG"
out ArrayList baseInterfaces) {
#line 1378 "VBNET.ATG"
baseInterfaces = new ArrayList();
TypeReference type = null;
Expect(108);
TypeName(
#line 1381 "VBNET.ATG"
out type);
#line 1383 "VBNET.ATG"
baseInterfaces.Add(type);
while (la.kind == 12) {
lexer.NextToken();
TypeName(
#line 1386 "VBNET.ATG"
out type);
#line 1387 "VBNET.ATG"
baseInterfaces.Add(type);
}
EndOfStmt();
}
void ClassBody(
#line 678 "VBNET.ATG"
TypeDeclaration newType) {
#line 679 "VBNET.ATG"
AttributeSection section;
while (StartOf(5)) {
#line 682 "VBNET.ATG"
ArrayList attributes = new ArrayList();
Modifiers m = new Modifiers(this);
while (la.kind == 28) {
AttributeSection(
#line 685 "VBNET.ATG"
out section);
#line 685 "VBNET.ATG"
attributes.Add(section);
}
while (StartOf(6)) {
MemberModifier(
#line 686 "VBNET.ATG"
m);
}
ClassMemberDecl(
#line 687 "VBNET.ATG"
m, attributes);
}
Expect(89);
Expect(68);
#line 689 "VBNET.ATG"
newType.EndLocation = t.EndLocation;
Expect(1);
}
void ModuleBody(
#line 709 "VBNET.ATG"
TypeDeclaration newType) {
#line 710 "VBNET.ATG"
AttributeSection section;
while (StartOf(5)) {
#line 713 "VBNET.ATG"
ArrayList attributes = new ArrayList();
Modifiers m = new Modifiers(this);
while (la.kind == 28) {
AttributeSection(
#line 716 "VBNET.ATG"
out section);
#line 716 "VBNET.ATG"
attributes.Add(section);
}
while (StartOf(6)) {
MemberModifier(
#line 717 "VBNET.ATG"
m);
}
ClassMemberDecl(
#line 718 "VBNET.ATG"
m, attributes);
}
Expect(89);
Expect(122);
#line 720 "VBNET.ATG"
newType.EndLocation = t.EndLocation;
Expect(1);
}
void StructureBody(
#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);
}
StructureMemberDecl(
#line 702 "VBNET.ATG"
m, attributes);
}
Expect(89);
Expect(168);
#line 704 "VBNET.ATG"
newType.EndLocation = t.EndLocation;
Expect(1);
}
void PrimitiveTypeName(
#line 2672 "VBNET.ATG"
out string type) {
#line 2673 "VBNET.ATG"
type = String.Empty;
switch (la.kind) {
case 53: {
lexer.NextToken();
#line 2674 "VBNET.ATG"
type = "Boolean";
break;
}
case 77: {
lexer.NextToken();
#line 2675 "VBNET.ATG"
type = "Date";
break;
}
case 66: {
lexer.NextToken();
#line 2676 "VBNET.ATG"
type = "Char";
break;
}
case 167: {
lexer.NextToken();
#line 2677 "VBNET.ATG"
type = "String";
break;
}
case 78: {
lexer.NextToken();
#line 2678 "VBNET.ATG"
type = "Decimal";
break;
}
case 55: {
lexer.NextToken();
#line 2679 "VBNET.ATG"
type = "Byte";
break;
}
case 161: {
lexer.NextToken();
#line 2680 "VBNET.ATG"
type = "Short";
break;
}
case 112: {
lexer.NextToken();
#line 2681 "VBNET.ATG"
type = "Integer";
break;
}
case 118: {
lexer.NextToken();
#line 2682 "VBNET.ATG"
type = "Long";
break;
}
case 162: {
lexer.NextToken();
#line 2683 "VBNET.ATG"
type = "Single";
break;
}
case 85: {
lexer.NextToken();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -