📄 parser.cs
字号:
Block(
#line 1018 "VBNET.ATG"
out stmt);
#line 1020 "VBNET.ATG"
compilationUnit.BlockEnd();
methodDeclaration.Body = (BlockStatement)stmt;
Expect(88);
Expect(167);
#line 1023 "VBNET.ATG"
methodDeclaration.Body.EndLocation = t.EndLocation;
Expect(1);
} else SynErr(220);
} else if (la.kind == 127) {
lexer.NextToken();
if (la.kind == 24) {
lexer.NextToken();
if (StartOf(4)) {
FormalParameterList(
#line 1026 "VBNET.ATG"
p);
}
Expect(25);
}
#line 1027 "VBNET.ATG"
m.Check(Modifier.Constructors);
#line 1028 "VBNET.ATG"
Point constructorEndLocation = t.EndLocation;
Expect(1);
Block(
#line 1030 "VBNET.ATG"
out stmt);
Expect(88);
Expect(167);
#line 1031 "VBNET.ATG"
Point endLocation = t.EndLocation;
Expect(1);
#line 1033 "VBNET.ATG"
ConstructorDeclaration cd = new ConstructorDeclaration("New", m.Modifier, p, attributes);
cd.StartLocation = m.GetDeclarationLocation(startPos);
cd.EndLocation = constructorEndLocation;
cd.Body = (BlockStatement)stmt;
cd.Body.EndLocation = endLocation;
compilationUnit.AddChild(cd);
} else SynErr(221);
break;
}
case 100: {
lexer.NextToken();
#line 1045 "VBNET.ATG"
m.Check(Modifier.VBMethods);
string name = String.Empty;
Point startPos = t.Location;
MethodDeclaration methodDeclaration;List<string> handlesClause = null;
List<InterfaceImplementation> implementsClause = null;
AttributeSection returnTypeAttributeSection = null;
Identifier();
#line 1052 "VBNET.ATG"
name = t.val;
TypeParameterList(
#line 1053 "VBNET.ATG"
templates);
if (la.kind == 24) {
lexer.NextToken();
if (StartOf(4)) {
FormalParameterList(
#line 1054 "VBNET.ATG"
p);
}
Expect(25);
}
if (la.kind == 48) {
lexer.NextToken();
while (la.kind == 27) {
AttributeSection(
#line 1055 "VBNET.ATG"
out returnTypeAttributeSection);
}
TypeName(
#line 1055 "VBNET.ATG"
out type);
}
#line 1057 "VBNET.ATG"
if(type == null) {
type = new TypeReference("System.Object");
}
if (la.kind == 105 || la.kind == 107) {
if (la.kind == 107) {
ImplementsClause(
#line 1063 "VBNET.ATG"
out implementsClause);
} else {
HandlesClause(
#line 1065 "VBNET.ATG"
out handlesClause);
}
}
Expect(1);
if (
#line 1071 "VBNET.ATG"
IsMustOverride(m)) {
#line 1073 "VBNET.ATG"
methodDeclaration = new MethodDeclaration(name, m.Modifier, type, p, attributes);
methodDeclaration.StartLocation = m.GetDeclarationLocation(startPos);
methodDeclaration.EndLocation = t.EndLocation;
methodDeclaration.HandlesClause = handlesClause;
methodDeclaration.Templates = templates;
methodDeclaration.InterfaceImplementations = implementsClause;
if (returnTypeAttributeSection != null) {
returnTypeAttributeSection.AttributeTarget = "return";
methodDeclaration.Attributes.Add(returnTypeAttributeSection);
}
compilationUnit.AddChild(methodDeclaration);
} else if (StartOf(13)) {
#line 1088 "VBNET.ATG"
methodDeclaration = new MethodDeclaration(name, m.Modifier, type, p, attributes);
methodDeclaration.StartLocation = m.GetDeclarationLocation(startPos);
methodDeclaration.EndLocation = t.EndLocation;
methodDeclaration.Templates = templates;
methodDeclaration.HandlesClause = handlesClause;
methodDeclaration.InterfaceImplementations = implementsClause;
if (returnTypeAttributeSection != null) {
returnTypeAttributeSection.AttributeTarget = "return";
methodDeclaration.Attributes.Add(returnTypeAttributeSection);
}
compilationUnit.AddChild(methodDeclaration);
compilationUnit.BlockStart(methodDeclaration);
Block(
#line 1103 "VBNET.ATG"
out stmt);
#line 1105 "VBNET.ATG"
compilationUnit.BlockEnd();
methodDeclaration.Body = (BlockStatement)stmt;
Expect(88);
Expect(100);
#line 1110 "VBNET.ATG"
methodDeclaration.Body.StartLocation = methodDeclaration.EndLocation;
methodDeclaration.Body.EndLocation = t.EndLocation;
Expect(1);
} else SynErr(222);
break;
}
case 78: {
lexer.NextToken();
#line 1119 "VBNET.ATG"
m.Check(Modifier.VBExternalMethods);
Point startPos = t.Location;
CharsetModifier charsetModifer = CharsetModifier.None;
string library = String.Empty;
string alias = null;
string name = String.Empty;
if (StartOf(14)) {
Charset(
#line 1126 "VBNET.ATG"
out charsetModifer);
}
if (la.kind == 167) {
lexer.NextToken();
Identifier();
#line 1129 "VBNET.ATG"
name = t.val;
Expect(115);
Expect(3);
#line 1130 "VBNET.ATG"
library = t.literalValue.ToString();
if (la.kind == 44) {
lexer.NextToken();
Expect(3);
#line 1131 "VBNET.ATG"
alias = t.literalValue.ToString();
}
if (la.kind == 24) {
lexer.NextToken();
if (StartOf(4)) {
FormalParameterList(
#line 1132 "VBNET.ATG"
p);
}
Expect(25);
}
Expect(1);
#line 1135 "VBNET.ATG"
DeclareDeclaration declareDeclaration = new DeclareDeclaration(name, m.Modifier, null, p, attributes, library, alias, charsetModifer);
declareDeclaration.StartLocation = m.GetDeclarationLocation(startPos);
declareDeclaration.EndLocation = t.EndLocation;
compilationUnit.AddChild(declareDeclaration);
} else if (la.kind == 100) {
lexer.NextToken();
Identifier();
#line 1142 "VBNET.ATG"
name = t.val;
Expect(115);
Expect(3);
#line 1143 "VBNET.ATG"
library = t.literalValue.ToString();
if (la.kind == 44) {
lexer.NextToken();
Expect(3);
#line 1144 "VBNET.ATG"
alias = t.literalValue.ToString();
}
if (la.kind == 24) {
lexer.NextToken();
if (StartOf(4)) {
FormalParameterList(
#line 1145 "VBNET.ATG"
p);
}
Expect(25);
}
if (la.kind == 48) {
lexer.NextToken();
TypeName(
#line 1146 "VBNET.ATG"
out type);
}
Expect(1);
#line 1149 "VBNET.ATG"
DeclareDeclaration declareDeclaration = new DeclareDeclaration(name, m.Modifier, type, p, attributes, library, alias, charsetModifer);
declareDeclaration.StartLocation = m.GetDeclarationLocation(startPos);
declareDeclaration.EndLocation = t.EndLocation;
compilationUnit.AddChild(declareDeclaration);
} else SynErr(223);
break;
}
case 93: {
lexer.NextToken();
#line 1159 "VBNET.ATG"
m.Check(Modifier.VBEvents);
Point startPos = t.Location;
EventDeclaration eventDeclaration;
string name = String.Empty;
List<InterfaceImplementation> implementsClause = null;
Identifier();
#line 1165 "VBNET.ATG"
name= t.val;
if (la.kind == 48) {
lexer.NextToken();
TypeName(
#line 1167 "VBNET.ATG"
out type);
} else if (la.kind == 1 || la.kind == 24 || la.kind == 107) {
if (la.kind == 24) {
lexer.NextToken();
if (StartOf(4)) {
FormalParameterList(
#line 1169 "VBNET.ATG"
p);
}
Expect(25);
}
} else SynErr(224);
if (la.kind == 107) {
ImplementsClause(
#line 1171 "VBNET.ATG"
out implementsClause);
}
#line 1173 "VBNET.ATG"
eventDeclaration = new EventDeclaration(type, m.Modifier, p, attributes, name, implementsClause);
eventDeclaration.StartLocation = m.GetDeclarationLocation(startPos);
eventDeclaration.EndLocation = t.EndLocation;
compilationUnit.AddChild(eventDeclaration);
Expect(1);
break;
}
case 2: case 47: case 49: case 50: case 51: case 70: case 144: case 169: case 176: case 177: {
#line 1180 "VBNET.ATG"
Point startPos = t.Location;
#line 1182 "VBNET.ATG"
m.Check(Modifier.Fields);
FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier);
fd.StartLocation = m.GetDeclarationLocation(startPos);
VariableDeclarator(
#line 1186 "VBNET.ATG"
variableDeclarators);
while (la.kind == 12) {
lexer.NextToken();
VariableDeclarator(
#line 1187 "VBNET.ATG"
variableDeclarators);
}
Expect(1);
#line 1190 "VBNET.ATG"
fd.EndLocation = t.EndLocation;
fd.Fields = variableDeclarators;
compilationUnit.AddChild(fd);
break;
}
case 71: {
#line 1195 "VBNET.ATG"
m.Check(Modifier.Fields);
lexer.NextToken();
#line 1196 "VBNET.ATG"
m.Add(Modifier.Const, t.Location);
#line 1198 "VBNET.ATG"
FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier);
fd.StartLocation = m.GetDeclarationLocation(t.Location);
List<VariableDeclaration> constantDeclarators = new List<VariableDeclaration>();
ConstantDeclarator(
#line 1202 "VBNET.ATG"
constantDeclarators);
while (la.kind == 12) {
lexer.NextToken();
ConstantDeclarator(
#line 1203 "VBNET.ATG"
constantDeclarators);
}
#line 1205 "VBNET.ATG"
fd.Fields = constantDeclarators;
fd.EndLocation = t.Location;
Expect(1);
#line 1210 "VBNET.ATG"
fd.EndLocation = t.EndLocation;
compilationUnit.AddChild(fd);
break;
}
case 146: {
lexer.NextToken();
#line 1216 "VBNET.ATG"
m.Check(Modifier.VBProperties);
Point startPos = t.Location;
List<InterfaceImplementation> implementsClause = null;
Identifier();
#line 1220 "VBNET.ATG"
string propertyName = t.val;
if (la.kind == 24) {
lexer.NextToken();
if (StartOf(4)) {
FormalParameterList(
#line 1221 "VBNET.ATG"
p);
}
Expect(25);
}
if (la.kind == 48) {
lexer.NextToken();
TypeName(
#line 1222 "VBNET.ATG"
out type);
}
#line 1224 "VBNET.ATG"
if(type == null) {
type = new TypeReference("System.Object");
}
if (la.kind == 107) {
ImplementsClause(
#line 1228 "VBNET.ATG"
out implementsClause);
}
Expect(1);
if (
#line 1232 "VBNET.ATG"
IsMustOverride(m)) {
#line 1234 "VBNET.ATG"
PropertyDeclaration pDecl = new PropertyDeclaration(propertyName, type, m.Modifier, attributes);
pDecl.StartLocation = m.GetDeclarationLocation(startPos);
pDecl.EndLocation = t.Location;
pDecl.TypeReference = type;
pDecl.InterfaceImplementations = implementsClause;
pDecl.Parameters = p;
compilationUnit.AddChild(pDecl);
} else if (la.kind == 27 || la.kind == 101 || la.kind == 156) {
#line 1244 "VBNET.ATG"
PropertyDeclaration pDecl = new PropertyDeclaration(propertyName, type, m.Modifier, attributes);
pDecl.StartLocation = m.GetDeclarationLocation(startPos);
pDecl.EndLocation = t.Location;
pDecl.BodyStart = t.Location;
pDecl.TypeReference = type;
pDecl.InterfaceImplementations = implementsClause;
pDecl.Parameters = p;
PropertyGetRegion getRegion;
PropertySetRegion setRegion;
AccessorDecls(
#line 1254 "VBNET.ATG"
out getRegion, out setRegion);
Expect(88);
Expect(146);
Expect(1);
#line 1258 "VBNET.ATG"
pDecl.GetRegion = getRegion;
pDecl.SetRegion = setRegion;
pDecl.BodyEnd = t.EndLocation;
compilationUnit.AddChild(pDecl);
} else SynErr(225);
break;
}
case 204: {
lexer.NextToken();
#line 1265 "VBNET.ATG"
Point startPos = t.Location;
Expect(93);
#line 1267 "VBNET.ATG"
m.Check(Modifier.VBCustomEvents);
EventAddRemoveRegion eventAccessorDeclaration;
EventAddRegion addHandlerAccessorDeclaration = null;
EventRemoveRegion removeHandlerAccessorDeclaration = null;
EventRaiseRegion raiseEventAccessorDeclaration = null;
List<InterfaceImplementation> implementsClause = null;
Identifier();
#line 1274 "VBNET.ATG"
string customEventName = t.val;
Expect(48);
TypeName(
#line 1275 "VBNET.ATG"
out type);
if (la.kind == 107) {
ImplementsClause(
#line 1276 "VBNET.ATG"
out implementsClause);
}
Expect(1);
while (StartOf(15)) {
EventAccessorDeclaration(
#line 1279 "VBNET.ATG"
out eventAccessorDeclaration);
#line 1281 "VBNET.ATG"
if(eventAccessorDeclaration is EventAddRegion)
{
addHandlerAccessorDeclaration = (EventAddRegion)eventAccessorDeclaration;
}
else if(eventAccessorDeclaration is EventRemoveRegion)
{
removeHandlerAccessorDeclaration = (EventRemoveRegion)eventAccessorDeclaration;
}
else if(eventAccessorDeclaration is EventRaiseRegion)
{
raiseEventAccessorDeclaration = (EventRaiseRegion)eventAccessorDeclaration;
}
}
Expect(88);
Expect(93);
Expect(1);
#line 1297 "VBNET.ATG"
if(addHandlerAccessorDeclaration == null)
{
Error("Need to provide AddHandler accessor.");
}
if(removeHandlerAccessorDeclaration == null)
{
Error("Need to provide RemoveHandler accessor.");
}
if(raiseEventAccessorDeclaration == null)
{
Error("Need to provide RaiseEvent accessor.");
}
EventDeclaration decl = new EventDeclaration(type, customEventName, m.Modifier, attributes, null);
decl.StartLocation = m.GetDeclarationLocation(startPos);
decl.EndLocation = t.EndLocation;
decl.AddRegion = addHandlerAccessorDeclaration;
decl.RemoveRegion = removeHandlerAccessorDeclaration;
decl.RaiseRegion = raiseEventAccessorDeclaration;
compilationUnit.AddChild(decl);
break;
}
case 187: case 201: case 202: {
#line 1320 "VBNET.ATG"
ConversionType opConversionType = ConversionType.None;
if (la.kind == 201 || la.kind == 202) {
if (la.kind == 202) {
lexer.NextToken();
#line 1321 "VBNET.ATG"
opConversionType = ConversionType.Implicit;
} else {
lexer.NextToken();
#line 1322 "VBNET.ATG"
opConversionType = ConversionType.Explicit;
}
}
Expect(187);
#line 1325 "VBNET.ATG"
m.Check(Modifier.VBOperators);
Point startPos = t.Location;
TypeReference returnType = NullTypeReference.Instance;
TypeReference operandType = NullTypeReference.Instance;
string operandName;
OverloadableOperatorType operatorType;
AttributeSection section;
List<ParameterDeclarationExpression> parameters = new List<ParameterDeclarationExpression>();
List<AttributeSection> returnTypeAttributes = new List<AttributeSection>();
OverloadableOperator(
#line 1335 "VBNET.ATG"
out operatorType);
Expect(24);
if (la.kind == 55) {
lexer.NextToken();
}
Identifier();
#line 1336 "VBNET.ATG"
operandName = t.val;
if (la.kind == 48) {
lexer.NextToken();
TypeName(
#line 1337 "VBNET.ATG"
out operandType);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -