?? parser.cs
字號:
while (la.kind == 12) {
lexer.NextToken();
Qualident(
#line 788 "cs.ATG"
out qualident);
#line 788 "cs.ATG"
names.Add(qualident);
}
}
void StructBody() {
#line 792 "cs.ATG"
AttributeSection section;
Expect(14);
while (StartOf(12)) {
#line 795 "cs.ATG"
List<AttributeSection> attributes = new List<AttributeSection>();
Modifiers m = new Modifiers();
while (la.kind == 16) {
AttributeSection(
#line 798 "cs.ATG"
out section);
#line 798 "cs.ATG"
attributes.Add(section);
}
while (StartOf(11)) {
MemberModifier(
#line 799 "cs.ATG"
m);
}
StructMemberDecl(
#line 800 "cs.ATG"
m, attributes);
}
Expect(15);
}
void InterfaceBase(
#line 805 "cs.ATG"
out StringCollection names) {
#line 807 "cs.ATG"
string qualident;
names = new StringCollection();
Expect(9);
Qualident(
#line 811 "cs.ATG"
out qualident);
#line 811 "cs.ATG"
names.Add(qualident);
while (la.kind == 12) {
lexer.NextToken();
Qualident(
#line 812 "cs.ATG"
out qualident);
#line 812 "cs.ATG"
names.Add(qualident);
}
}
void InterfaceBody() {
Expect(14);
while (StartOf(13)) {
InterfaceMemberDecl();
}
Expect(15);
}
void IntegralType(
#line 938 "cs.ATG"
out string name) {
#line 938 "cs.ATG"
name = "";
switch (la.kind) {
case 101: {
lexer.NextToken();
#line 940 "cs.ATG"
name = "sbyte";
break;
}
case 53: {
lexer.NextToken();
#line 941 "cs.ATG"
name = "byte";
break;
}
case 103: {
lexer.NextToken();
#line 942 "cs.ATG"
name = "short";
break;
}
case 119: {
lexer.NextToken();
#line 943 "cs.ATG"
name = "ushort";
break;
}
case 81: {
lexer.NextToken();
#line 944 "cs.ATG"
name = "int";
break;
}
case 115: {
lexer.NextToken();
#line 945 "cs.ATG"
name = "uint";
break;
}
case 86: {
lexer.NextToken();
#line 946 "cs.ATG"
name = "long";
break;
}
case 116: {
lexer.NextToken();
#line 947 "cs.ATG"
name = "ulong";
break;
}
case 56: {
lexer.NextToken();
#line 948 "cs.ATG"
name = "char";
break;
}
default: SynErr(132); break;
}
}
void EnumBody() {
#line 818 "cs.ATG"
FieldDeclaration f;
Expect(14);
if (la.kind == 1 || la.kind == 16) {
EnumMemberDecl(
#line 820 "cs.ATG"
out f);
#line 820 "cs.ATG"
compilationUnit.AddChild(f);
while (
#line 821 "cs.ATG"
NotFinalComma()) {
Expect(12);
EnumMemberDecl(
#line 821 "cs.ATG"
out f);
#line 821 "cs.ATG"
compilationUnit.AddChild(f);
}
if (la.kind == 12) {
lexer.NextToken();
}
}
Expect(15);
}
void Type(
#line 826 "cs.ATG"
out TypeReference type) {
#line 828 "cs.ATG"
string name = "";
int pointer = 0;
if (la.kind == 1 || la.kind == 90 || la.kind == 107) {
ClassType(
#line 832 "cs.ATG"
out name);
} else if (StartOf(14)) {
SimpleType(
#line 833 "cs.ATG"
out name);
} else if (la.kind == 122) {
lexer.NextToken();
Expect(6);
#line 834 "cs.ATG"
pointer = 1; name = "void";
} else SynErr(133);
#line 835 "cs.ATG"
ArrayList r = new ArrayList();
while (
#line 836 "cs.ATG"
IsPointerOrDims()) {
#line 836 "cs.ATG"
int i = 1;
if (la.kind == 6) {
lexer.NextToken();
#line 837 "cs.ATG"
++pointer;
} else if (la.kind == 16) {
lexer.NextToken();
while (la.kind == 12) {
lexer.NextToken();
#line 838 "cs.ATG"
++i;
}
Expect(17);
#line 838 "cs.ATG"
r.Add(i);
} else SynErr(134);
}
#line 840 "cs.ATG"
int[] rank = new int[r.Count]; r.CopyTo(rank);
type = new TypeReference(name, pointer, rank);
}
void FormalParameterList(
#line 874 "cs.ATG"
out List<ParameterDeclarationExpression> parameter) {
#line 876 "cs.ATG"
parameter = new List<ParameterDeclarationExpression>();
ParameterDeclarationExpression p;
AttributeSection section;
List<AttributeSection> attributes = new List<AttributeSection>();
while (la.kind == 16) {
AttributeSection(
#line 882 "cs.ATG"
out section);
#line 882 "cs.ATG"
attributes.Add(section);
}
if (StartOf(15)) {
FixedParameter(
#line 884 "cs.ATG"
out p);
#line 884 "cs.ATG"
bool paramsFound = false;
p.Attributes = attributes;
parameter.Add(p);
while (la.kind == 12) {
lexer.NextToken();
#line 889 "cs.ATG"
attributes = new List<AttributeSection>(); if (paramsFound) Error("params array must be at end of parameter list");
while (la.kind == 16) {
AttributeSection(
#line 890 "cs.ATG"
out section);
#line 890 "cs.ATG"
attributes.Add(section);
}
if (StartOf(15)) {
FixedParameter(
#line 892 "cs.ATG"
out p);
#line 892 "cs.ATG"
p.Attributes = attributes; parameter.Add(p);
} else if (la.kind == 94) {
ParameterArray(
#line 893 "cs.ATG"
out p);
#line 893 "cs.ATG"
paramsFound = true; p.Attributes = attributes; parameter.Add(p);
} else SynErr(135);
}
} else if (la.kind == 94) {
ParameterArray(
#line 896 "cs.ATG"
out p);
#line 896 "cs.ATG"
p.Attributes = attributes; parameter.Add(p);
} else SynErr(136);
}
void ClassType(
#line 931 "cs.ATG"
out string name) {
#line 931 "cs.ATG"
string qualident; name = "";
if (la.kind == 1) {
Qualident(
#line 933 "cs.ATG"
out qualident);
#line 933 "cs.ATG"
name = qualident;
} else if (la.kind == 90) {
lexer.NextToken();
#line 934 "cs.ATG"
name = "object";
} else if (la.kind == 107) {
lexer.NextToken();
#line 935 "cs.ATG"
name = "string";
} else SynErr(137);
}
void MemberModifier(
#line 951 "cs.ATG"
Modifiers m) {
switch (la.kind) {
case 48: {
lexer.NextToken();
#line 953 "cs.ATG"
m.Add(Modifier.Abstract);
break;
}
case 70: {
lexer.NextToken();
#line 954 "cs.ATG"
m.Add(Modifier.Extern);
break;
}
case 83: {
lexer.NextToken();
#line 955 "cs.ATG"
m.Add(Modifier.Internal);
break;
}
case 88: {
lexer.NextToken();
#line 956 "cs.ATG"
m.Add(Modifier.New);
break;
}
case 93: {
lexer.NextToken();
#line 957 "cs.ATG"
m.Add(Modifier.Override);
break;
}
case 95: {
lexer.NextToken();
#line 958 "cs.ATG"
m.Add(Modifier.Private);
break;
}
case 96: {
lexer.NextToken();
#line 959 "cs.ATG"
m.Add(Modifier.Protected);
break;
}
case 97: {
lexer.NextToken();
#line 960 "cs.ATG"
m.Add(Modifier.Public);
break;
}
case 98: {
lexer.NextToken();
#line 961 "cs.ATG"
m.Add(Modifier.Readonly);
break;
}
case 102: {
lexer.NextToken();
#line 962 "cs.ATG"
m.Add(Modifier.Sealed);
break;
}
case 106: {
lexer.NextToken();
#line 963 "cs.ATG"
m.Add(Modifier.Static);
break;
}
case 118: {
lexer.NextToken();
#line 964 "cs.ATG"
m.Add(Modifier.Unsafe);
break;
}
case 121: {
lexer.NextToken();
#line 965 "cs.ATG"
m.Add(Modifier.Virtual);
break;
}
case 123: {
lexer.NextToken();
#line 966 "cs.ATG"
m.Add(Modifier.Volatile);
break;
}
default: SynErr(138); break;
}
}
void ClassMemberDecl(
#line 1183 "cs.ATG"
Modifiers m, List<AttributeSection> attributes) {
#line 1184 "cs.ATG"
Statement stmt = null;
if (StartOf(16)) {
StructMemberDecl(
#line 1186 "cs.ATG"
m, attributes);
} else if (la.kind == 25) {
#line 1187 "cs.ATG"
m.Check(Modifier.Destructors); Point startPos = t.Location;
lexer.NextToken();
Expect(1);
#line 1188 "cs.ATG"
DestructorDeclaration d = new DestructorDeclaration(t.val, m.Modifier, attributes);
d.Modifier = m.Modifier;
d.StartLocation = startPos;
Expect(18);
Expect(19);
if (la.kind == 14) {
Block(
#line 1192 "cs.ATG"
out stmt);
} else if (la.kind == 10) {
lexer.NextToken();
} else SynErr(139);
#line 1192 "cs.ATG"
d.EndLocation = t.EndLocation;
d.Body = (BlockStatement)stmt;
compilationUnit.AddChild(d);
} else SynErr(140);
}
void StructMemberDecl(
#line 969 "cs.ATG"
Modifiers m, List<AttributeSection> attributes) {
#line 971 "cs.ATG"
string qualident = null;
TypeReference type;
Expression expr;
List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
Statement stmt = null;
List<VariableDeclaration> variableDeclarators = new List<VariableDeclaration>();
if (la.kind == 59) {
#line 979 "cs.ATG"
m.Check(Modifier.Constants);
lexer.NextToken();
#line 980 "cs.ATG"
Point startPos = t.Location;
Type(
#line 981 "cs.ATG"
out type);
Expect(1);
#line 981 "cs.ATG"
FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier | Modifier.Const);
fd.StartLocation = startPos;
VariableDeclaration f = new VariableDeclaration(t.val);
fd.Fields.Add(f);
Expect(3);
Expr(
#line 986 "cs.ATG"
out expr);
#line 986 "cs.ATG"
f.Initializer = expr;
while (la.kind == 12) {
lexer.NextToken();
Expect(1);
#line 987 "cs.ATG"
f = new VariableDeclaration(t.val);
fd.Fields.Add(f);
Expect(3);
Expr(
#line 990 "cs.ATG"
out expr);
#line 990 "cs.ATG"
f.Initializer = expr;
}
Expect(10);
#line 991 "cs.ATG"
fd.EndLocation = t.EndLocation; compilationUnit.AddChild(fd);
} else if (
#line 994 "cs.ATG"
NotVoidPointer()) {
#line 994 "cs.ATG"
m.Check(Modifier.PropertysEventsMethods);
Expect(122);
#line 995 "cs.ATG"
Point startPos = t.Location;
Qualident(
#line 996 "cs.ATG"
out qualident);
Expect(18);
if (StartOf(9)) {
FormalParameterList(
#line 997 "cs.ATG"
out p);
}
Expect(19);
#line 997 "cs.ATG"
MethodDeclaration methodDeclaration = new MethodDeclaration(qualident,
m.Modifier,
new TypeReference("void"),
p,
attributes);
methodDeclaration.StartLocation = startPos;
methodDeclaration.EndLocation = t.EndLocation;
compilationUnit.AddChild(methodDeclaration);
compilationUnit.BlockStart(methodDeclaration);
if (la.kind == 14) {
Block(
#line 1007 "cs.ATG"
out stmt);
} else if (la.kind == 10) {
lexer.NextToken();
} else SynErr(141);
#line 1007 "cs.ATG"
compilationUnit.BlockEnd();
methodDeclaration.Body = (BlockStatement)stmt;
} else if (la.kind == 68) {
#line 1011 "cs.ATG"
m.Check(Modifier.PropertysEventsMethods);
lexer.NextToken();
#line 1012 "cs.ATG"
EventDeclaration eventDecl = new EventDeclaration(m.Modifier, attributes);
eventDecl.StartLocation = t.Location;
compilationUnit.AddChild(eventDecl);
compilationUnit.BlockStart(eventDecl);
EventAddRegion addBlock = null;
EventRemoveRegion removeBlock = null;
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -