📄 parser.cs
字号:
if (la.kind == 25) {
lexer.NextToken();
if (StartOf(4)) {
FormalParameterList(
#line 1054 "VBNET.ATG"
out p);
}
Expect(26);
}
Expect(1);
#line 1057 "VBNET.ATG"
DeclareDeclaration declareDeclaration = new DeclareDeclaration(name, m.Modifier, null, p, attributes, library, alias, charsetModifer);
declareDeclaration.Specials["before"] = lexer.SpecialTracker.RetreiveComments();
declareDeclaration.StartLocation = startPos;
declareDeclaration.EndLocation = t.EndLocation;
compilationUnit.AddChild(declareDeclaration);
} else if (la.kind == 101) {
lexer.NextToken();
Identifier();
#line 1065 "VBNET.ATG"
name = t.val;
Expect(116);
Expect(3);
#line 1066 "VBNET.ATG"
library = t.val;
if (la.kind == 45) {
lexer.NextToken();
Expect(3);
#line 1067 "VBNET.ATG"
alias = t.val;
}
if (la.kind == 25) {
lexer.NextToken();
if (StartOf(4)) {
FormalParameterList(
#line 1068 "VBNET.ATG"
out p);
}
Expect(26);
}
if (la.kind == 49) {
lexer.NextToken();
TypeName(
#line 1069 "VBNET.ATG"
out type);
}
Expect(1);
#line 1072 "VBNET.ATG"
DeclareDeclaration declareDeclaration = new DeclareDeclaration(name, m.Modifier, type, p, attributes, library, alias, charsetModifer);
declareDeclaration.Specials["before"] = lexer.SpecialTracker.RetreiveComments();
declareDeclaration.StartLocation = startPos;
declareDeclaration.EndLocation = t.EndLocation;
compilationUnit.AddChild(declareDeclaration);
} else SynErr(204);
break;
}
case 94: {
lexer.NextToken();
#line 1083 "VBNET.ATG"
m.Check(Modifier.Events);
Point startPos = t.Location;
EventDeclaration eventDeclaration;
string name = String.Empty;
ImplementsClause implementsClause = null;
Identifier();
#line 1089 "VBNET.ATG"
name= t.val;
if (la.kind == 49) {
lexer.NextToken();
TypeName(
#line 1091 "VBNET.ATG"
out type);
} else if (la.kind == 1 || la.kind == 25 || la.kind == 108) {
if (la.kind == 25) {
lexer.NextToken();
if (StartOf(4)) {
FormalParameterList(
#line 1093 "VBNET.ATG"
out p);
}
Expect(26);
}
} else SynErr(205);
if (la.kind == 108) {
ImplementsClause(
#line 1095 "VBNET.ATG"
out implementsClause);
}
#line 1097 "VBNET.ATG"
eventDeclaration = new EventDeclaration(type, m.Modifier, p, attributes, name, implementsClause);
eventDeclaration.Specials["before"] = lexer.SpecialTracker.RetreiveComments();
eventDeclaration.StartLocation = startPos;
eventDeclaration.EndLocation = t.EndLocation;
compilationUnit.AddChild(eventDeclaration);
Expect(1);
break;
}
case 2: case 52: case 71: case 171: {
#line 1105 "VBNET.ATG"
Point startPos = t.Location;
#line 1107 "VBNET.ATG"
m.Check(Modifier.Fields);
FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier);
ArrayList comments = lexer.SpecialTracker.RetreiveComments();
fd.StartLocation = startPos;
VariableDeclarator(
#line 1112 "VBNET.ATG"
variableDeclarators);
#line 1114 "VBNET.ATG"
((INode)variableDeclarators[0]).Specials["before"] = comments;
while (la.kind == 12) {
lexer.NextToken();
VariableDeclarator(
#line 1116 "VBNET.ATG"
variableDeclarators);
}
Expect(1);
#line 1119 "VBNET.ATG"
fd.EndLocation = t.EndLocation;
fd.Fields = variableDeclarators;
compilationUnit.AddChild(fd);
break;
}
case 72: {
#line 1124 "VBNET.ATG"
m.Check(Modifier.Fields);
lexer.NextToken();
#line 1125 "VBNET.ATG"
m.Add(Modifier.Constant);
#line 1127 "VBNET.ATG"
FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier);
fd.StartLocation = t.Location;
ArrayList comments = lexer.SpecialTracker.RetreiveComments();
ArrayList constantDeclarators = new ArrayList();
ConstantDeclarator(
#line 1132 "VBNET.ATG"
constantDeclarators);
#line 1134 "VBNET.ATG"
((INode)constantDeclarators[0]).Specials["before"] = comments;
while (la.kind == 12) {
lexer.NextToken();
ConstantDeclarator(
#line 1136 "VBNET.ATG"
constantDeclarators);
}
#line 1138 "VBNET.ATG"
fd.Fields = constantDeclarators;
fd.EndLocation = t.Location;
Expect(1);
#line 1143 "VBNET.ATG"
fd.EndLocation = t.EndLocation;
compilationUnit.AddChild(fd);
break;
}
case 148: {
lexer.NextToken();
#line 1149 "VBNET.ATG"
m.Check(Modifier.Properties);
Point startPos = t.Location;
ImplementsClause implementsClause = null;
Identifier();
#line 1153 "VBNET.ATG"
string propertyName = t.val;
if (la.kind == 25) {
lexer.NextToken();
if (StartOf(4)) {
FormalParameterList(
#line 1154 "VBNET.ATG"
out p);
}
Expect(26);
}
if (la.kind == 49) {
lexer.NextToken();
TypeName(
#line 1155 "VBNET.ATG"
out type);
}
#line 1157 "VBNET.ATG"
if(type == null) {
type = new TypeReference("System.Object");
}
if (la.kind == 108) {
ImplementsClause(
#line 1161 "VBNET.ATG"
out implementsClause);
}
Expect(1);
if (
#line 1165 "VBNET.ATG"
IsMustOverride(m)) {
#line 1167 "VBNET.ATG"
PropertyDeclaration pDecl = new PropertyDeclaration(propertyName, type, m.Modifier, attributes);
pDecl.Specials["before"] = lexer.SpecialTracker.RetreiveComments();
pDecl.StartLocation = startPos;
pDecl.EndLocation = t.Location;
pDecl.TypeReference = type;
pDecl.ImplementsClause = implementsClause;
pDecl.Parameters = p;
compilationUnit.AddChild(pDecl);
} else if (la.kind == 28 || la.kind == 102 || la.kind == 158) {
#line 1178 "VBNET.ATG"
PropertyDeclaration pDecl = new PropertyDeclaration(propertyName, type, m.Modifier, attributes);
pDecl.Specials["before"] = lexer.SpecialTracker.RetreiveComments();
pDecl.StartLocation = startPos;
pDecl.EndLocation = t.Location;
pDecl.BodyStart = t.Location;
pDecl.TypeReference = type;
pDecl.ImplementsClause = implementsClause;
pDecl.Parameters = p;
PropertyGetRegion getRegion;
PropertySetRegion setRegion;
AccessorDecls(
#line 1189 "VBNET.ATG"
out getRegion, out setRegion);
Expect(89);
Expect(148);
Expect(1);
#line 1193 "VBNET.ATG"
pDecl.GetRegion = getRegion;
pDecl.SetRegion = setRegion;
pDecl.BodyEnd = t.EndLocation;
compilationUnit.AddChild(pDecl);
} else SynErr(206);
break;
}
default: SynErr(207); break;
}
}
void EnumMemberDecl(
#line 849 "VBNET.ATG"
out FieldDeclaration f) {
#line 851 "VBNET.ATG"
Expression expr = null;
ArrayList attributes = new ArrayList();
AttributeSection section = null;
VariableDeclaration varDecl = null;
while (la.kind == 28) {
AttributeSection(
#line 856 "VBNET.ATG"
out section);
#line 856 "VBNET.ATG"
attributes.Add(section);
}
Identifier();
#line 859 "VBNET.ATG"
f = new FieldDeclaration(attributes);
varDecl = new VariableDeclaration(t.val);
varDecl.Specials["before"] = lexer.SpecialTracker.RetreiveComments();
f.Fields.Add(varDecl);
f.StartLocation = t.Location;
if (la.kind == 11) {
lexer.NextToken();
Expr(
#line 865 "VBNET.ATG"
out expr);
#line 865 "VBNET.ATG"
varDecl.Initializer = expr;
}
Expect(1);
}
void InterfaceMemberDecl() {
#line 760 "VBNET.ATG"
TypeReference type =null;
ArrayList p = null;
AttributeSection section;
Modifiers mod = new Modifiers(this);
ArrayList attributes = new ArrayList();
ArrayList parameters = new ArrayList();
string name;
if (StartOf(12)) {
while (la.kind == 28) {
AttributeSection(
#line 768 "VBNET.ATG"
out section);
#line 768 "VBNET.ATG"
attributes.Add(section);
}
while (StartOf(6)) {
MemberModifier(
#line 772 "VBNET.ATG"
mod);
}
if (la.kind == 94) {
lexer.NextToken();
#line 775 "VBNET.ATG"
mod.Check(Modifier.InterfaceEvents);
Identifier();
#line 776 "VBNET.ATG"
name = t.val;
if (la.kind == 25) {
lexer.NextToken();
if (StartOf(4)) {
FormalParameterList(
#line 777 "VBNET.ATG"
out p);
}
Expect(26);
}
if (la.kind == 49) {
lexer.NextToken();
TypeName(
#line 778 "VBNET.ATG"
out type);
}
Expect(1);
#line 781 "VBNET.ATG"
EventDeclaration ed = new EventDeclaration(type, mod.Modifier, p, attributes, name, null);
ed.Specials["before"] = lexer.SpecialTracker.RetreiveComments();
compilationUnit.AddChild(ed);
ed.EndLocation = t.EndLocation;
} else if (la.kind == 169) {
lexer.NextToken();
#line 789 "VBNET.ATG"
mod.Check(Modifier.InterfaceMethods);
ArrayList comments = lexer.SpecialTracker.RetreiveComments();
Identifier();
#line 792 "VBNET.ATG"
name = t.val;
if (la.kind == 25) {
lexer.NextToken();
if (StartOf(4)) {
FormalParameterList(
#line 793 "VBNET.ATG"
out p);
}
Expect(26);
}
Expect(1);
#line 796 "VBNET.ATG"
MethodDeclaration md = new MethodDeclaration(name, mod.Modifier, null, p, attributes);
md.Specials["before"] = comments;
md.EndLocation = t.EndLocation;
compilationUnit.AddChild(md);
} else if (la.kind == 101) {
lexer.NextToken();
#line 804 "VBNET.ATG"
mod.Check(Modifier.InterfaceMethods);
AttributeSection attributeSection = null;
Identifier();
#line 807 "VBNET.ATG"
name = t.val;
if (la.kind == 25) {
lexer.NextToken();
if (StartOf(4)) {
FormalParameterList(
#line 808 "VBNET.ATG"
out p);
}
Expect(26);
}
if (la.kind == 49) {
lexer.NextToken();
if (la.kind == 28) {
AttributeSection(
#line 809 "VBNET.ATG"
out attributeSection);
}
TypeName(
#line 809 "VBNET.ATG"
out type);
}
#line 811 "VBNET.ATG"
if(type == null) {
type = new TypeReference("System.Object");
}
type.Attributes = attributeSection;
MethodDeclaration md = new MethodDeclaration(name, mod.Modifier, type, p, attributes);
md.Specials["before"] = lexer.SpecialTracker.RetreiveComments();
md.EndLocation = t.EndLocation;
compilationUnit.AddChild(md);
Expect(1);
} else if (la.kind == 148) {
lexer.NextToken();
#line 824 "VBNET.ATG"
mod.Check(Modifier.InterfaceProperties);
ArrayList comments = lexer.SpecialTracker.RetreiveComments();
Identifier();
#line 827 "VBNET.ATG"
name = t.val;
if (la.kind == 25) {
lexer.NextToken();
if (StartOf(4)) {
FormalParameterList(
#line 828 "VBNET.ATG"
out p);
}
Expect(26);
}
if (la.kind == 49) {
lexer.NextToken();
TypeName(
#line 829 "VBNET.ATG"
out type);
}
#line 831 "VBNET.ATG"
if(type == null) {
type = new TypeReference("System.Object");
}
Expect(1);
#line 837 "VBNET.ATG"
PropertyDeclaration pd = new PropertyDeclaration(name, type, mod.Modifier, attributes);
pd.Parameters = p;
pd.Specials["before"] = comments;
pd.EndLocation = t.EndLocation;
compilationUnit.AddChild(pd);
} else SynErr(208);
} else if (StartOf(13)) {
NonModuleDeclaration(
#line 845 "VBNET.ATG"
mod, attributes);
} else SynErr(209);
}
void Expr(
#line 1447 "VBNET.ATG"
out Expression expr) {
#line 1448 "VBNET.ATG"
expr = new Expression();
ConditionalOrExpr(
#line 1449 "VBNET.ATG"
out expr);
while (StartOf(14)) {
#line 1452 "VBNET.ATG"
AssignmentOperatorType op; Expression val;
AssignmentOperator(
#line 1453 "VBNET.ATG"
out op);
Expr(
#line 1453 "VBNET.ATG"
out val);
#line 1453 "VBNET.ATG"
expr = new AssignmentExpression(expr, op, val);
}
}
void ImplementsClause(
#line 1425 "VBNET.ATG"
out ImplementsClause clause) {
#line 1427 "VBNET.ATG"
clause = new ImplementsClause();
string typename = String.Empty;
string first;
Expect(108);
Identifier();
#line 1431 "VBNET.ATG"
first = t.val;
Expect(10);
Qualident(
#line 1431 "VBNET.ATG"
out typename);
#line 1431 "VBNET.ATG"
((ImplementsClause)clause).BaseMembers.Add(first + "." + typename);
while (la.kind == 12) {
lexer.NextToken();
Identifier();
#line 1432 "VBNET.ATG"
first = t.val;
Expect(10);
Qualident(
#line 1432 "VBNET.ATG"
out typename);
#line 1432 "VBNET.ATG"
((ImplementsClause)clause).BaseMembers.Add(first + "." + typename);
}
}
void HandlesClause(
#line 1383 "VBNET.ATG"
out HandlesClause handlesClause) {
#line 1385 "VBNET.ATG"
handlesClause = new HandlesClause();
string name;
Expect(106);
EventMemberSpecifier(
#line 1388 "VBNET.ATG"
out name);
#line 1388 "VBNET.ATG"
handlesClause.EventNames.Add(name);
while (la.kind == 12) {
lexer.NextToken();
EventMemberSpecifier(
#line 1389 "VBNET.ATG"
out name);
#line 1389 "VBNET.ATG"
handlesClause.EventNames.Add(name);
}
}
void Block(
#line 2024 "VBNET.ATG"
out Statement stmt) {
#line 2027 "VBNET.ATG"
BlockStatement blockStmt = new BlockStatement();
blockStmt.StartLocation = t.Location;
compilationUnit.BlockStart(blockStmt);
while (StartOf(15) ||
#line 2032 "VBNET.ATG"
IsEndStmtAhead()) {
if (StartOf(15)) {
Statement();
EndOfStmt();
} else {
Expect(89);
EndOfStmt();
#line 2032 "VBNET.ATG"
compilationUnit.AddChild(new EndStatement());
}
}
#line 2035 "VBNET.ATG"
stmt = blockStmt;
blockStmt.EndLocation = t.EndLocation;
compilationUnit.BlockEnd();
}
void Charset(
#line 1375 "VBNET.ATG"
out CharsetModifier charsetModifier) {
#line 1376 "VBNET.ATG"
charsetModifier = CharsetModifier.None;
if (la.kind == 101 || la.kind == 169) {
} else if (la.kind == 48) {
lexer.NextToken();
#line 1377 "VBNET.ATG"
charsetModifier = CharsetModifier.ANSI;
} else if (la.kind == 51) {
lexer.NextToken();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -