📄 parser.cs
字号:
#line 648 "VBNET.ATG"
templates);
if (la.kind == 24) {
lexer.NextToken();
if (StartOf(4)) {
FormalParameterList(
#line 649 "VBNET.ATG"
p);
}
Expect(25);
}
if (la.kind == 48) {
lexer.NextToken();
while (la.kind == 27) {
AttributeSection(
#line 650 "VBNET.ATG"
out returnTypeAttributeSection);
}
TypeName(
#line 650 "VBNET.ATG"
out type);
}
#line 652 "VBNET.ATG"
if(type == null) {
type = new TypeReference("System.Object");
}
MethodDeclaration md = new MethodDeclaration(name, mod.Modifier, type, p, attributes);
if (returnTypeAttributeSection != null) {
returnTypeAttributeSection.AttributeTarget = "return";
md.Attributes.Add(returnTypeAttributeSection);
}
md.StartLocation = startLocation;
md.EndLocation = t.EndLocation;
md.Templates = templates;
compilationUnit.AddChild(md);
Expect(1);
} else if (la.kind == 146) {
lexer.NextToken();
#line 669 "VBNET.ATG"
Location startLocation = t.Location;
mod.Check(Modifiers.VBInterfaceProperties);
Identifier();
#line 672 "VBNET.ATG"
name = t.val;
if (la.kind == 24) {
lexer.NextToken();
if (StartOf(4)) {
FormalParameterList(
#line 673 "VBNET.ATG"
p);
}
Expect(25);
}
if (la.kind == 48) {
lexer.NextToken();
TypeName(
#line 674 "VBNET.ATG"
out type);
}
#line 676 "VBNET.ATG"
if(type == null) {
type = new TypeReference("System.Object");
}
Expect(1);
#line 682 "VBNET.ATG"
PropertyDeclaration pd = new PropertyDeclaration(name, type, mod.Modifier, attributes);
pd.Parameters = p;
pd.EndLocation = t.EndLocation;
pd.StartLocation = startLocation;
compilationUnit.AddChild(pd);
} else SynErr(228);
} else if (StartOf(19)) {
NonModuleDeclaration(
#line 690 "VBNET.ATG"
mod, attributes);
} else SynErr(229);
}
void Expr(
#line 1536 "VBNET.ATG"
out Expression expr) {
DisjunctionExpr(
#line 1538 "VBNET.ATG"
out expr);
}
void ImplementsClause(
#line 1509 "VBNET.ATG"
out List<InterfaceImplementation> baseInterfaces) {
#line 1511 "VBNET.ATG"
baseInterfaces = new List<InterfaceImplementation>();
TypeReference type = null;
string memberName = null;
Expect(107);
NonArrayTypeName(
#line 1516 "VBNET.ATG"
out type, false);
#line 1517 "VBNET.ATG"
if (type != null) memberName = TypeReference.StripLastIdentifierFromType(ref type);
#line 1518 "VBNET.ATG"
baseInterfaces.Add(new InterfaceImplementation(type, memberName));
while (la.kind == 12) {
lexer.NextToken();
NonArrayTypeName(
#line 1520 "VBNET.ATG"
out type, false);
#line 1521 "VBNET.ATG"
if (type != null) memberName = TypeReference.StripLastIdentifierFromType(ref type);
#line 1522 "VBNET.ATG"
baseInterfaces.Add(new InterfaceImplementation(type, memberName));
}
}
void HandlesClause(
#line 1467 "VBNET.ATG"
out List<string> handlesClause) {
#line 1469 "VBNET.ATG"
handlesClause = new List<string>();
string name;
Expect(105);
EventMemberSpecifier(
#line 1472 "VBNET.ATG"
out name);
#line 1472 "VBNET.ATG"
handlesClause.Add(name);
while (la.kind == 12) {
lexer.NextToken();
EventMemberSpecifier(
#line 1473 "VBNET.ATG"
out name);
#line 1473 "VBNET.ATG"
handlesClause.Add(name);
}
}
void Block(
#line 2185 "VBNET.ATG"
out Statement stmt) {
#line 2188 "VBNET.ATG"
BlockStatement blockStmt = new BlockStatement();
/* in snippet parsing mode, t might be null */
if (t != null) blockStmt.StartLocation = t.Location;
compilationUnit.BlockStart(blockStmt);
while (StartOf(20) ||
#line 2194 "VBNET.ATG"
IsEndStmtAhead()) {
if (
#line 2194 "VBNET.ATG"
IsEndStmtAhead()) {
Expect(88);
EndOfStmt();
#line 2194 "VBNET.ATG"
compilationUnit.AddChild(new EndStatement());
} else {
Statement();
EndOfStmt();
}
}
#line 2199 "VBNET.ATG"
stmt = blockStmt;
if (t != null) blockStmt.EndLocation = t.EndLocation;
compilationUnit.BlockEnd();
}
void Charset(
#line 1459 "VBNET.ATG"
out CharsetModifier charsetModifier) {
#line 1460 "VBNET.ATG"
charsetModifier = CharsetModifier.None;
if (la.kind == 100 || la.kind == 167) {
} else if (la.kind == 47) {
lexer.NextToken();
#line 1461 "VBNET.ATG"
charsetModifier = CharsetModifier.Ansi;
} else if (la.kind == 50) {
lexer.NextToken();
#line 1462 "VBNET.ATG"
charsetModifier = CharsetModifier.Auto;
} else if (la.kind == 176) {
lexer.NextToken();
#line 1463 "VBNET.ATG"
charsetModifier = CharsetModifier.Unicode;
} else SynErr(230);
}
void IdentifierForFieldDeclaration() {
switch (la.kind) {
case 2: {
lexer.NextToken();
break;
}
case 169: {
lexer.NextToken();
break;
}
case 51: {
lexer.NextToken();
break;
}
case 70: {
lexer.NextToken();
break;
}
case 49: {
lexer.NextToken();
break;
}
case 47: {
lexer.NextToken();
break;
}
case 50: {
lexer.NextToken();
break;
}
case 144: {
lexer.NextToken();
break;
}
case 176: {
lexer.NextToken();
break;
}
case 177: {
lexer.NextToken();
break;
}
case 134: {
lexer.NextToken();
break;
}
case 95: {
lexer.NextToken();
break;
}
default: SynErr(231); break;
}
}
void VariableDeclaratorPartAfterIdentifier(
#line 1341 "VBNET.ATG"
List<VariableDeclaration> fieldDeclaration, string name) {
#line 1343 "VBNET.ATG"
Expression expr = null;
TypeReference type = null;
ArrayList rank = null;
List<Expression> dimension = null;
if (
#line 1348 "VBNET.ATG"
IsSize() && !IsDims()) {
ArrayInitializationModifier(
#line 1348 "VBNET.ATG"
out dimension);
}
if (
#line 1349 "VBNET.ATG"
IsDims()) {
ArrayNameModifier(
#line 1349 "VBNET.ATG"
out rank);
}
if (
#line 1351 "VBNET.ATG"
IsObjectCreation()) {
Expect(48);
ObjectCreateExpression(
#line 1351 "VBNET.ATG"
out expr);
#line 1353 "VBNET.ATG"
if (expr is ObjectCreateExpression) {
type = ((ObjectCreateExpression)expr).CreateType;
} else {
type = ((ArrayCreateExpression)expr).CreateType;
}
} else if (StartOf(21)) {
if (la.kind == 48) {
lexer.NextToken();
TypeName(
#line 1360 "VBNET.ATG"
out type);
#line 1362 "VBNET.ATG"
if (type != null) {
for (int i = fieldDeclaration.Count - 1; i >= 0; i--) {
VariableDeclaration vd = fieldDeclaration[i];
if (vd.TypeReference.Type.Length > 0) break;
TypeReference newType = type.Clone();
newType.RankSpecifier = vd.TypeReference.RankSpecifier;
vd.TypeReference = newType;
}
}
}
#line 1374 "VBNET.ATG"
if (type == null && (dimension != null || rank != null)) {
type = new TypeReference("");
}
if (dimension != null) {
if(type.RankSpecifier != null) {
Error("array rank only allowed one time");
} else {
if (rank == null) {
type.RankSpecifier = new int[] { dimension.Count - 1 };
} else {
rank.Insert(0, dimension.Count - 1);
type.RankSpecifier = (int[])rank.ToArray(typeof(int));
}
expr = new ArrayCreateExpression(type, dimension);
}
} else if (rank != null) {
if(type.RankSpecifier != null) {
Error("array rank only allowed one time");
} else {
type.RankSpecifier = (int[])rank.ToArray(typeof(int));
}
}
if (la.kind == 11) {
lexer.NextToken();
VariableInitializer(
#line 1397 "VBNET.ATG"
out expr);
}
} else SynErr(232);
#line 1399 "VBNET.ATG"
fieldDeclaration.Add(new VariableDeclaration(name, expr, type));
}
void VariableDeclarator(
#line 1335 "VBNET.ATG"
List<VariableDeclaration> fieldDeclaration) {
Identifier();
#line 1337 "VBNET.ATG"
string name = t.val;
VariableDeclaratorPartAfterIdentifier(
#line 1338 "VBNET.ATG"
fieldDeclaration, name);
}
void ConstantDeclarator(
#line 1318 "VBNET.ATG"
List<VariableDeclaration> constantDeclaration) {
#line 1320 "VBNET.ATG"
Expression expr = null;
TypeReference type = null;
string name = String.Empty;
Identifier();
#line 1324 "VBNET.ATG"
name = t.val;
if (la.kind == 48) {
lexer.NextToken();
TypeName(
#line 1325 "VBNET.ATG"
out type);
}
Expect(11);
Expr(
#line 1326 "VBNET.ATG"
out expr);
#line 1328 "VBNET.ATG"
VariableDeclaration f = new VariableDeclaration(name, expr);
f.TypeReference = type;
constantDeclaration.Add(f);
}
void AccessorDecls(
#line 1252 "VBNET.ATG"
out PropertyGetRegion getBlock, out PropertySetRegion setBlock) {
#line 1254 "VBNET.ATG"
List<AttributeSection> attributes = new List<AttributeSection>();
AttributeSection section;
getBlock = null;
setBlock = null;
while (la.kind == 27) {
AttributeSection(
#line 1259 "VBNET.ATG"
out section);
#line 1259 "VBNET.ATG"
attributes.Add(section);
}
if (StartOf(22)) {
GetAccessorDecl(
#line 1261 "VBNET.ATG"
out getBlock, attributes);
if (StartOf(23)) {
#line 1263 "VBNET.ATG"
attributes = new List<AttributeSection>();
while (la.kind == 27) {
AttributeSection(
#line 1264 "VBNET.ATG"
out section);
#line 1264 "VBNET.ATG"
attributes.Add(section);
}
SetAccessorDecl(
#line 1265 "VBNET.ATG"
out setBlock, attributes);
}
} else if (StartOf(24)) {
SetAccessorDecl(
#line 1268 "VBNET.ATG"
out setBlock, attributes);
if (StartOf(25)) {
#line 1270 "VBNET.ATG"
attributes = new List<AttributeSection>();
while (la.kind == 27) {
AttributeSection(
#line 1271 "VBNET.ATG"
out section);
#line 1271 "VBNET.ATG"
attributes.Add(section);
}
GetAccessorDecl(
#line 1272 "VBNET.ATG"
out getBlock, attributes);
}
} else SynErr(233);
}
void EventAccessorDeclaration(
#line 1215 "VBNET.ATG"
out EventAddRemoveRegion eventAccessorDeclaration) {
#line 1217 "VBNET.ATG"
Statement stmt = null;
List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
AttributeSection section;
List<AttributeSection> attributes = new List<AttributeSection>();
eventAccessorDeclaration = null;
while (la.kind == 27) {
AttributeSection(
#line 1223 "VBNET.ATG"
out section);
#line 1223 "VBNET.ATG"
attributes.Add(section);
}
if (la.kind == 42) {
lexer.NextToken();
if (la.kind == 24) {
lexer.NextToken();
if (StartOf(4)) {
FormalParameterList(
#line 1225 "VBNET.ATG"
p);
}
Expect(25);
}
Expect(1);
Block(
#line 1226 "VBNET.ATG"
out stmt);
Expect(88);
Expect(42);
Expect(1);
#line 1228 "VBNET.ATG"
eventAccessorDeclaration = new EventAddRegion(attributes);
eventAccessorDeclaration.Block = (BlockStatement)stmt;
eventAccessorDeclaration.Parameters = p;
} else if (la.kind == 152) {
lexer.NextToken();
if (la.kind == 24) {
lexer.NextToken();
if (StartOf(4)) {
FormalParameterList(
#line 1233 "VBNET.ATG"
p);
}
Expect(25);
}
Expect(1);
Block(
#line 1234 "VBNET.ATG"
out stmt);
Expect(88);
Expect(152);
Expect(1);
#line 1236 "VBNET.ATG"
eventAccessorDeclaration = new EventRemoveRegion(attributes);
eventAccessorDeclaration.Block = (BlockStatement)stmt;
eventAccessorDeclaration.Parameters = p;
} else if (la.kind == 149) {
lexer.NextToken();
if (la.kind == 24) {
lexer.NextToken();
if (StartOf(4)) {
FormalParameterList(
#line 1241 "VBNET.ATG"
p);
}
Expect(25);
}
Expect(1);
Block(
#line 1242 "VBNET.ATG"
out stmt);
Expect(88);
Expect(149);
Expect(1);
#line 1244 "VBNET.ATG"
eventAccessorDeclaration = new EventRaiseRegion(attributes);
eventAccessorDeclaration.Block = (BlockStatement)stmt;
eventAccessorDeclaration.Parameters = p;
} else SynErr(234);
}
void OverloadableOperator(
#line 1157 "VBNET.ATG"
out OverloadableOperatorType operatorType) {
#line 1158 "VBNET.ATG"
operatorType = OverloadableOperatorType.None;
switch (la.kind) {
case 14: {
lexer.NextToken();
#line 1160 "VBNET.ATG"
operatorType = OverloadableOperatorType.Add;
break;
}
case 15: {
lexer.NextToken();
#line
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -